[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:
Vitaly Buka 2018-02-15 00:40:36 +00:00
parent 5c9d4e7957
commit 1fd9f071a2
2 changed files with 2 additions and 7 deletions

View File

@ -12,6 +12,7 @@ int main(int argc, char **argv) {
char symlink_path[PATH_MAX];
snprintf(symlink_path, sizeof(symlink_path), "%s_%d.symlink", argv[0],
getpid());
remove(symlink_path);
int res = symlink(argv[0], symlink_path);
assert(!res);
@ -21,12 +22,5 @@ int main(int argc, char **argv) {
readlink_path[res2] = '\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;
}

View File

@ -11,6 +11,7 @@ int main(int argc, char **argv) {
char symlink_path[PATH_MAX];
snprintf(symlink_path, sizeof(symlink_path), "%s_%d.symlink", argv[0],
getpid());
remove(symlink_path);
int res = symlink(argv[0], symlink_path);
assert(!res);