summaryrefslogtreecommitdiffstats
path: root/compiler-rt/lib/tsan/lit_tests
diff options
context:
space:
mode:
authorDmitry Vyukov <dvyukov@google.com>2013-06-24 16:28:02 +0000
committerDmitry Vyukov <dvyukov@google.com>2013-06-24 16:28:02 +0000
commit5001d43dcb90af52f7fbe96c8a37237f7860679f (patch)
treeb7a78bef31d1a0ed6f0d298643ecc343b5bfb6a4 /compiler-rt/lib/tsan/lit_tests
parent4cd3c9adf93715720153cc6fedf0cb0cc7583170 (diff)
downloadbcm5719-llvm-5001d43dcb90af52f7fbe96c8a37237f7860679f.tar.gz
bcm5719-llvm-5001d43dcb90af52f7fbe96c8a37237f7860679f.zip
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 llvm-svn: 184752
Diffstat (limited to 'compiler-rt/lib/tsan/lit_tests')
-rw-r--r--compiler-rt/lib/tsan/lit_tests/tiny_race.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/compiler-rt/lib/tsan/lit_tests/tiny_race.c b/compiler-rt/lib/tsan/lit_tests/tiny_race.c
index 44cc1332f2a..1ade8e2bf52 100644
--- a/compiler-rt/lib/tsan/lit_tests/tiny_race.c
+++ b/compiler-rt/lib/tsan/lit_tests/tiny_race.c
@@ -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
OpenPOWER on IntegriCloud