Skip to content

Commit 233f401

Browse files
committed
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
1 parent afdcc96 commit 233f401

File tree

89 files changed

+206
-127
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

89 files changed

+206
-127
lines changed

compiler-rt/test/tsan/atomic_free.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// RUN: %clangxx_tsan -O1 %s -o %t && not %run %t 2>&1 | FileCheck %s
1+
// RUN: %clangxx_tsan -O1 %s -o %t && %deflake %run %t | FileCheck %s
22
#include <pthread.h>
33
#include <unistd.h>
44

compiler-rt/test/tsan/atomic_free2.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// RUN: %clangxx_tsan -O1 %s -o %t && not %run %t 2>&1 | FileCheck %s
1+
// RUN: %clangxx_tsan -O1 %s -o %t && %deflake %run %t | FileCheck %s
22
#include <pthread.h>
33
#include <unistd.h>
44

compiler-rt/test/tsan/atomic_race.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// RUN: %clangxx_tsan -O1 %s -o %t && not %run %t 2>&1 | FileCheck %s
1+
// RUN: %clangxx_tsan -O1 %s -o %t && %deflake %run %t | FileCheck %s
22
#include <pthread.h>
33
#include <unistd.h>
44
#include <stdio.h>

compiler-rt/test/tsan/atomic_stack.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// RUN: %clangxx_tsan -O1 %s -o %t && not %run %t 2>&1 | FileCheck %s
1+
// RUN: %clangxx_tsan -O1 %s -o %t && %deflake %run %t | FileCheck %s
22
#include <pthread.h>
33
#include <unistd.h>
44

compiler-rt/test/tsan/cond_race.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// RUN: %clang_tsan -O1 %s -o %t && not %run %t 2>&1 | FileCheck %s
1+
// RUN: %clang_tsan -O1 %s -o %t && %deflake %run %t | FileCheck %s
22
// CHECK-NOT: unlock of unlocked mutex
33
// CHECK: ThreadSanitizer: data race
44
// CHECK: pthread_cond_signal

compiler-rt/test/tsan/deadlock_detector_stress_test.cc

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
// RUN: %clangxx_tsan %s -o %t -DLockType=PthreadMutex
2-
// RUN: TSAN_OPTIONS=detect_deadlocks=1 not %run %t 2>&1 | FileCheck %s --check-prefix=CHECK --check-prefix=CHECK-NOT-SECOND
3-
// TSAN_OPTIONS="detect_deadlocks=1 second_deadlock_stack=1" not %run %t 2>&1 | FileCheck %s --check-prefix=CHECK --check-prefix=CHECK-SECOND
2+
// RUN: TSAN_OPTIONS=detect_deadlocks=1 %deflake %run %t | FileCheck %s --check-prefix=CHECK --check-prefix=CHECK-NOT-SECOND
3+
// TSAN_OPTIONS="detect_deadlocks=1 second_deadlock_stack=1" %deflake %run %t | FileCheck %s --check-prefix=CHECK --check-prefix=CHECK-SECOND
44
// RUN: %clangxx_tsan %s -o %t -DLockType=PthreadSpinLock
5-
// RUN: TSAN_OPTIONS=detect_deadlocks=1 not %run %t 2>&1 | FileCheck %s
5+
// RUN: TSAN_OPTIONS=detect_deadlocks=1 %deflake %run %t | FileCheck %s
66
// RUN: %clangxx_tsan %s -o %t -DLockType=PthreadRWLock
7-
// RUN: TSAN_OPTIONS=detect_deadlocks=1 not %run %t 2>&1 | FileCheck %s --check-prefix=CHECK --check-prefix=CHECK-RD
7+
// RUN: TSAN_OPTIONS=detect_deadlocks=1 %deflake %run %t | FileCheck %s --check-prefix=CHECK --check-prefix=CHECK-RD
88
// RUN: %clangxx_tsan %s -o %t -DLockType=PthreadRecursiveMutex
9-
// RUN: TSAN_OPTIONS=detect_deadlocks=1 not %run %t 2>&1 | FileCheck %s --check-prefix=CHECK --check-prefix=CHECK-REC
9+
// RUN: TSAN_OPTIONS=detect_deadlocks=1 %deflake %run %t | FileCheck %s --check-prefix=CHECK --check-prefix=CHECK-REC
1010
#include <pthread.h>
1111
#undef NDEBUG
1212
#include <assert.h>

compiler-rt/test/tsan/deep_stack1.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
// RUN: %clangxx_tsan -O1 %s -o %t -DORDER1 && not %run %t 2>&1 | FileCheck %s
2-
// RUN: %clangxx_tsan -O1 %s -o %t -DORDER2 && not %run %t 2>&1 | FileCheck %s
1+
// RUN: %clangxx_tsan -O1 %s -o %t -DORDER1 && %deflake %run %t | FileCheck %s
2+
// RUN: %clangxx_tsan -O1 %s -o %t -DORDER2 && %deflake %run %t | FileCheck %s
33
#include <pthread.h>
44
#include <stdio.h>
55
#include <unistd.h>

compiler-rt/test/tsan/deflake.bash

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
#!/usr/bin/env bash
2+
# This script is used to deflake inherently flaky tsan tests.
3+
# It is invoked from lit tests as:
4+
# %deflake mybinary
5+
# which is then substituted by lit to:
6+
# $(dirname %s)/deflake.bash mybinary
7+
# The script runs the target program up to 10 times,
8+
# until it fails (i.e. produces a race report).
9+
10+
for i in $(seq 1 10); do
11+
OUT=`$@ 2>&1`
12+
if [[ $? != 0 ]]; then
13+
echo "$OUT"
14+
exit 0
15+
fi
16+
done
17+
exit 1

compiler-rt/test/tsan/fd_location.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// RUN: %clangxx_tsan -O1 %s -o %t && not %run %t 2>&1 | FileCheck %s
1+
// RUN: %clangxx_tsan -O1 %s -o %t && %deflake %run %t | FileCheck %s
22
#include <pthread.h>
33
#include <stdio.h>
44
#include <unistd.h>

compiler-rt/test/tsan/fd_pipe_race.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// RUN: %clangxx_tsan -O1 %s -o %t && not %run %t 2>&1 | FileCheck %s
1+
// RUN: %clangxx_tsan -O1 %s -o %t && %deflake %run %t | FileCheck %s
22
#include <pthread.h>
33
#include <stdio.h>
44
#include <unistd.h>

compiler-rt/test/tsan/fd_stdout_race.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// RUN: %clangxx_tsan -O1 %s -o %t && not %run %t 2>&1 | FileCheck %s
1+
// RUN: %clangxx_tsan -O1 %s -o %t && %deflake %run %t | FileCheck %s
22
#include <pthread.h>
33
#include <stdio.h>
44
#include <unistd.h>

compiler-rt/test/tsan/free_race.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// RUN: %clang_tsan -O1 %s -o %t
2-
// RUN: not %run %t 2>&1 | FileCheck %s --check-prefix=CHECK-NOZUPP
2+
// RUN: %deflake %run %t | FileCheck %s --check-prefix=CHECK-NOZUPP
33
// RUN: TSAN_OPTIONS="suppressions=%s.supp print_suppressions=1" %run %t 2>&1 | FileCheck %s --check-prefix=CHECK-SUPP
44

55
#include <pthread.h>

compiler-rt/test/tsan/free_race2.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// RUN: %clang_tsan -O1 %s -o %t && not %run %t 2>&1 | FileCheck %s
1+
// RUN: %clang_tsan -O1 %s -o %t && %deflake %run %t | FileCheck %s
22
#include <stdlib.h>
33

44
void __attribute__((noinline)) foo(int *mem) {

compiler-rt/test/tsan/global_race.cc

Lines changed: 2 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,44 +1,26 @@
1-
// RUN: %clangxx_tsan -O1 %s -o %t && not %run %t 2>&1 | FileCheck %s
1+
// RUN: %clangxx_tsan -O1 %s -o %t && %deflake %run %t | FileCheck %s
22
#include <pthread.h>
33
#include <stdio.h>
44
#include <stddef.h>
55
#include <unistd.h>
66

77
int GlobalData[10];
8-
int x;
9-
namespace XXX {
10-
struct YYY {
11-
static int ZZZ[10];
12-
};
13-
int YYY::ZZZ[10];
14-
}
158

169
void *Thread(void *a) {
1710
sleep(1);
1811
GlobalData[2] = 42;
19-
x = 1;
20-
XXX::YYY::ZZZ[0] = 1;
2112
return 0;
2213
}
2314

2415
int main() {
2516
fprintf(stderr, "addr=%p\n", GlobalData);
26-
fprintf(stderr, "addr2=%p\n", &x);
27-
fprintf(stderr, "addr3=%p\n", XXX::YYY::ZZZ);
2817
pthread_t t;
2918
pthread_create(&t, 0, Thread, 0);
3019
GlobalData[2] = 43;
31-
x = 0;
32-
XXX::YYY::ZZZ[0] = 0;
3320
pthread_join(t, 0);
3421
}
3522

3623
// CHECK: addr=[[ADDR:0x[0-9,a-f]+]]
37-
// CHECK: addr2=[[ADDR2:0x[0-9,a-f]+]]
38-
// CHECK: addr3=[[ADDR3:0x[0-9,a-f]+]]
3924
// CHECK: WARNING: ThreadSanitizer: data race
4025
// CHECK: Location is global 'GlobalData' of size 40 at [[ADDR]] ({{.*}}+0x{{[0-9,a-f]+}})
41-
// CHECK: WARNING: ThreadSanitizer: data race
42-
// CHECK: Location is global 'x' of size 4 at [[ADDR2]] ({{.*}}+0x{{[0-9,a-f]+}})
43-
// CHECK: WARNING: ThreadSanitizer: data race
44-
// CHECK: Location is global 'XXX::YYY::ZZZ' of size 40 at [[ADDR3]] ({{.*}}+0x{{[0-9,a-f]+}})
26+

compiler-rt/test/tsan/global_race2.cc

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
// RUN: %clangxx_tsan -O1 %s -o %t && %deflake %run %t | FileCheck %s
2+
#include <pthread.h>
3+
#include <stdio.h>
4+
#include <stddef.h>
5+
#include <unistd.h>
6+
7+
int x;
8+
9+
void *Thread(void *a) {
10+
sleep(1);
11+
x = 1;
12+
return 0;
13+
}
14+
15+
int main() {
16+
fprintf(stderr, "addr2=%p\n", &x);
17+
pthread_t t;
18+
pthread_create(&t, 0, Thread, 0);
19+
x = 0;
20+
pthread_join(t, 0);
21+
}
22+
23+
// CHECK: addr2=[[ADDR2:0x[0-9,a-f]+]]
24+
// CHECK: WARNING: ThreadSanitizer: data race
25+
// CHECK: Location is global 'x' of size 4 at [[ADDR2]] ({{.*}}+0x{{[0-9,a-f]+}})
26+

compiler-rt/test/tsan/global_race3.cc

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
// RUN: %clangxx_tsan -O1 %s -o %t && %deflake %run %t | FileCheck %s
2+
#include <pthread.h>
3+
#include <stdio.h>
4+
#include <stddef.h>
5+
#include <unistd.h>
6+
7+
namespace XXX {
8+
struct YYY {
9+
static int ZZZ[10];
10+
};
11+
int YYY::ZZZ[10];
12+
}
13+
14+
void *Thread(void *a) {
15+
sleep(1);
16+
XXX::YYY::ZZZ[0] = 1;
17+
return 0;
18+
}
19+
20+
int main() {
21+
fprintf(stderr, "addr3=%p\n", XXX::YYY::ZZZ);
22+
pthread_t t;
23+
pthread_create(&t, 0, Thread, 0);
24+
XXX::YYY::ZZZ[0] = 0;
25+
pthread_join(t, 0);
26+
}
27+
28+
// CHECK: addr3=[[ADDR3:0x[0-9,a-f]+]]
29+
// CHECK: WARNING: ThreadSanitizer: data race
30+
// CHECK: Location is global 'XXX::YYY::ZZZ' of size 40 at [[ADDR3]] ({{.*}}+0x{{[0-9,a-f]+}})

compiler-rt/test/tsan/halt_on_error.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// RUN: %clang_tsan -O1 %s -o %t && TSAN_OPTIONS="$TSAN_OPTIONS halt_on_error=1" not %run %t 2>&1 | FileCheck %s
1+
// RUN: %clang_tsan -O1 %s -o %t && TSAN_OPTIONS="$TSAN_OPTIONS halt_on_error=1" %deflake %run %t | FileCheck %s
22
#include <pthread.h>
33
#include <stdio.h>
44
#include <unistd.h>

compiler-rt/test/tsan/heap_race.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// RUN: %clangxx_tsan -O1 %s -o %t && not %run %t 2>&1 | FileCheck %s
1+
// RUN: %clangxx_tsan -O1 %s -o %t && %deflake %run %t | FileCheck %s
22
#include <pthread.h>
33
#include <stdio.h>
44
#include <stddef.h>

compiler-rt/test/tsan/ignore_lib0.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// RUN: %clangxx_tsan -O1 %s -DLIB -fPIC -fno-sanitize=thread -shared -o %T/libignore_lib0.so
22
// RUN: %clangxx_tsan -O1 %s -L%T -lignore_lib0 -o %t
33
// RUN: echo running w/o suppressions:
4-
// RUN: LD_LIBRARY_PATH=%T${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH} not %run %t 2>&1 | FileCheck %s --check-prefix=CHECK-NOSUPP
4+
// RUN: LD_LIBRARY_PATH=%T${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH} %deflake %run %t | FileCheck %s --check-prefix=CHECK-NOSUPP
55
// RUN: echo running with suppressions:
66
// 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
77

compiler-rt/test/tsan/ignore_lib1.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// RUN: %clangxx_tsan -O1 %s -DLIB -fPIC -fno-sanitize=thread -shared -o %T/libignore_lib1.so
22
// RUN: %clangxx_tsan -O1 %s -o %t
33
// RUN: echo running w/o suppressions:
4-
// RUN: not %run %t 2>&1 | FileCheck %s --check-prefix=CHECK-NOSUPP
4+
// RUN: %deflake %run %t | FileCheck %s --check-prefix=CHECK-NOSUPP
55
// RUN: echo running with suppressions:
66
// RUN: TSAN_OPTIONS="$TSAN_OPTIONS suppressions=%s.supp" %run %t 2>&1 | FileCheck %s --check-prefix=CHECK-WITHSUPP
77

compiler-rt/test/tsan/ignore_lib2.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// RUN: %clangxx_tsan -O1 %s -DLIB -fPIC -fno-sanitize=thread -shared -o %T/libignore_lib2_0.so
22
// RUN: %clangxx_tsan -O1 %s -DLIB -fPIC -fno-sanitize=thread -shared -o %T/libignore_lib2_1.so
33
// RUN: %clangxx_tsan -O1 %s -o %t
4-
// RUN: TSAN_OPTIONS="$TSAN_OPTIONS suppressions=%s.supp" not %run %t 2>&1 | FileCheck %s
4+
// RUN: TSAN_OPTIONS="$TSAN_OPTIONS suppressions=%s.supp" %deflake %run %t | FileCheck %s
55

66
// Tests that called_from_lib suppression matched against 2 libraries
77
// causes program crash (this is not supported).

compiler-rt/test/tsan/ignore_lib3.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// RUN: %clangxx_tsan -O1 %s -DLIB -fPIC -fno-sanitize=thread -shared -o %T/libignore_lib3.so
22
// RUN: %clangxx_tsan -O1 %s -o %t
3-
// RUN: TSAN_OPTIONS="$TSAN_OPTIONS suppressions=%s.supp" not %run %t 2>&1 | FileCheck %s
3+
// RUN: TSAN_OPTIONS="$TSAN_OPTIONS suppressions=%s.supp" %deflake %run %t | FileCheck %s
44

55
// Tests that unloading of a library matched against called_from_lib suppression
66
// causes program crash (this is not supported).

compiler-rt/test/tsan/ignore_sync.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// RUN: %clangxx_tsan -O1 %s -o %t && not %run %t 2>&1 | FileCheck %s
1+
// RUN: %clangxx_tsan -O1 %s -o %t && %deflake %run %t | FileCheck %s
22
#include <pthread.h>
33
#include <stdio.h>
44

Lines changed: 2 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,17 @@
1-
// RUN: %clangxx_tsan -O1 %s -o %t && not %run %t 2>&1 | FileCheck %s
1+
// RUN: %clangxx_tsan -O1 %s -o %t && %deflake %run %t | FileCheck %s
22
#include <pthread.h>
33
#include <stddef.h>
44
#include <stdio.h>
55
#include <string.h>
66
#include <unistd.h>
77

8-
int x[4], y[4], z[4];
8+
int x[4], z[4];
99

1010
void *MemCpyThread(void *a) {
1111
memcpy((int*)a, z, 16);
1212
return NULL;
1313
}
1414

15-
void *MemMoveThread(void *a) {
16-
memmove((int*)a, z, 16);
17-
return NULL;
18-
}
19-
2015
void *MemSetThread(void *a) {
2116
sleep(1);
2217
memset((int*)a, 0, 16);
@@ -30,12 +25,6 @@ int main() {
3025
pthread_create(&t[1], NULL, MemSetThread, x);
3126
pthread_join(t[0], NULL);
3227
pthread_join(t[1], NULL);
33-
// Race on y between memmove and memset
34-
pthread_create(&t[0], NULL, MemMoveThread, y);
35-
pthread_create(&t[1], NULL, MemSetThread, y);
36-
pthread_join(t[0], NULL);
37-
pthread_join(t[1], NULL);
38-
3928
printf("PASS\n");
4029
return 0;
4130
}
@@ -47,9 +36,3 @@ int main() {
4736
// CHECK: #0 memcpy
4837
// CHECK: #1 MemCpyThread
4938

50-
// CHECK: WARNING: ThreadSanitizer: data race
51-
// CHECK: #0 memset
52-
// CHECK: #1 MemSetThread
53-
// CHECK: Previous write
54-
// CHECK: #0 memmove
55-
// CHECK: #1 MemMoveThread
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
// RUN: %clangxx_tsan -O1 %s -o %t && %deflake %run %t | FileCheck %s
2+
#include <pthread.h>
3+
#include <stddef.h>
4+
#include <stdio.h>
5+
#include <string.h>
6+
#include <unistd.h>
7+
8+
int y[4], z[4];
9+
10+
void *MemMoveThread(void *a) {
11+
memmove((int*)a, z, 16);
12+
return NULL;
13+
}
14+
15+
void *MemSetThread(void *a) {
16+
sleep(1);
17+
memset((int*)a, 0, 16);
18+
return NULL;
19+
}
20+
21+
int main() {
22+
pthread_t t[2];
23+
// Race on y between memmove and memset
24+
pthread_create(&t[0], NULL, MemMoveThread, y);
25+
pthread_create(&t[1], NULL, MemSetThread, y);
26+
pthread_join(t[0], NULL);
27+
pthread_join(t[1], NULL);
28+
29+
printf("PASS\n");
30+
return 0;
31+
}
32+
33+
// CHECK: WARNING: ThreadSanitizer: data race
34+
// CHECK: #0 memset
35+
// CHECK: #1 MemSetThread
36+
// CHECK: Previous write
37+
// CHECK: #0 memmove
38+
// CHECK: #1 MemMoveThread

compiler-rt/test/tsan/java_lock_rec_race.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// RUN: %clangxx_tsan -O1 %s -o %t && not %run %t 2>&1 | FileCheck %s
1+
// RUN: %clangxx_tsan -O1 %s -o %t && %deflake %run %t | FileCheck %s
22
#include "java.h"
33
#include <unistd.h>
44

compiler-rt/test/tsan/java_race.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// RUN: %clangxx_tsan -O1 %s -o %t && not %run %t 2>&1 | FileCheck %s
1+
// RUN: %clangxx_tsan -O1 %s -o %t && %deflake %run %t | FileCheck %s
22
#include "java.h"
33

44
void *Thread(void *p) {

compiler-rt/test/tsan/java_race_move.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// RUN: %clangxx_tsan -O1 %s -o %t && not %run %t 2>&1 | FileCheck %s
1+
// RUN: %clangxx_tsan -O1 %s -o %t && %deflake %run %t | FileCheck %s
22
#include "java.h"
33

44
jptr varaddr;

compiler-rt/test/tsan/lit.cfg

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,8 @@ config.substitutions.append( ("%clangxx_tsan ", build_invocation(clang_tsan_cxxf
5757
# Define CHECK-%os to check for OS-dependent output.
5858
config.substitutions.append( ('CHECK-%os', ("CHECK-" + config.host_os)))
5959

60+
config.substitutions.append( ("%deflake ", os.path.join(os.path.dirname(__file__), "deflake.bash")) )
61+
6062
# Default test suffixes.
6163
config.suffixes = ['.c', '.cc', '.cpp']
6264

compiler-rt/test/tsan/load_shared_lib.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
// RUN: %clangxx_tsan -O1 %p/SharedLibs/load_shared_lib-so.cc \
66
// RUN: -fPIC -shared -o %t-so.so
7-
// RUN: %clangxx_tsan -O1 %s -o %t && not %run %t 2>&1 | FileCheck %s
7+
// RUN: %clangxx_tsan -O1 %s -o %t && %deflake %run %t | FileCheck %s
88

99
#include <dlfcn.h>
1010
#include <pthread.h>

compiler-rt/test/tsan/longjmp3.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// RUN: %clang_tsan -O1 %s -o %t && not %run %t 2>&1 | FileCheck %s
1+
// RUN: %clang_tsan -O1 %s -o %t && %deflake %run %t | FileCheck %s
22
#include <pthread.h>
33
#include <stdio.h>
44
#include <stdlib.h>

compiler-rt/test/tsan/longjmp4.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// RUN: %clang_tsan -O1 %s -o %t && not %run %t 2>&1 | FileCheck %s
1+
// RUN: %clang_tsan -O1 %s -o %t && %deflake %run %t | FileCheck %s
22
#include <pthread.h>
33
#include <stdio.h>
44
#include <stdlib.h>

0 commit comments

Comments
 (0)