[compiler-rt] r252869 - tsan: fix flakiness of sleep_sync2 test

Dmitry Vyukov via llvm-commits llvm-commits at lists.llvm.org
Thu Nov 12 02:24:22 PST 2015


Author: dvyukov
Date: Thu Nov 12 04:24:22 2015
New Revision: 252869

URL: http://llvm.org/viewvc/llvm-project?rev=252869&view=rev
Log:
tsan: fix flakiness of sleep_sync2 test


Modified:
    compiler-rt/trunk/test/tsan/test.h

Modified: compiler-rt/trunk/test/tsan/test.h
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/tsan/test.h?rev=252869&r1=252868&r2=252869&view=diff
==============================================================================
--- compiler-rt/trunk/test/tsan/test.h (original)
+++ compiler-rt/trunk/test/tsan/test.h Thu Nov 12 04:24:22 2015
@@ -4,6 +4,7 @@
 #include <unistd.h>
 #include <dlfcn.h>
 #include <stddef.h>
+#include <sched.h>
 
 // TSan-invisible barrier.
 // Tests use it to establish necessary execution order in a way that does not
@@ -25,7 +26,9 @@ void barrier_wait(invisible_barrier_t *b
     unsigned cur_epoch = (cur >> 8) / (cur & 0xff);
     if (cur_epoch != old_epoch)
       return;
-    usleep(1000);
+    // Can't use usleep, because it leads to spurious "As if synchronized via
+    // sleep" messages which fail some output tests.
+    sched_yield();
   }
 }
 




More information about the llvm-commits mailing list