[compiler-rt] r184752 - tsan: make the test more robust

Dmitry Vyukov dvyukov at google.com
Mon Jun 24 09:28:03 PDT 2013


Author: dvyukov
Date: Mon Jun 24 11:28:02 2013
New Revision: 184752

URL: http://llvm.org/viewvc/llvm-project?rev=184752&view=rev
Log:
tsan: make the test more robust
currently it episodically fails
the hypothesis it is due to racy race detection algorithm
the sleep should make it more robust

Modified:
    compiler-rt/trunk/lib/tsan/lit_tests/tiny_race.c

Modified: compiler-rt/trunk/lib/tsan/lit_tests/tiny_race.c
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/tsan/lit_tests/tiny_race.c?rev=184752&r1=184751&r2=184752&view=diff
==============================================================================
--- compiler-rt/trunk/lib/tsan/lit_tests/tiny_race.c (original)
+++ compiler-rt/trunk/lib/tsan/lit_tests/tiny_race.c Mon Jun 24 11:28:02 2013
@@ -1,15 +1,21 @@
 // RUN: %clang_tsan -O1 %s -o %t && %t 2>&1 | FileCheck %s
 #include <pthread.h>
+#include <unistd.h>
+
 int Global;
+
 void *Thread1(void *x) {
+  sleep(1);
   Global = 42;
   return x;
 }
+
 int main() {
   pthread_t t;
-  pthread_create(&t, NULL, Thread1, NULL);
+  pthread_create(&t, 0, Thread1, 0);
   Global = 43;
-  pthread_join(t, NULL);
+  pthread_join(t, 0);
   return Global;
 }
+
 // CHECK: WARNING: ThreadSanitizer: data race





More information about the llvm-commits mailing list