diff options
| author | Dmitry Vyukov <dvyukov@google.com> | 2014-05-30 14:08:51 +0000 |
|---|---|---|
| committer | Dmitry Vyukov <dvyukov@google.com> | 2014-05-30 14:08:51 +0000 |
| commit | 233f401c2bf247d9764c3ca641513dafb623e00c (patch) | |
| tree | 7e93f47d2cf396344a1bb40f4f1dc1bda592e433 /compiler-rt/test/tsan | |
| parent | afdcc96d9f0a3325a70d8433cd103efdb56340a9 (diff) | |
| download | bcm5719-llvm-233f401c2bf247d9764c3ca641513dafb623e00c.tar.gz bcm5719-llvm-233f401c2bf247d9764c3ca641513dafb623e00c.zip | |
tsan: make positive tests more robust
Add a script that is used to deflake inherently flaky tsan tests.
It is invoked from lit tests as:
%deflake %run %t
The script runs the target program up to 10 times,
until it produces a tsan warning.
llvm-svn: 209898
Diffstat (limited to 'compiler-rt/test/tsan')
89 files changed, 206 insertions, 127 deletions
diff --git a/compiler-rt/test/tsan/atomic_free.cc b/compiler-rt/test/tsan/atomic_free.cc index c36b8fb3655..1dcf887c41d 100644 --- a/compiler-rt/test/tsan/atomic_free.cc +++ b/compiler-rt/test/tsan/atomic_free.cc @@ -1,4 +1,4 @@ -// RUN: %clangxx_tsan -O1 %s -o %t && not %run %t 2>&1 | FileCheck %s +// RUN: %clangxx_tsan -O1 %s -o %t && %deflake %run %t | FileCheck %s #include <pthread.h> #include <unistd.h> diff --git a/compiler-rt/test/tsan/atomic_free2.cc b/compiler-rt/test/tsan/atomic_free2.cc index 11204ba77d0..c50be6bba94 100644 --- a/compiler-rt/test/tsan/atomic_free2.cc +++ b/compiler-rt/test/tsan/atomic_free2.cc @@ -1,4 +1,4 @@ -// RUN: %clangxx_tsan -O1 %s -o %t && not %run %t 2>&1 | FileCheck %s +// RUN: %clangxx_tsan -O1 %s -o %t && %deflake %run %t | FileCheck %s #include <pthread.h> #include <unistd.h> diff --git a/compiler-rt/test/tsan/atomic_race.cc b/compiler-rt/test/tsan/atomic_race.cc index e64ef96ed4b..ca444b42b5b 100644 --- a/compiler-rt/test/tsan/atomic_race.cc +++ b/compiler-rt/test/tsan/atomic_race.cc @@ -1,4 +1,4 @@ -// RUN: %clangxx_tsan -O1 %s -o %t && not %run %t 2>&1 | FileCheck %s +// RUN: %clangxx_tsan -O1 %s -o %t && %deflake %run %t | FileCheck %s #include <pthread.h> #include <unistd.h> #include <stdio.h> diff --git a/compiler-rt/test/tsan/atomic_stack.cc b/compiler-rt/test/tsan/atomic_stack.cc index d28b5b962c7..7e3176f8e78 100644 --- a/compiler-rt/test/tsan/atomic_stack.cc +++ b/compiler-rt/test/tsan/atomic_stack.cc @@ -1,4 +1,4 @@ -// RUN: %clangxx_tsan -O1 %s -o %t && not %run %t 2>&1 | FileCheck %s +// RUN: %clangxx_tsan -O1 %s -o %t && %deflake %run %t | FileCheck %s #include <pthread.h> #include <unistd.h> diff --git a/compiler-rt/test/tsan/cond_race.cc b/compiler-rt/test/tsan/cond_race.cc index 375bd920a1b..fa42fafca4d 100644 --- a/compiler-rt/test/tsan/cond_race.cc +++ b/compiler-rt/test/tsan/cond_race.cc @@ -1,4 +1,4 @@ -// RUN: %clang_tsan -O1 %s -o %t && not %run %t 2>&1 | FileCheck %s +// RUN: %clang_tsan -O1 %s -o %t && %deflake %run %t | FileCheck %s // CHECK-NOT: unlock of unlocked mutex // CHECK: ThreadSanitizer: data race // CHECK: pthread_cond_signal diff --git a/compiler-rt/test/tsan/deadlock_detector_stress_test.cc b/compiler-rt/test/tsan/deadlock_detector_stress_test.cc index ac9fcbd5eef..53624782e07 100644 --- a/compiler-rt/test/tsan/deadlock_detector_stress_test.cc +++ b/compiler-rt/test/tsan/deadlock_detector_stress_test.cc @@ -1,12 +1,12 @@ // RUN: %clangxx_tsan %s -o %t -DLockType=PthreadMutex -// RUN: TSAN_OPTIONS=detect_deadlocks=1 not %run %t 2>&1 | FileCheck %s --check-prefix=CHECK --check-prefix=CHECK-NOT-SECOND -// TSAN_OPTIONS="detect_deadlocks=1 second_deadlock_stack=1" not %run %t 2>&1 | FileCheck %s --check-prefix=CHECK --check-prefix=CHECK-SECOND +// RUN: TSAN_OPTIONS=detect_deadlocks=1 %deflake %run %t | FileCheck %s --check-prefix=CHECK --check-prefix=CHECK-NOT-SECOND +// TSAN_OPTIONS="detect_deadlocks=1 second_deadlock_stack=1" %deflake %run %t | FileCheck %s --check-prefix=CHECK --check-prefix=CHECK-SECOND // RUN: %clangxx_tsan %s -o %t -DLockType=PthreadSpinLock -// RUN: TSAN_OPTIONS=detect_deadlocks=1 not %run %t 2>&1 | FileCheck %s +// RUN: TSAN_OPTIONS=detect_deadlocks=1 %deflake %run %t | FileCheck %s // RUN: %clangxx_tsan %s -o %t -DLockType=PthreadRWLock -// RUN: TSAN_OPTIONS=detect_deadlocks=1 not %run %t 2>&1 | FileCheck %s --check-prefix=CHECK --check-prefix=CHECK-RD +// RUN: TSAN_OPTIONS=detect_deadlocks=1 %deflake %run %t | FileCheck %s --check-prefix=CHECK --check-prefix=CHECK-RD // RUN: %clangxx_tsan %s -o %t -DLockType=PthreadRecursiveMutex -// RUN: TSAN_OPTIONS=detect_deadlocks=1 not %run %t 2>&1 | FileCheck %s --check-prefix=CHECK --check-prefix=CHECK-REC +// RUN: TSAN_OPTIONS=detect_deadlocks=1 %deflake %run %t | FileCheck %s --check-prefix=CHECK --check-prefix=CHECK-REC #include <pthread.h> #undef NDEBUG #include <assert.h> diff --git a/compiler-rt/test/tsan/deep_stack1.cc b/compiler-rt/test/tsan/deep_stack1.cc index 617f102b1e0..1d00a0e856d 100644 --- a/compiler-rt/test/tsan/deep_stack1.cc +++ b/compiler-rt/test/tsan/deep_stack1.cc @@ -1,5 +1,5 @@ -// RUN: %clangxx_tsan -O1 %s -o %t -DORDER1 && not %run %t 2>&1 | FileCheck %s -// RUN: %clangxx_tsan -O1 %s -o %t -DORDER2 && not %run %t 2>&1 | FileCheck %s +// RUN: %clangxx_tsan -O1 %s -o %t -DORDER1 && %deflake %run %t | FileCheck %s +// RUN: %clangxx_tsan -O1 %s -o %t -DORDER2 && %deflake %run %t | FileCheck %s #include <pthread.h> #include <stdio.h> #include <unistd.h> diff --git a/compiler-rt/test/tsan/deflake.bash b/compiler-rt/test/tsan/deflake.bash new file mode 100755 index 00000000000..9731fa53e58 --- /dev/null +++ b/compiler-rt/test/tsan/deflake.bash @@ -0,0 +1,17 @@ +#!/usr/bin/env bash +# This script is used to deflake inherently flaky tsan tests. +# It is invoked from lit tests as: +# %deflake mybinary +# which is then substituted by lit to: +# $(dirname %s)/deflake.bash mybinary +# The script runs the target program up to 10 times, +# until it fails (i.e. produces a race report). + +for i in $(seq 1 10); do + OUT=`$@ 2>&1` + if [[ $? != 0 ]]; then + echo "$OUT" + exit 0 + fi +done +exit 1 diff --git a/compiler-rt/test/tsan/fd_location.cc b/compiler-rt/test/tsan/fd_location.cc index ebe33be759a..535329e0640 100644 --- a/compiler-rt/test/tsan/fd_location.cc +++ b/compiler-rt/test/tsan/fd_location.cc @@ -1,4 +1,4 @@ -// RUN: %clangxx_tsan -O1 %s -o %t && not %run %t 2>&1 | FileCheck %s +// RUN: %clangxx_tsan -O1 %s -o %t && %deflake %run %t | FileCheck %s #include <pthread.h> #include <stdio.h> #include <unistd.h> diff --git a/compiler-rt/test/tsan/fd_pipe_race.cc b/compiler-rt/test/tsan/fd_pipe_race.cc index 384cafa19ca..88c4ed4aa39 100644 --- a/compiler-rt/test/tsan/fd_pipe_race.cc +++ b/compiler-rt/test/tsan/fd_pipe_race.cc @@ -1,4 +1,4 @@ -// RUN: %clangxx_tsan -O1 %s -o %t && not %run %t 2>&1 | FileCheck %s +// RUN: %clangxx_tsan -O1 %s -o %t && %deflake %run %t | FileCheck %s #include <pthread.h> #include <stdio.h> #include <unistd.h> diff --git a/compiler-rt/test/tsan/fd_stdout_race.cc b/compiler-rt/test/tsan/fd_stdout_race.cc index 47f3c6f6c1a..d6a2c7c796f 100644 --- a/compiler-rt/test/tsan/fd_stdout_race.cc +++ b/compiler-rt/test/tsan/fd_stdout_race.cc @@ -1,4 +1,4 @@ -// RUN: %clangxx_tsan -O1 %s -o %t && not %run %t 2>&1 | FileCheck %s +// RUN: %clangxx_tsan -O1 %s -o %t && %deflake %run %t | FileCheck %s #include <pthread.h> #include <stdio.h> #include <unistd.h> diff --git a/compiler-rt/test/tsan/free_race.c b/compiler-rt/test/tsan/free_race.c index 040f22334ea..663d7bcf2eb 100644 --- a/compiler-rt/test/tsan/free_race.c +++ b/compiler-rt/test/tsan/free_race.c @@ -1,5 +1,5 @@ // RUN: %clang_tsan -O1 %s -o %t -// RUN: not %run %t 2>&1 | FileCheck %s --check-prefix=CHECK-NOZUPP +// RUN: %deflake %run %t | FileCheck %s --check-prefix=CHECK-NOZUPP // RUN: TSAN_OPTIONS="suppressions=%s.supp print_suppressions=1" %run %t 2>&1 | FileCheck %s --check-prefix=CHECK-SUPP #include <pthread.h> diff --git a/compiler-rt/test/tsan/free_race2.c b/compiler-rt/test/tsan/free_race2.c index 2b979f31119..de6b2ae1fcb 100644 --- a/compiler-rt/test/tsan/free_race2.c +++ b/compiler-rt/test/tsan/free_race2.c @@ -1,4 +1,4 @@ -// RUN: %clang_tsan -O1 %s -o %t && not %run %t 2>&1 | FileCheck %s +// RUN: %clang_tsan -O1 %s -o %t && %deflake %run %t | FileCheck %s #include <stdlib.h> void __attribute__((noinline)) foo(int *mem) { diff --git a/compiler-rt/test/tsan/global_race.cc b/compiler-rt/test/tsan/global_race.cc index d28700cbccd..224ab227eed 100644 --- a/compiler-rt/test/tsan/global_race.cc +++ b/compiler-rt/test/tsan/global_race.cc @@ -1,44 +1,26 @@ -// RUN: %clangxx_tsan -O1 %s -o %t && not %run %t 2>&1 | FileCheck %s +// RUN: %clangxx_tsan -O1 %s -o %t && %deflake %run %t | FileCheck %s #include <pthread.h> #include <stdio.h> #include <stddef.h> #include <unistd.h> int GlobalData[10]; -int x; -namespace XXX { - struct YYY { - static int ZZZ[10]; - }; - int YYY::ZZZ[10]; -} void *Thread(void *a) { sleep(1); GlobalData[2] = 42; - x = 1; - XXX::YYY::ZZZ[0] = 1; return 0; } int main() { fprintf(stderr, "addr=%p\n", GlobalData); - fprintf(stderr, "addr2=%p\n", &x); - fprintf(stderr, "addr3=%p\n", XXX::YYY::ZZZ); pthread_t t; pthread_create(&t, 0, Thread, 0); GlobalData[2] = 43; - x = 0; - XXX::YYY::ZZZ[0] = 0; pthread_join(t, 0); } // CHECK: addr=[[ADDR:0x[0-9,a-f]+]] -// CHECK: addr2=[[ADDR2:0x[0-9,a-f]+]] -// CHECK: addr3=[[ADDR3:0x[0-9,a-f]+]] // CHECK: WARNING: ThreadSanitizer: data race // CHECK: Location is global 'GlobalData' of size 40 at [[ADDR]] ({{.*}}+0x{{[0-9,a-f]+}}) -// CHECK: WARNING: ThreadSanitizer: data race -// CHECK: Location is global 'x' of size 4 at [[ADDR2]] ({{.*}}+0x{{[0-9,a-f]+}}) -// CHECK: WARNING: ThreadSanitizer: data race -// CHECK: Location is global 'XXX::YYY::ZZZ' of size 40 at [[ADDR3]] ({{.*}}+0x{{[0-9,a-f]+}}) + diff --git a/compiler-rt/test/tsan/global_race2.cc b/compiler-rt/test/tsan/global_race2.cc new file mode 100644 index 00000000000..b8352ba52f8 --- /dev/null +++ b/compiler-rt/test/tsan/global_race2.cc @@ -0,0 +1,26 @@ +// RUN: %clangxx_tsan -O1 %s -o %t && %deflake %run %t | FileCheck %s +#include <pthread.h> +#include <stdio.h> +#include <stddef.h> +#include <unistd.h> + +int x; + +void *Thread(void *a) { + sleep(1); + x = 1; + return 0; +} + +int main() { + fprintf(stderr, "addr2=%p\n", &x); + pthread_t t; + pthread_create(&t, 0, Thread, 0); + x = 0; + pthread_join(t, 0); +} + +// CHECK: addr2=[[ADDR2:0x[0-9,a-f]+]] +// CHECK: WARNING: ThreadSanitizer: data race +// CHECK: Location is global 'x' of size 4 at [[ADDR2]] ({{.*}}+0x{{[0-9,a-f]+}}) + diff --git a/compiler-rt/test/tsan/global_race3.cc b/compiler-rt/test/tsan/global_race3.cc new file mode 100644 index 00000000000..e37bf78b7d2 --- /dev/null +++ b/compiler-rt/test/tsan/global_race3.cc @@ -0,0 +1,30 @@ +// RUN: %clangxx_tsan -O1 %s -o %t && %deflake %run %t | FileCheck %s +#include <pthread.h> +#include <stdio.h> +#include <stddef.h> +#include <unistd.h> + +namespace XXX { + struct YYY { + static int ZZZ[10]; + }; + int YYY::ZZZ[10]; +} + +void *Thread(void *a) { + sleep(1); + XXX::YYY::ZZZ[0] = 1; + return 0; +} + +int main() { + fprintf(stderr, "addr3=%p\n", XXX::YYY::ZZZ); + pthread_t t; + pthread_create(&t, 0, Thread, 0); + XXX::YYY::ZZZ[0] = 0; + pthread_join(t, 0); +} + +// CHECK: addr3=[[ADDR3:0x[0-9,a-f]+]] +// CHECK: WARNING: ThreadSanitizer: data race +// CHECK: Location is global 'XXX::YYY::ZZZ' of size 40 at [[ADDR3]] ({{.*}}+0x{{[0-9,a-f]+}}) diff --git a/compiler-rt/test/tsan/halt_on_error.cc b/compiler-rt/test/tsan/halt_on_error.cc index 4574801786d..3c55c60a457 100644 --- a/compiler-rt/test/tsan/halt_on_error.cc +++ b/compiler-rt/test/tsan/halt_on_error.cc @@ -1,4 +1,4 @@ -// RUN: %clang_tsan -O1 %s -o %t && TSAN_OPTIONS="$TSAN_OPTIONS halt_on_error=1" not %run %t 2>&1 | FileCheck %s +// RUN: %clang_tsan -O1 %s -o %t && TSAN_OPTIONS="$TSAN_OPTIONS halt_on_error=1" %deflake %run %t | FileCheck %s #include <pthread.h> #include <stdio.h> #include <unistd.h> diff --git a/compiler-rt/test/tsan/heap_race.cc b/compiler-rt/test/tsan/heap_race.cc index 63591e07b36..c3da68f4265 100644 --- a/compiler-rt/test/tsan/heap_race.cc +++ b/compiler-rt/test/tsan/heap_race.cc @@ -1,4 +1,4 @@ -// RUN: %clangxx_tsan -O1 %s -o %t && not %run %t 2>&1 | FileCheck %s +// RUN: %clangxx_tsan -O1 %s -o %t && %deflake %run %t | FileCheck %s #include <pthread.h> #include <stdio.h> #include <stddef.h> diff --git a/compiler-rt/test/tsan/ignore_lib0.cc b/compiler-rt/test/tsan/ignore_lib0.cc index d62aa99dc6c..fe1a3555801 100644 --- a/compiler-rt/test/tsan/ignore_lib0.cc +++ b/compiler-rt/test/tsan/ignore_lib0.cc @@ -1,7 +1,7 @@ // RUN: %clangxx_tsan -O1 %s -DLIB -fPIC -fno-sanitize=thread -shared -o %T/libignore_lib0.so // RUN: %clangxx_tsan -O1 %s -L%T -lignore_lib0 -o %t // RUN: echo running w/o suppressions: -// RUN: LD_LIBRARY_PATH=%T${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH} not %run %t 2>&1 | FileCheck %s --check-prefix=CHECK-NOSUPP +// RUN: LD_LIBRARY_PATH=%T${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH} %deflake %run %t | FileCheck %s --check-prefix=CHECK-NOSUPP // RUN: echo running with suppressions: // RUN: LD_LIBRARY_PATH=%T${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH} TSAN_OPTIONS="$TSAN_OPTIONS suppressions=%s.supp" %run %t 2>&1 | FileCheck %s --check-prefix=CHECK-WITHSUPP diff --git a/compiler-rt/test/tsan/ignore_lib1.cc b/compiler-rt/test/tsan/ignore_lib1.cc index b848350d7ca..30a9994b94f 100644 --- a/compiler-rt/test/tsan/ignore_lib1.cc +++ b/compiler-rt/test/tsan/ignore_lib1.cc @@ -1,7 +1,7 @@ // RUN: %clangxx_tsan -O1 %s -DLIB -fPIC -fno-sanitize=thread -shared -o %T/libignore_lib1.so // RUN: %clangxx_tsan -O1 %s -o %t // RUN: echo running w/o suppressions: -// RUN: not %run %t 2>&1 | FileCheck %s --check-prefix=CHECK-NOSUPP +// RUN: %deflake %run %t | FileCheck %s --check-prefix=CHECK-NOSUPP // RUN: echo running with suppressions: // RUN: TSAN_OPTIONS="$TSAN_OPTIONS suppressions=%s.supp" %run %t 2>&1 | FileCheck %s --check-prefix=CHECK-WITHSUPP diff --git a/compiler-rt/test/tsan/ignore_lib2.cc b/compiler-rt/test/tsan/ignore_lib2.cc index 7467ec0f2e2..23a0872feab 100644 --- a/compiler-rt/test/tsan/ignore_lib2.cc +++ b/compiler-rt/test/tsan/ignore_lib2.cc @@ -1,7 +1,7 @@ // RUN: %clangxx_tsan -O1 %s -DLIB -fPIC -fno-sanitize=thread -shared -o %T/libignore_lib2_0.so // RUN: %clangxx_tsan -O1 %s -DLIB -fPIC -fno-sanitize=thread -shared -o %T/libignore_lib2_1.so // RUN: %clangxx_tsan -O1 %s -o %t -// RUN: TSAN_OPTIONS="$TSAN_OPTIONS suppressions=%s.supp" not %run %t 2>&1 | FileCheck %s +// RUN: TSAN_OPTIONS="$TSAN_OPTIONS suppressions=%s.supp" %deflake %run %t | FileCheck %s // Tests that called_from_lib suppression matched against 2 libraries // causes program crash (this is not supported). diff --git a/compiler-rt/test/tsan/ignore_lib3.cc b/compiler-rt/test/tsan/ignore_lib3.cc index 6a5f5cceae4..137109ea6cb 100644 --- a/compiler-rt/test/tsan/ignore_lib3.cc +++ b/compiler-rt/test/tsan/ignore_lib3.cc @@ -1,6 +1,6 @@ // RUN: %clangxx_tsan -O1 %s -DLIB -fPIC -fno-sanitize=thread -shared -o %T/libignore_lib3.so // RUN: %clangxx_tsan -O1 %s -o %t -// RUN: TSAN_OPTIONS="$TSAN_OPTIONS suppressions=%s.supp" not %run %t 2>&1 | FileCheck %s +// RUN: TSAN_OPTIONS="$TSAN_OPTIONS suppressions=%s.supp" %deflake %run %t | FileCheck %s // Tests that unloading of a library matched against called_from_lib suppression // causes program crash (this is not supported). diff --git a/compiler-rt/test/tsan/ignore_sync.cc b/compiler-rt/test/tsan/ignore_sync.cc index ae6edaea0e1..ae24a8c49e7 100644 --- a/compiler-rt/test/tsan/ignore_sync.cc +++ b/compiler-rt/test/tsan/ignore_sync.cc @@ -1,4 +1,4 @@ -// RUN: %clangxx_tsan -O1 %s -o %t && not %run %t 2>&1 | FileCheck %s +// RUN: %clangxx_tsan -O1 %s -o %t && %deflake %run %t | FileCheck %s #include <pthread.h> #include <stdio.h> diff --git a/compiler-rt/test/tsan/inlined_memcpy_race.cc b/compiler-rt/test/tsan/inlined_memcpy_race.cc index 12f82d264d8..a95576a83c9 100644 --- a/compiler-rt/test/tsan/inlined_memcpy_race.cc +++ b/compiler-rt/test/tsan/inlined_memcpy_race.cc @@ -1,22 +1,17 @@ -// RUN: %clangxx_tsan -O1 %s -o %t && not %run %t 2>&1 | FileCheck %s +// RUN: %clangxx_tsan -O1 %s -o %t && %deflake %run %t | FileCheck %s #include <pthread.h> #include <stddef.h> #include <stdio.h> #include <string.h> #include <unistd.h> -int x[4], y[4], z[4]; +int x[4], z[4]; void *MemCpyThread(void *a) { memcpy((int*)a, z, 16); return NULL; } -void *MemMoveThread(void *a) { - memmove((int*)a, z, 16); - return NULL; -} - void *MemSetThread(void *a) { sleep(1); memset((int*)a, 0, 16); @@ -30,12 +25,6 @@ int main() { pthread_create(&t[1], NULL, MemSetThread, x); pthread_join(t[0], NULL); pthread_join(t[1], NULL); - // Race on y between memmove and memset - pthread_create(&t[0], NULL, MemMoveThread, y); - pthread_create(&t[1], NULL, MemSetThread, y); - pthread_join(t[0], NULL); - pthread_join(t[1], NULL); - printf("PASS\n"); return 0; } @@ -47,9 +36,3 @@ int main() { // CHECK: #0 memcpy // CHECK: #1 MemCpyThread -// CHECK: WARNING: ThreadSanitizer: data race -// CHECK: #0 memset -// CHECK: #1 MemSetThread -// CHECK: Previous write -// CHECK: #0 memmove -// CHECK: #1 MemMoveThread diff --git a/compiler-rt/test/tsan/inlined_memcpy_race2.cc b/compiler-rt/test/tsan/inlined_memcpy_race2.cc new file mode 100644 index 00000000000..63b560f0226 --- /dev/null +++ b/compiler-rt/test/tsan/inlined_memcpy_race2.cc @@ -0,0 +1,38 @@ +// RUN: %clangxx_tsan -O1 %s -o %t && %deflake %run %t | FileCheck %s +#include <pthread.h> +#include <stddef.h> +#include <stdio.h> +#include <string.h> +#include <unistd.h> + +int y[4], z[4]; + +void *MemMoveThread(void *a) { + memmove((int*)a, z, 16); + return NULL; +} + +void *MemSetThread(void *a) { + sleep(1); + memset((int*)a, 0, 16); + return NULL; +} + +int main() { + pthread_t t[2]; + // Race on y between memmove and memset + pthread_create(&t[0], NULL, MemMoveThread, y); + pthread_create(&t[1], NULL, MemSetThread, y); + pthread_join(t[0], NULL); + pthread_join(t[1], NULL); + + printf("PASS\n"); + return 0; +} + +// CHECK: WARNING: ThreadSanitizer: data race +// CHECK: #0 memset +// CHECK: #1 MemSetThread +// CHECK: Previous write +// CHECK: #0 memmove +// CHECK: #1 MemMoveThread diff --git a/compiler-rt/test/tsan/java_lock_rec_race.cc b/compiler-rt/test/tsan/java_lock_rec_race.cc index c802b9e7780..af308d7b7f3 100644 --- a/compiler-rt/test/tsan/java_lock_rec_race.cc +++ b/compiler-rt/test/tsan/java_lock_rec_race.cc @@ -1,4 +1,4 @@ -// RUN: %clangxx_tsan -O1 %s -o %t && not %run %t 2>&1 | FileCheck %s +// RUN: %clangxx_tsan -O1 %s -o %t && %deflake %run %t | FileCheck %s #include "java.h" #include <unistd.h> diff --git a/compiler-rt/test/tsan/java_race.cc b/compiler-rt/test/tsan/java_race.cc index 27b5c7fb6e5..10aefdbaf19 100644 --- a/compiler-rt/test/tsan/java_race.cc +++ b/compiler-rt/test/tsan/java_race.cc @@ -1,4 +1,4 @@ -// RUN: %clangxx_tsan -O1 %s -o %t && not %run %t 2>&1 | FileCheck %s +// RUN: %clangxx_tsan -O1 %s -o %t && %deflake %run %t | FileCheck %s #include "java.h" void *Thread(void *p) { diff --git a/compiler-rt/test/tsan/java_race_move.cc b/compiler-rt/test/tsan/java_race_move.cc index b7446665a39..45876a03402 100644 --- a/compiler-rt/test/tsan/java_race_move.cc +++ b/compiler-rt/test/tsan/java_race_move.cc @@ -1,4 +1,4 @@ -// RUN: %clangxx_tsan -O1 %s -o %t && not %run %t 2>&1 | FileCheck %s +// RUN: %clangxx_tsan -O1 %s -o %t && %deflake %run %t | FileCheck %s #include "java.h" jptr varaddr; diff --git a/compiler-rt/test/tsan/lit.cfg b/compiler-rt/test/tsan/lit.cfg index 7b7c2bb71b1..f7051b3b698 100644 --- a/compiler-rt/test/tsan/lit.cfg +++ b/compiler-rt/test/tsan/lit.cfg @@ -57,6 +57,8 @@ config.substitutions.append( ("%clangxx_tsan ", build_invocation(clang_tsan_cxxf # Define CHECK-%os to check for OS-dependent output. config.substitutions.append( ('CHECK-%os', ("CHECK-" + config.host_os))) +config.substitutions.append( ("%deflake ", os.path.join(os.path.dirname(__file__), "deflake.bash")) ) + # Default test suffixes. config.suffixes = ['.c', '.cc', '.cpp'] diff --git a/compiler-rt/test/tsan/load_shared_lib.cc b/compiler-rt/test/tsan/load_shared_lib.cc index 2b250e3e6f3..2747b295114 100644 --- a/compiler-rt/test/tsan/load_shared_lib.cc +++ b/compiler-rt/test/tsan/load_shared_lib.cc @@ -4,7 +4,7 @@ // RUN: %clangxx_tsan -O1 %p/SharedLibs/load_shared_lib-so.cc \ // RUN: -fPIC -shared -o %t-so.so -// RUN: %clangxx_tsan -O1 %s -o %t && not %run %t 2>&1 | FileCheck %s +// RUN: %clangxx_tsan -O1 %s -o %t && %deflake %run %t | FileCheck %s #include <dlfcn.h> #include <pthread.h> diff --git a/compiler-rt/test/tsan/longjmp3.cc b/compiler-rt/test/tsan/longjmp3.cc index afb4996d433..71d964dbbed 100644 --- a/compiler-rt/test/tsan/longjmp3.cc +++ b/compiler-rt/test/tsan/longjmp3.cc @@ -1,4 +1,4 @@ -// RUN: %clang_tsan -O1 %s -o %t && not %run %t 2>&1 | FileCheck %s +// RUN: %clang_tsan -O1 %s -o %t && %deflake %run %t | FileCheck %s #include <pthread.h> #include <stdio.h> #include <stdlib.h> diff --git a/compiler-rt/test/tsan/longjmp4.cc b/compiler-rt/test/tsan/longjmp4.cc index 1ec3b4b7e78..15330f5d83c 100644 --- a/compiler-rt/test/tsan/longjmp4.cc +++ b/compiler-rt/test/tsan/longjmp4.cc @@ -1,4 +1,4 @@ -// RUN: %clang_tsan -O1 %s -o %t && not %run %t 2>&1 | FileCheck %s +// RUN: %clang_tsan -O1 %s -o %t && %deflake %run %t | FileCheck %s #include <pthread.h> #include <stdio.h> #include <stdlib.h> diff --git a/compiler-rt/test/tsan/malloc_hook.cc b/compiler-rt/test/tsan/malloc_hook.cc index 63e1c3cac3a..a2658b79a7f 100644 --- a/compiler-rt/test/tsan/malloc_hook.cc +++ b/compiler-rt/test/tsan/malloc_hook.cc @@ -1,4 +1,4 @@ -// RUN: %clangxx_tsan -O1 %s -o %t && not %run %t 2>&1 | FileCheck %s +// RUN: %clangxx_tsan -O1 %s -o %t && %deflake %run %t | FileCheck %s #include <pthread.h> #include <unistd.h> #include <stdio.h> diff --git a/compiler-rt/test/tsan/malloc_stack.cc b/compiler-rt/test/tsan/malloc_stack.cc index cea6020181e..6027360754a 100644 --- a/compiler-rt/test/tsan/malloc_stack.cc +++ b/compiler-rt/test/tsan/malloc_stack.cc @@ -1,4 +1,4 @@ -// RUN: %clang_tsan -O1 %s -o %t && not %run %t 2>&1 | FileCheck %s +// RUN: %clang_tsan -O1 %s -o %t && %deflake %run %t | FileCheck %s #include <pthread.h> #include <unistd.h> diff --git a/compiler-rt/test/tsan/memcpy_race.cc b/compiler-rt/test/tsan/memcpy_race.cc index d7314d2557d..8ec8e0a3e6a 100644 --- a/compiler-rt/test/tsan/memcpy_race.cc +++ b/compiler-rt/test/tsan/memcpy_race.cc @@ -1,4 +1,4 @@ -// RUN: %clangxx_tsan -O1 %s -o %t && not %run %t 2>&1 | FileCheck %s +// RUN: %clangxx_tsan -O1 %s -o %t && %deflake %run %t | FileCheck %s #include <pthread.h> #include <stddef.h> #include <stdio.h> diff --git a/compiler-rt/test/tsan/mop_with_offset.cc b/compiler-rt/test/tsan/mop_with_offset.cc index e9342794d7d..e44c78b7d1b 100644 --- a/compiler-rt/test/tsan/mop_with_offset.cc +++ b/compiler-rt/test/tsan/mop_with_offset.cc @@ -1,4 +1,4 @@ -// RUN: %clangxx_tsan -O1 %s -o %t && not %run %t 2>&1 | FileCheck %s +// RUN: %clangxx_tsan -O1 %s -o %t && %deflake %run %t | FileCheck %s #include <pthread.h> #include <stddef.h> #include <stdio.h> diff --git a/compiler-rt/test/tsan/mop_with_offset2.cc b/compiler-rt/test/tsan/mop_with_offset2.cc index 31b4a406d44..a465d5f0947 100644 --- a/compiler-rt/test/tsan/mop_with_offset2.cc +++ b/compiler-rt/test/tsan/mop_with_offset2.cc @@ -1,4 +1,4 @@ -// RUN: %clangxx_tsan -O1 %s -o %t && not %run %t 2>&1 | FileCheck %s +// RUN: %clangxx_tsan -O1 %s -o %t && %deflake %run %t | FileCheck %s #include <pthread.h> #include <stddef.h> #include <stdio.h> diff --git a/compiler-rt/test/tsan/mutex_bad_read_lock.cc b/compiler-rt/test/tsan/mutex_bad_read_lock.cc index c64bf8849dc..84a2976d53e 100644 --- a/compiler-rt/test/tsan/mutex_bad_read_lock.cc +++ b/compiler-rt/test/tsan/mutex_bad_read_lock.cc @@ -1,4 +1,4 @@ -// RUN: %clangxx_tsan -O1 %s -o %t && not %run %t 2>&1 | FileCheck %s +// RUN: %clangxx_tsan -O1 %s -o %t && %deflake %run %t | FileCheck %s extern "C" void AnnotateRWLockAcquired(const char *f, int l, void *m, long rw); int main() { diff --git a/compiler-rt/test/tsan/mutex_bad_read_unlock.cc b/compiler-rt/test/tsan/mutex_bad_read_unlock.cc index ab417f43c46..dcee51599d5 100644 --- a/compiler-rt/test/tsan/mutex_bad_read_unlock.cc +++ b/compiler-rt/test/tsan/mutex_bad_read_unlock.cc @@ -1,4 +1,4 @@ -// RUN: %clangxx_tsan -O1 %s -o %t && not %run %t 2>&1 | FileCheck %s +// RUN: %clangxx_tsan -O1 %s -o %t && %deflake %run %t | FileCheck %s extern "C" void AnnotateRWLockAcquired(const char *f, int l, void *m, long rw); extern "C" void AnnotateRWLockReleased(const char *f, int l, void *m, long rw); diff --git a/compiler-rt/test/tsan/mutex_bad_unlock.cc b/compiler-rt/test/tsan/mutex_bad_unlock.cc index 30190357150..6b483cf17ed 100644 --- a/compiler-rt/test/tsan/mutex_bad_unlock.cc +++ b/compiler-rt/test/tsan/mutex_bad_unlock.cc @@ -1,4 +1,4 @@ -// RUN: %clangxx_tsan -O1 %s -o %t && not %run %t 2>&1 | FileCheck %s +// RUN: %clangxx_tsan -O1 %s -o %t && %deflake %run %t | FileCheck %s extern "C" void AnnotateRWLockReleased(const char *f, int l, void *m, long rw); int main() { diff --git a/compiler-rt/test/tsan/mutex_destroy_locked.cc b/compiler-rt/test/tsan/mutex_destroy_locked.cc index 6c5dcbf11c3..b81905ec68f 100644 --- a/compiler-rt/test/tsan/mutex_destroy_locked.cc +++ b/compiler-rt/test/tsan/mutex_destroy_locked.cc @@ -1,4 +1,4 @@ -// RUN: %clangxx_tsan -O1 %s -o %t && not %run %t 2>&1 | FileCheck %s +// RUN: %clangxx_tsan -O1 %s -o %t && %deflake %run %t | FileCheck %s #include <pthread.h> #include <unistd.h> diff --git a/compiler-rt/test/tsan/mutex_double_lock.cc b/compiler-rt/test/tsan/mutex_double_lock.cc index 551d911e618..c1bebf73706 100644 --- a/compiler-rt/test/tsan/mutex_double_lock.cc +++ b/compiler-rt/test/tsan/mutex_double_lock.cc @@ -1,4 +1,4 @@ -// RUN: %clangxx_tsan -O1 %s -o %t && not %run %t 2>&1 | FileCheck %s +// RUN: %clangxx_tsan -O1 %s -o %t && %deflake %run %t | FileCheck %s #include <pthread.h> #include <unistd.h> diff --git a/compiler-rt/test/tsan/mutex_robust2.cc b/compiler-rt/test/tsan/mutex_robust2.cc index f3125c115d6..0914c176360 100644 --- a/compiler-rt/test/tsan/mutex_robust2.cc +++ b/compiler-rt/test/tsan/mutex_robust2.cc @@ -1,4 +1,4 @@ -// RUN: %clangxx_tsan -O1 %s -o %t && not %run %t 2>&1 | FileCheck %s +// RUN: %clangxx_tsan -O1 %s -o %t && %deflake %run %t | FileCheck %s #include <pthread.h> #include <stdlib.h> #include <stdio.h> diff --git a/compiler-rt/test/tsan/mutexset1.cc b/compiler-rt/test/tsan/mutexset1.cc index 49607d7a293..72964edfb1e 100644 --- a/compiler-rt/test/tsan/mutexset1.cc +++ b/compiler-rt/test/tsan/mutexset1.cc @@ -1,4 +1,4 @@ -// RUN: %clangxx_tsan -O1 %s -o %t && not %run %t 2>&1 | FileCheck %s +// RUN: %clangxx_tsan -O1 %s -o %t && %deflake %run %t | FileCheck %s #include <pthread.h> #include <stdio.h> #include <unistd.h> diff --git a/compiler-rt/test/tsan/mutexset2.cc b/compiler-rt/test/tsan/mutexset2.cc index 80b690df7b1..01a5f5df6e9 100644 --- a/compiler-rt/test/tsan/mutexset2.cc +++ b/compiler-rt/test/tsan/mutexset2.cc @@ -1,4 +1,4 @@ -// RUN: %clangxx_tsan -O1 %s -o %t && not %run %t 2>&1 | FileCheck %s +// RUN: %clangxx_tsan -O1 %s -o %t && %deflake %run %t | FileCheck %s #include <pthread.h> #include <stdio.h> #include <unistd.h> diff --git a/compiler-rt/test/tsan/mutexset3.cc b/compiler-rt/test/tsan/mutexset3.cc index 17c27ea262c..e14bb1111e3 100644 --- a/compiler-rt/test/tsan/mutexset3.cc +++ b/compiler-rt/test/tsan/mutexset3.cc @@ -1,4 +1,4 @@ -// RUN: %clangxx_tsan -O1 %s -o %t && not %run %t 2>&1 | FileCheck %s +// RUN: %clangxx_tsan -O1 %s -o %t && %deflake %run %t | FileCheck %s #include <pthread.h> #include <stdio.h> #include <unistd.h> diff --git a/compiler-rt/test/tsan/mutexset4.cc b/compiler-rt/test/tsan/mutexset4.cc index f56d37a73ee..db860e005d6 100644 --- a/compiler-rt/test/tsan/mutexset4.cc +++ b/compiler-rt/test/tsan/mutexset4.cc @@ -1,4 +1,4 @@ -// RUN: %clangxx_tsan -O1 %s -o %t && not %run %t 2>&1 | FileCheck %s +// RUN: %clangxx_tsan -O1 %s -o %t && %deflake %run %t | FileCheck %s #include <pthread.h> #include <stdio.h> #include <unistd.h> diff --git a/compiler-rt/test/tsan/mutexset5.cc b/compiler-rt/test/tsan/mutexset5.cc index ea1255373c6..e1cc2fcacf6 100644 --- a/compiler-rt/test/tsan/mutexset5.cc +++ b/compiler-rt/test/tsan/mutexset5.cc @@ -1,4 +1,4 @@ -// RUN: %clangxx_tsan -O1 %s -o %t && not %run %t 2>&1 | FileCheck %s +// RUN: %clangxx_tsan -O1 %s -o %t && %deflake %run %t | FileCheck %s #include <pthread.h> #include <stdio.h> #include <unistd.h> diff --git a/compiler-rt/test/tsan/mutexset6.cc b/compiler-rt/test/tsan/mutexset6.cc index a42a743645d..07dcc0a7394 100644 --- a/compiler-rt/test/tsan/mutexset6.cc +++ b/compiler-rt/test/tsan/mutexset6.cc @@ -1,4 +1,4 @@ -// RUN: %clangxx_tsan -O1 %s -o %t && not %run %t 2>&1 | FileCheck %s +// RUN: %clangxx_tsan -O1 %s -o %t && %deflake %run %t | FileCheck %s #include <pthread.h> #include <stdio.h> #include <unistd.h> diff --git a/compiler-rt/test/tsan/mutexset7.cc b/compiler-rt/test/tsan/mutexset7.cc index b80eddb083c..12174844c79 100644 --- a/compiler-rt/test/tsan/mutexset7.cc +++ b/compiler-rt/test/tsan/mutexset7.cc @@ -1,4 +1,4 @@ -// RUN: %clangxx_tsan -O1 %s -o %t && not %run %t 2>&1 | FileCheck %s +// RUN: %clangxx_tsan -O1 %s -o %t && %deflake %run %t | FileCheck %s #include <pthread.h> #include <stdio.h> #include <unistd.h> diff --git a/compiler-rt/test/tsan/mutexset8.cc b/compiler-rt/test/tsan/mutexset8.cc index 23449ab0dfb..3e1ab8c5a74 100644 --- a/compiler-rt/test/tsan/mutexset8.cc +++ b/compiler-rt/test/tsan/mutexset8.cc @@ -1,4 +1,4 @@ -// RUN: %clangxx_tsan -O1 %s -o %t && not %run %t 2>&1 | FileCheck %s +// RUN: %clangxx_tsan -O1 %s -o %t && %deflake %run %t | FileCheck %s #include <pthread.h> #include <stdio.h> #include <unistd.h> diff --git a/compiler-rt/test/tsan/pthread_atfork_deadlock.c b/compiler-rt/test/tsan/pthread_atfork_deadlock.c index 3e91f3ea5bf..965de05b43e 100644 --- a/compiler-rt/test/tsan/pthread_atfork_deadlock.c +++ b/compiler-rt/test/tsan/pthread_atfork_deadlock.c @@ -1,4 +1,4 @@ -// RUN: %clang_tsan -O1 %s -o %t && not %run %t 2>&1 | FileCheck %s +// RUN: %clang_tsan -O1 %s -o %t && %deflake %run %t | FileCheck %s // Regression test for // https://code.google.com/p/thread-sanitizer/issues/detail?id=61 // When the data race was reported, pthread_atfork() handler used to be diff --git a/compiler-rt/test/tsan/race_on_barrier.c b/compiler-rt/test/tsan/race_on_barrier.c index e93995ade14..99b18fe4d8e 100644 --- a/compiler-rt/test/tsan/race_on_barrier.c +++ b/compiler-rt/test/tsan/race_on_barrier.c @@ -1,4 +1,4 @@ -// RUN: %clang_tsan -O1 %s -o %t && not %run %t 2>&1 | FileCheck %s +// RUN: %clang_tsan -O1 %s -o %t && %deflake %run %t | FileCheck %s #include <pthread.h> #include <stdio.h> #include <stddef.h> diff --git a/compiler-rt/test/tsan/race_on_barrier2.c b/compiler-rt/test/tsan/race_on_barrier2.c index 75f9b4a092d..98c028e19fd 100644 --- a/compiler-rt/test/tsan/race_on_barrier2.c +++ b/compiler-rt/test/tsan/race_on_barrier2.c @@ -1,4 +1,4 @@ -// RUN: %clang_tsan -O1 %s -o %t && not %run %t 2>&1 | FileCheck %s +// RUN: %clang_tsan -O1 %s -o %t && %deflake %run %t | FileCheck %s #include <pthread.h> #include <stdio.h> #include <stddef.h> diff --git a/compiler-rt/test/tsan/race_on_heap.cc b/compiler-rt/test/tsan/race_on_heap.cc index 54c4a9b02f9..a66e0c4f93f 100644 --- a/compiler-rt/test/tsan/race_on_heap.cc +++ b/compiler-rt/test/tsan/race_on_heap.cc @@ -1,4 +1,4 @@ -// RUN: %clangxx_tsan -O1 %s -o %t && not %run %t 2>&1 | FileCheck %s +// RUN: %clangxx_tsan -O1 %s -o %t && %deflake %run %t | FileCheck %s #include <pthread.h> #include <stdlib.h> #include <stdio.h> @@ -38,7 +38,7 @@ int main() { // CHECK: WARNING: ThreadSanitizer: data race // ... // CHECK: Location is heap block of size 99 at [[ADDR]] allocated by thread T1: -// CHCEKL #0 malloc +// CHCEK: #0 malloc // CHECK: #{{1|2}} alloc // CHECK: #{{2|3}} AllocThread // ... diff --git a/compiler-rt/test/tsan/race_on_mutex.c b/compiler-rt/test/tsan/race_on_mutex.c index d3e621062e7..b4adeeb4df7 100644 --- a/compiler-rt/test/tsan/race_on_mutex.c +++ b/compiler-rt/test/tsan/race_on_mutex.c @@ -1,4 +1,4 @@ -// RUN: %clang_tsan -O1 %s -o %t && not %run %t 2>&1 | FileCheck %s +// RUN: %clang_tsan -O1 %s -o %t && %deflake %run %t | FileCheck %s #include <pthread.h> #include <stdio.h> #include <stddef.h> diff --git a/compiler-rt/test/tsan/race_on_mutex2.c b/compiler-rt/test/tsan/race_on_mutex2.c index c860fc6d8eb..1796d0c6480 100644 --- a/compiler-rt/test/tsan/race_on_mutex2.c +++ b/compiler-rt/test/tsan/race_on_mutex2.c @@ -1,4 +1,4 @@ -// RUN: %clang_tsan -O1 %s -o %t && not %run %t 2>&1 | FileCheck %s +// RUN: %clang_tsan -O1 %s -o %t && %deflake %run %t | FileCheck %s #include <pthread.h> #include <stdio.h> #include <stddef.h> diff --git a/compiler-rt/test/tsan/race_on_read.cc b/compiler-rt/test/tsan/race_on_read.cc index 4dc976d0042..1ec0522b903 100644 --- a/compiler-rt/test/tsan/race_on_read.cc +++ b/compiler-rt/test/tsan/race_on_read.cc @@ -1,4 +1,4 @@ -// RUN: %clangxx_tsan -O1 %s -o %t && not %run %t 2>&1 | FileCheck %s +// RUN: %clangxx_tsan -O1 %s -o %t && %deflake %run %t | FileCheck %s #include <pthread.h> #include <stdio.h> #include <unistd.h> diff --git a/compiler-rt/test/tsan/race_on_write.cc b/compiler-rt/test/tsan/race_on_write.cc index add22ce600a..484bbb7ae02 100644 --- a/compiler-rt/test/tsan/race_on_write.cc +++ b/compiler-rt/test/tsan/race_on_write.cc @@ -1,4 +1,4 @@ -// RUN: %clangxx_tsan -O1 %s -o %t && not %run %t 2>&1 | FileCheck %s +// RUN: %clangxx_tsan -O1 %s -o %t && %deflake %run %t | FileCheck %s #include <pthread.h> #include <stdio.h> #include <unistd.h> diff --git a/compiler-rt/test/tsan/race_with_finished_thread.cc b/compiler-rt/test/tsan/race_with_finished_thread.cc index b3f9b706651..d28760093c4 100644 --- a/compiler-rt/test/tsan/race_with_finished_thread.cc +++ b/compiler-rt/test/tsan/race_with_finished_thread.cc @@ -1,4 +1,4 @@ -// RUN: %clangxx_tsan -O1 %s -o %t && not %run %t 2>&1 | FileCheck %s +// RUN: %clangxx_tsan -O1 %s -o %t && %deflake %run %t | FileCheck %s #include <pthread.h> #include <stddef.h> #include <stdio.h> diff --git a/compiler-rt/test/tsan/signal_errno.cc b/compiler-rt/test/tsan/signal_errno.cc index 326953ea278..27d4ecd8830 100644 --- a/compiler-rt/test/tsan/signal_errno.cc +++ b/compiler-rt/test/tsan/signal_errno.cc @@ -1,4 +1,4 @@ -// RUN: %clang_tsan -O1 %s -o %t && not %run %t 2>&1 | FileCheck %s +// RUN: %clang_tsan -O1 %s -o %t && %deflake %run %t | FileCheck %s #include <pthread.h> #include <stdio.h> #include <stdlib.h> diff --git a/compiler-rt/test/tsan/signal_malloc.cc b/compiler-rt/test/tsan/signal_malloc.cc index f6fc3facb3d..db5e79b997d 100644 --- a/compiler-rt/test/tsan/signal_malloc.cc +++ b/compiler-rt/test/tsan/signal_malloc.cc @@ -1,4 +1,4 @@ -// RUN: %clang_tsan -O1 %s -o %t && not %run %t 2>&1 | FileCheck %s +// RUN: %clang_tsan -O1 %s -o %t && %deflake %run %t | FileCheck %s #include <stdio.h> #include <stdlib.h> #include <signal.h> diff --git a/compiler-rt/test/tsan/sigsuspend.cc b/compiler-rt/test/tsan/sigsuspend.cc index dc9606637fe..f614c12acb1 100644 --- a/compiler-rt/test/tsan/sigsuspend.cc +++ b/compiler-rt/test/tsan/sigsuspend.cc @@ -1,4 +1,4 @@ -// RUN: %clangxx_tsan -O1 %s -o %t && not %run %t 2>&1 | FileCheck %s +// RUN: %clangxx_tsan -O1 %s -o %t && %deflake %run %t | FileCheck %s // Always enable asserts. #ifdef NDEBUG diff --git a/compiler-rt/test/tsan/simple_race.c b/compiler-rt/test/tsan/simple_race.c index 78f105fa174..7b60c5ec249 100644 --- a/compiler-rt/test/tsan/simple_race.c +++ b/compiler-rt/test/tsan/simple_race.c @@ -1,4 +1,4 @@ -// RUN: %clang_tsan -O1 %s -o %t && not %run %t 2>&1 | FileCheck %s +// RUN: %clang_tsan -O1 %s -o %t && %deflake %run %t | FileCheck %s #include <pthread.h> #include <stdio.h> #include <unistd.h> @@ -26,3 +26,4 @@ int main() { } // CHECK: WARNING: ThreadSanitizer: data race + diff --git a/compiler-rt/test/tsan/simple_race.cc b/compiler-rt/test/tsan/simple_race.cc index 9010ed5f529..0236b9f9b04 100644 --- a/compiler-rt/test/tsan/simple_race.cc +++ b/compiler-rt/test/tsan/simple_race.cc @@ -1,4 +1,4 @@ -// RUN: %clangxx_tsan -O1 %s -o %t && not %run %t 2>&1 | FileCheck %s +// RUN: %clangxx_tsan -O1 %s -o %t && %deflake %run %t 2>&1 | FileCheck %s #include <pthread.h> #include <stdio.h> diff --git a/compiler-rt/test/tsan/simple_stack.c b/compiler-rt/test/tsan/simple_stack.c index f2326eb09bb..899277f4e48 100644 --- a/compiler-rt/test/tsan/simple_stack.c +++ b/compiler-rt/test/tsan/simple_stack.c @@ -1,4 +1,4 @@ -// RUN: %clang_tsan -O1 %s -o %t && not %run %t 2>&1 | FileCheck %s +// RUN: %clang_tsan -O1 %s -o %t && %deflake %run %t | FileCheck %s #include <pthread.h> #include <stdio.h> #include <unistd.h> diff --git a/compiler-rt/test/tsan/simple_stack2.cc b/compiler-rt/test/tsan/simple_stack2.cc index 080387a871e..ba0303c1ef7 100644 --- a/compiler-rt/test/tsan/simple_stack2.cc +++ b/compiler-rt/test/tsan/simple_stack2.cc @@ -1,4 +1,4 @@ -// RUN: %clangxx_tsan -O1 %s -o %t && not %run %t 2>&1 | FileCheck %s +// RUN: %clangxx_tsan -O1 %s -o %t && %deflake %run %t | FileCheck %s #include <pthread.h> #include <stdio.h> #include <unistd.h> diff --git a/compiler-rt/test/tsan/sleep_sync.cc b/compiler-rt/test/tsan/sleep_sync.cc index 5047fdf04c9..c7614e16bf3 100644 --- a/compiler-rt/test/tsan/sleep_sync.cc +++ b/compiler-rt/test/tsan/sleep_sync.cc @@ -1,4 +1,4 @@ -// RUN: %clangxx_tsan -O1 %s -o %t && not %run %t 2>&1 | FileCheck %s +// RUN: %clangxx_tsan -O1 %s -o %t && %deflake %run %t | FileCheck %s #include <pthread.h> #include <unistd.h> diff --git a/compiler-rt/test/tsan/sleep_sync2.cc b/compiler-rt/test/tsan/sleep_sync2.cc index 7739405254c..4e616992ecc 100644 --- a/compiler-rt/test/tsan/sleep_sync2.cc +++ b/compiler-rt/test/tsan/sleep_sync2.cc @@ -1,4 +1,4 @@ -// RUN: %clangxx_tsan -O1 %s -o %t && not %run %t 2>&1 | FileCheck %s +// RUN: %clangxx_tsan -O1 %s -o %t && %deflake %run %t | FileCheck %s #include <pthread.h> #include <unistd.h> diff --git a/compiler-rt/test/tsan/stack_race.cc b/compiler-rt/test/tsan/stack_race.cc index 90da2f8c827..2e02f46a281 100644 --- a/compiler-rt/test/tsan/stack_race.cc +++ b/compiler-rt/test/tsan/stack_race.cc @@ -1,4 +1,4 @@ -// RUN: %clangxx_tsan -O1 %s -o %t && not %run %t 2>&1 | FileCheck %s +// RUN: %clangxx_tsan -O1 %s -o %t && %deflake %run %t | FileCheck %s #include <pthread.h> #include <stddef.h> #include <unistd.h> diff --git a/compiler-rt/test/tsan/stack_race2.cc b/compiler-rt/test/tsan/stack_race2.cc index 83a67f49afa..818db367bab 100644 --- a/compiler-rt/test/tsan/stack_race2.cc +++ b/compiler-rt/test/tsan/stack_race2.cc @@ -1,4 +1,4 @@ -// RUN: %clangxx_tsan -O1 %s -o %t && not %run %t 2>&1 | FileCheck %s +// RUN: %clangxx_tsan -O1 %s -o %t && %deflake %run %t | FileCheck %s #include <pthread.h> #include <stddef.h> #include <unistd.h> diff --git a/compiler-rt/test/tsan/static_init3.cc b/compiler-rt/test/tsan/static_init3.cc index 94934b4a9f1..3b9fe62ae2b 100644 --- a/compiler-rt/test/tsan/static_init3.cc +++ b/compiler-rt/test/tsan/static_init3.cc @@ -1,4 +1,4 @@ -// RUN: %clangxx_tsan -O1 %s -o %t && not %run %t 2>&1 | FileCheck %s +// RUN: %clangxx_tsan -O1 %s -o %t && %deflake %run %t | FileCheck %s #include <pthread.h> #include <stdlib.h> #include <stdio.h> diff --git a/compiler-rt/test/tsan/suppress_same_address.cc b/compiler-rt/test/tsan/suppress_same_address.cc index c1721409a5e..df19da1cc7a 100644 --- a/compiler-rt/test/tsan/suppress_same_address.cc +++ b/compiler-rt/test/tsan/suppress_same_address.cc @@ -1,4 +1,4 @@ -// RUN: %clangxx_tsan -O1 %s -o %t && not %run %t 2>&1 | FileCheck %s +// RUN: %clangxx_tsan -O1 %s -o %t && %deflake %run %t | FileCheck %s #include <pthread.h> #include <unistd.h> diff --git a/compiler-rt/test/tsan/suppress_same_stacks.cc b/compiler-rt/test/tsan/suppress_same_stacks.cc index 23008b4bb56..9305650eaa1 100644 --- a/compiler-rt/test/tsan/suppress_same_stacks.cc +++ b/compiler-rt/test/tsan/suppress_same_stacks.cc @@ -1,4 +1,4 @@ -// RUN: %clangxx_tsan -O1 %s -o %t && not %run %t 2>&1 | FileCheck %s +// RUN: %clangxx_tsan -O1 %s -o %t && %deflake %run %t | FileCheck %s #include <pthread.h> volatile int N; // Prevent loop unrolling. diff --git a/compiler-rt/test/tsan/thread_end_with_ignore.cc b/compiler-rt/test/tsan/thread_end_with_ignore.cc index 438a738e20c..79bb08d64bc 100644 --- a/compiler-rt/test/tsan/thread_end_with_ignore.cc +++ b/compiler-rt/test/tsan/thread_end_with_ignore.cc @@ -1,4 +1,4 @@ -// RUN: %clangxx_tsan -O1 %s -o %t && not %run %t 2>&1 | FileCheck %s +// RUN: %clangxx_tsan -O1 %s -o %t && %deflake %run %t | FileCheck %s #include <pthread.h> #include <stdio.h> diff --git a/compiler-rt/test/tsan/thread_end_with_ignore2.cc b/compiler-rt/test/tsan/thread_end_with_ignore2.cc index ca9b5ca895e..9387ea488d5 100644 --- a/compiler-rt/test/tsan/thread_end_with_ignore2.cc +++ b/compiler-rt/test/tsan/thread_end_with_ignore2.cc @@ -1,4 +1,4 @@ -// RUN: %clangxx_tsan -O1 %s -o %t && not %run %t 2>&1 | FileCheck %s +// RUN: %clangxx_tsan -O1 %s -o %t && %deflake %run %t | FileCheck %s extern "C" void AnnotateIgnoreWritesBegin(const char *f, int l); int main() { diff --git a/compiler-rt/test/tsan/thread_end_with_ignore3.cc b/compiler-rt/test/tsan/thread_end_with_ignore3.cc index f066f9e1dcf..55688b2a543 100644 --- a/compiler-rt/test/tsan/thread_end_with_ignore3.cc +++ b/compiler-rt/test/tsan/thread_end_with_ignore3.cc @@ -1,4 +1,4 @@ -// RUN: %clangxx_tsan -O1 %s -o %t && not %run %t 2>&1 | FileCheck %s +// RUN: %clangxx_tsan -O1 %s -o %t && %deflake %run %t | FileCheck %s extern "C" void AnnotateIgnoreReadsBegin(const char *f, int l); extern "C" void AnnotateIgnoreReadsEnd(const char *f, int l); diff --git a/compiler-rt/test/tsan/thread_leak3.c b/compiler-rt/test/tsan/thread_leak3.c index efc4dd024f9..f4db484219a 100644 --- a/compiler-rt/test/tsan/thread_leak3.c +++ b/compiler-rt/test/tsan/thread_leak3.c @@ -1,4 +1,4 @@ -// RUN: %clang_tsan -O1 %s -o %t && not %run %t 2>&1 | FileCheck %s +// RUN: %clang_tsan -O1 %s -o %t && %deflake %run %t | FileCheck %s #include <pthread.h> #include <unistd.h> diff --git a/compiler-rt/test/tsan/thread_leak5.c b/compiler-rt/test/tsan/thread_leak5.c index 130858cfb26..ca244a9f24e 100644 --- a/compiler-rt/test/tsan/thread_leak5.c +++ b/compiler-rt/test/tsan/thread_leak5.c @@ -1,4 +1,4 @@ -// RUN: %clang_tsan -O1 %s -o %t && not %run %t 2>&1 | FileCheck %s +// RUN: %clang_tsan -O1 %s -o %t && %deflake %run %t | FileCheck %s #include <pthread.h> #include <unistd.h> diff --git a/compiler-rt/test/tsan/thread_name.cc b/compiler-rt/test/tsan/thread_name.cc index af29a2ee4d8..05b0a352a9e 100644 --- a/compiler-rt/test/tsan/thread_name.cc +++ b/compiler-rt/test/tsan/thread_name.cc @@ -1,4 +1,4 @@ -// RUN: %clangxx_tsan -O1 %s -o %t && not %run %t 2>&1 | FileCheck %s +// RUN: %clangxx_tsan -O1 %s -o %t && %deflake %run %t | FileCheck %s #include <pthread.h> #include <stdio.h> #include <unistd.h> diff --git a/compiler-rt/test/tsan/thread_name2.cc b/compiler-rt/test/tsan/thread_name2.cc index 0530c9888f1..b9a574623e0 100644 --- a/compiler-rt/test/tsan/thread_name2.cc +++ b/compiler-rt/test/tsan/thread_name2.cc @@ -1,4 +1,4 @@ -// RUN: %clangxx_tsan -O1 %s -o %t && not %run %t 2>&1 | FileCheck %s +// RUN: %clangxx_tsan -O1 %s -o %t && %deflake %run %t | FileCheck %s #include <pthread.h> #include <stdio.h> #include <unistd.h> diff --git a/compiler-rt/test/tsan/tiny_race.c b/compiler-rt/test/tsan/tiny_race.c index 9d842248090..c10eab15c5a 100644 --- a/compiler-rt/test/tsan/tiny_race.c +++ b/compiler-rt/test/tsan/tiny_race.c @@ -1,4 +1,4 @@ -// RUN: %clang_tsan -O1 %s -o %t && not %run %t 2>&1 | FileCheck %s +// RUN: %clang_tsan -O1 %s -o %t && %deflake %run %t | FileCheck %s #include <pthread.h> #include <unistd.h> diff --git a/compiler-rt/test/tsan/tls_race.cc b/compiler-rt/test/tsan/tls_race.cc index dbfc5531b19..18589347e80 100644 --- a/compiler-rt/test/tsan/tls_race.cc +++ b/compiler-rt/test/tsan/tls_race.cc @@ -1,4 +1,4 @@ -// RUN: %clangxx_tsan -O1 %s -o %t && not %run %t 2>&1 | FileCheck %s +// RUN: %clangxx_tsan -O1 %s -o %t && %deflake %run %t | FileCheck %s #include <pthread.h> #include <stddef.h> #include <unistd.h> diff --git a/compiler-rt/test/tsan/tls_race2.cc b/compiler-rt/test/tsan/tls_race2.cc index ed9f4d0faf3..0ca629ada5c 100644 --- a/compiler-rt/test/tsan/tls_race2.cc +++ b/compiler-rt/test/tsan/tls_race2.cc @@ -1,4 +1,4 @@ -// RUN: %clangxx_tsan -O1 %s -o %t && not %run %t 2>&1 | FileCheck %s +// RUN: %clangxx_tsan -O1 %s -o %t && %deflake %run %t | FileCheck %s #include <pthread.h> #include <stddef.h> #include <unistd.h> diff --git a/compiler-rt/test/tsan/unaligned_race.cc b/compiler-rt/test/tsan/unaligned_race.cc index a2b26751476..6e9b5a33f0d 100644 --- a/compiler-rt/test/tsan/unaligned_race.cc +++ b/compiler-rt/test/tsan/unaligned_race.cc @@ -1,4 +1,4 @@ -// RUN: %clangxx_tsan -O1 %s -o %t && not %run %t 2>&1 | FileCheck %s +// RUN: %clangxx_tsan -O1 %s -o %t && %deflake %run %t | FileCheck %s #include <pthread.h> #include <stdio.h> #include <stdlib.h> diff --git a/compiler-rt/test/tsan/vptr_harmful_race.cc b/compiler-rt/test/tsan/vptr_harmful_race.cc index c7d4b74dff2..68e12e8e7e8 100644 --- a/compiler-rt/test/tsan/vptr_harmful_race.cc +++ b/compiler-rt/test/tsan/vptr_harmful_race.cc @@ -1,4 +1,4 @@ -// RUN: %clangxx_tsan -O1 %s -o %t && not %run %t 2>&1 | FileCheck %s +// RUN: %clangxx_tsan -O1 %s -o %t && %deflake %run %t | FileCheck %s #include <pthread.h> #include <semaphore.h> #include <stdio.h> diff --git a/compiler-rt/test/tsan/vptr_harmful_race2.cc b/compiler-rt/test/tsan/vptr_harmful_race2.cc index b018d5cb995..aa53bbb90fc 100644 --- a/compiler-rt/test/tsan/vptr_harmful_race2.cc +++ b/compiler-rt/test/tsan/vptr_harmful_race2.cc @@ -1,4 +1,4 @@ -// RUN: %clangxx_tsan -O1 %s -o %t && not %run %t 2>&1 | FileCheck %s +// RUN: %clangxx_tsan -O1 %s -o %t && %deflake %run %t | FileCheck %s #include <pthread.h> #include <semaphore.h> #include <stdio.h> diff --git a/compiler-rt/test/tsan/vptr_harmful_race3.cc b/compiler-rt/test/tsan/vptr_harmful_race3.cc index 01c94e2846b..ac6ea94e51e 100644 --- a/compiler-rt/test/tsan/vptr_harmful_race3.cc +++ b/compiler-rt/test/tsan/vptr_harmful_race3.cc @@ -1,4 +1,4 @@ -// RUN: %clangxx_tsan -O1 %s -o %t && not %run %t 2>&1 | FileCheck %s +// RUN: %clangxx_tsan -O1 %s -o %t && %deflake %run %t | FileCheck %s #include <pthread.h> #include <semaphore.h> #include <stdio.h> diff --git a/compiler-rt/test/tsan/write_in_reader_lock.cc b/compiler-rt/test/tsan/write_in_reader_lock.cc index 77373bedcc4..55882139b15 100644 --- a/compiler-rt/test/tsan/write_in_reader_lock.cc +++ b/compiler-rt/test/tsan/write_in_reader_lock.cc @@ -1,4 +1,4 @@ -// RUN: %clangxx_tsan -O1 %s -o %t && not %run %t 2>&1 | FileCheck %s +// RUN: %clangxx_tsan -O1 %s -o %t && %deflake %run %t | FileCheck %s #include <pthread.h> #include <unistd.h> |

