[compiler-rt] r325194 - [sanitizer] Fix flakiness in the tests

Vitaly Buka via llvm-commits llvm-commits at lists.llvm.org
Wed Feb 14 16:40:36 PST 2018


Author: vitalybuka
Date: Wed Feb 14 16:40:36 2018
New Revision: 325194

URL: http://llvm.org/viewvc/llvm-project?rev=325194&view=rev
Log:
[sanitizer] Fix flakiness in the tests

Seems tests fails if link already exists.
Also removed duplicated part of tests.

Modified:
    compiler-rt/trunk/test/sanitizer_common/TestCases/Posix/readlink.c
    compiler-rt/trunk/test/sanitizer_common/TestCases/Posix/readlinkat.c

Modified: compiler-rt/trunk/test/sanitizer_common/TestCases/Posix/readlink.c
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/sanitizer_common/TestCases/Posix/readlink.c?rev=325194&r1=325193&r2=325194&view=diff
==============================================================================
--- compiler-rt/trunk/test/sanitizer_common/TestCases/Posix/readlink.c (original)
+++ compiler-rt/trunk/test/sanitizer_common/TestCases/Posix/readlink.c Wed Feb 14 16:40:36 2018
@@ -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;
 }

Modified: compiler-rt/trunk/test/sanitizer_common/TestCases/Posix/readlinkat.c
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/sanitizer_common/TestCases/Posix/readlinkat.c?rev=325194&r1=325193&r2=325194&view=diff
==============================================================================
--- compiler-rt/trunk/test/sanitizer_common/TestCases/Posix/readlinkat.c (original)
+++ compiler-rt/trunk/test/sanitizer_common/TestCases/Posix/readlinkat.c Wed Feb 14 16:40:36 2018
@@ -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);
 




More information about the llvm-commits mailing list