[sanitizer] Fix flakiness in the tests
Seems tests fails if link already exists. Also removed duplicated part of tests. llvm-svn: 325194
This commit is contained in:
		
							parent
							
								
									5c9d4e7957
								
							
						
					
					
						commit
						1fd9f071a2
					
				| 
						 | 
					@ -12,6 +12,7 @@ int main(int argc, char **argv) {
 | 
				
			||||||
  char symlink_path[PATH_MAX];
 | 
					  char symlink_path[PATH_MAX];
 | 
				
			||||||
  snprintf(symlink_path, sizeof(symlink_path), "%s_%d.symlink", argv[0],
 | 
					  snprintf(symlink_path, sizeof(symlink_path), "%s_%d.symlink", argv[0],
 | 
				
			||||||
           getpid());
 | 
					           getpid());
 | 
				
			||||||
 | 
					  remove(symlink_path);
 | 
				
			||||||
  int res = symlink(argv[0], symlink_path);
 | 
					  int res = symlink(argv[0], symlink_path);
 | 
				
			||||||
  assert(!res);
 | 
					  assert(!res);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -21,12 +22,5 @@ int main(int argc, char **argv) {
 | 
				
			||||||
  readlink_path[res2] = '\0';
 | 
					  readlink_path[res2] = '\0';
 | 
				
			||||||
  assert(!strcmp(readlink_path, argv[0]));
 | 
					  assert(!strcmp(readlink_path, argv[0]));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  char readlinkat_path[PATH_MAX];
 | 
					 | 
				
			||||||
  res2 = readlinkat(AT_FDCWD, symlink_path, readlinkat_path,
 | 
					 | 
				
			||||||
                    sizeof(readlink_path));
 | 
					 | 
				
			||||||
  assert(res2 >= 0);
 | 
					 | 
				
			||||||
  readlinkat_path[res2] = '\0';
 | 
					 | 
				
			||||||
  assert(!strcmp(readlinkat_path, argv[0]));
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  return 0;
 | 
					  return 0;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -11,6 +11,7 @@ int main(int argc, char **argv) {
 | 
				
			||||||
  char symlink_path[PATH_MAX];
 | 
					  char symlink_path[PATH_MAX];
 | 
				
			||||||
  snprintf(symlink_path, sizeof(symlink_path), "%s_%d.symlink", argv[0],
 | 
					  snprintf(symlink_path, sizeof(symlink_path), "%s_%d.symlink", argv[0],
 | 
				
			||||||
           getpid());
 | 
					           getpid());
 | 
				
			||||||
 | 
					  remove(symlink_path);
 | 
				
			||||||
  int res = symlink(argv[0], symlink_path);
 | 
					  int res = symlink(argv[0], symlink_path);
 | 
				
			||||||
  assert(!res);
 | 
					  assert(!res);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue