forked from OSchip/llvm-project
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
This commit is contained in:
parent
afdcc96d9f
commit
233f401c2b
|
|
@ -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 <pthread.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -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 <pthread.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -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 <pthread.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
|
||||||
|
|
@ -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 <pthread.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -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-NOT: unlock of unlocked mutex
|
||||||
// CHECK: ThreadSanitizer: data race
|
// CHECK: ThreadSanitizer: data race
|
||||||
// CHECK: pthread_cond_signal
|
// CHECK: pthread_cond_signal
|
||||||
|
|
|
||||||
|
|
@ -1,12 +1,12 @@
|
||||||
// RUN: %clangxx_tsan %s -o %t -DLockType=PthreadMutex
|
// 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
|
// 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" not %run %t 2>&1 | FileCheck %s --check-prefix=CHECK --check-prefix=CHECK-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: %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: %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: %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>
|
#include <pthread.h>
|
||||||
#undef NDEBUG
|
#undef NDEBUG
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
|
|
|
||||||
|
|
@ -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 -DORDER1 && %deflake %run %t | FileCheck %s
|
||||||
// RUN: %clangxx_tsan -O1 %s -o %t -DORDER2 && not %run %t 2>&1 | FileCheck %s
|
// RUN: %clangxx_tsan -O1 %s -o %t -DORDER2 && %deflake %run %t | FileCheck %s
|
||||||
#include <pthread.h>
|
#include <pthread.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
|
||||||
|
|
@ -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
|
||||||
|
|
@ -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 <pthread.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
|
||||||
|
|
@ -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 <pthread.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
|
||||||
|
|
@ -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 <pthread.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
// RUN: %clang_tsan -O1 %s -o %t
|
// 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
|
// RUN: TSAN_OPTIONS="suppressions=%s.supp print_suppressions=1" %run %t 2>&1 | FileCheck %s --check-prefix=CHECK-SUPP
|
||||||
|
|
||||||
#include <pthread.h>
|
#include <pthread.h>
|
||||||
|
|
|
||||||
|
|
@ -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>
|
#include <stdlib.h>
|
||||||
|
|
||||||
void __attribute__((noinline)) foo(int *mem) {
|
void __attribute__((noinline)) foo(int *mem) {
|
||||||
|
|
|
||||||
|
|
@ -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 <pthread.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
int GlobalData[10];
|
int GlobalData[10];
|
||||||
int x;
|
|
||||||
namespace XXX {
|
|
||||||
struct YYY {
|
|
||||||
static int ZZZ[10];
|
|
||||||
};
|
|
||||||
int YYY::ZZZ[10];
|
|
||||||
}
|
|
||||||
|
|
||||||
void *Thread(void *a) {
|
void *Thread(void *a) {
|
||||||
sleep(1);
|
sleep(1);
|
||||||
GlobalData[2] = 42;
|
GlobalData[2] = 42;
|
||||||
x = 1;
|
|
||||||
XXX::YYY::ZZZ[0] = 1;
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int main() {
|
int main() {
|
||||||
fprintf(stderr, "addr=%p\n", GlobalData);
|
fprintf(stderr, "addr=%p\n", GlobalData);
|
||||||
fprintf(stderr, "addr2=%p\n", &x);
|
|
||||||
fprintf(stderr, "addr3=%p\n", XXX::YYY::ZZZ);
|
|
||||||
pthread_t t;
|
pthread_t t;
|
||||||
pthread_create(&t, 0, Thread, 0);
|
pthread_create(&t, 0, Thread, 0);
|
||||||
GlobalData[2] = 43;
|
GlobalData[2] = 43;
|
||||||
x = 0;
|
|
||||||
XXX::YYY::ZZZ[0] = 0;
|
|
||||||
pthread_join(t, 0);
|
pthread_join(t, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
// CHECK: addr=[[ADDR:0x[0-9,a-f]+]]
|
// 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: WARNING: ThreadSanitizer: data race
|
||||||
// CHECK: Location is global 'GlobalData' of size 40 at [[ADDR]] ({{.*}}+0x{{[0-9,a-f]+}})
|
// 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]+}})
|
|
||||||
|
|
|
||||||
|
|
@ -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]+}})
|
||||||
|
|
||||||
|
|
@ -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]+}})
|
||||||
|
|
@ -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 <pthread.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
|
||||||
|
|
@ -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 <pthread.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
|
|
|
||||||
|
|
@ -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 -DLIB -fPIC -fno-sanitize=thread -shared -o %T/libignore_lib0.so
|
||||||
// RUN: %clangxx_tsan -O1 %s -L%T -lignore_lib0 -o %t
|
// RUN: %clangxx_tsan -O1 %s -L%T -lignore_lib0 -o %t
|
||||||
// RUN: echo running w/o suppressions:
|
// 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: 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
|
// 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
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -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 -DLIB -fPIC -fno-sanitize=thread -shared -o %T/libignore_lib1.so
|
||||||
// RUN: %clangxx_tsan -O1 %s -o %t
|
// RUN: %clangxx_tsan -O1 %s -o %t
|
||||||
// RUN: echo running w/o suppressions:
|
// 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: echo running with suppressions:
|
||||||
// RUN: TSAN_OPTIONS="$TSAN_OPTIONS suppressions=%s.supp" %run %t 2>&1 | FileCheck %s --check-prefix=CHECK-WITHSUPP
|
// RUN: TSAN_OPTIONS="$TSAN_OPTIONS suppressions=%s.supp" %run %t 2>&1 | FileCheck %s --check-prefix=CHECK-WITHSUPP
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -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_0.so
|
||||||
// RUN: %clangxx_tsan -O1 %s -DLIB -fPIC -fno-sanitize=thread -shared -o %T/libignore_lib2_1.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: %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
|
// Tests that called_from_lib suppression matched against 2 libraries
|
||||||
// causes program crash (this is not supported).
|
// causes program crash (this is not supported).
|
||||||
|
|
|
||||||
|
|
@ -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 -DLIB -fPIC -fno-sanitize=thread -shared -o %T/libignore_lib3.so
|
||||||
// RUN: %clangxx_tsan -O1 %s -o %t
|
// 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
|
// Tests that unloading of a library matched against called_from_lib suppression
|
||||||
// causes program crash (this is not supported).
|
// causes program crash (this is not supported).
|
||||||
|
|
|
||||||
|
|
@ -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 <pthread.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -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 <pthread.h>
|
||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
int x[4], y[4], z[4];
|
int x[4], z[4];
|
||||||
|
|
||||||
void *MemCpyThread(void *a) {
|
void *MemCpyThread(void *a) {
|
||||||
memcpy((int*)a, z, 16);
|
memcpy((int*)a, z, 16);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
void *MemMoveThread(void *a) {
|
|
||||||
memmove((int*)a, z, 16);
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
void *MemSetThread(void *a) {
|
void *MemSetThread(void *a) {
|
||||||
sleep(1);
|
sleep(1);
|
||||||
memset((int*)a, 0, 16);
|
memset((int*)a, 0, 16);
|
||||||
|
|
@ -30,12 +25,6 @@ int main() {
|
||||||
pthread_create(&t[1], NULL, MemSetThread, x);
|
pthread_create(&t[1], NULL, MemSetThread, x);
|
||||||
pthread_join(t[0], NULL);
|
pthread_join(t[0], NULL);
|
||||||
pthread_join(t[1], 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");
|
printf("PASS\n");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
@ -47,9 +36,3 @@ int main() {
|
||||||
// CHECK: #0 memcpy
|
// CHECK: #0 memcpy
|
||||||
// CHECK: #1 MemCpyThread
|
// CHECK: #1 MemCpyThread
|
||||||
|
|
||||||
// CHECK: WARNING: ThreadSanitizer: data race
|
|
||||||
// CHECK: #0 memset
|
|
||||||
// CHECK: #1 MemSetThread
|
|
||||||
// CHECK: Previous write
|
|
||||||
// CHECK: #0 memmove
|
|
||||||
// CHECK: #1 MemMoveThread
|
|
||||||
|
|
|
||||||
|
|
@ -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
|
||||||
|
|
@ -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 "java.h"
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -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 "java.h"
|
||||||
|
|
||||||
void *Thread(void *p) {
|
void *Thread(void *p) {
|
||||||
|
|
|
||||||
|
|
@ -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 "java.h"
|
||||||
|
|
||||||
jptr varaddr;
|
jptr varaddr;
|
||||||
|
|
|
||||||
|
|
@ -57,6 +57,8 @@ config.substitutions.append( ("%clangxx_tsan ", build_invocation(clang_tsan_cxxf
|
||||||
# Define CHECK-%os to check for OS-dependent output.
|
# Define CHECK-%os to check for OS-dependent output.
|
||||||
config.substitutions.append( ('CHECK-%os', ("CHECK-" + config.host_os)))
|
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.
|
# Default test suffixes.
|
||||||
config.suffixes = ['.c', '.cc', '.cpp']
|
config.suffixes = ['.c', '.cc', '.cpp']
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@
|
||||||
|
|
||||||
// RUN: %clangxx_tsan -O1 %p/SharedLibs/load_shared_lib-so.cc \
|
// RUN: %clangxx_tsan -O1 %p/SharedLibs/load_shared_lib-so.cc \
|
||||||
// RUN: -fPIC -shared -o %t-so.so
|
// 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 <dlfcn.h>
|
||||||
#include <pthread.h>
|
#include <pthread.h>
|
||||||
|
|
|
||||||
|
|
@ -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 <pthread.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
|
||||||
|
|
@ -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 <pthread.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
|
||||||
|
|
@ -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 <pthread.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
|
||||||
|
|
@ -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 <pthread.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -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 <pthread.h>
|
||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
|
||||||
|
|
@ -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 <pthread.h>
|
||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
|
||||||
|
|
@ -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 <pthread.h>
|
||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
|
||||||
|
|
@ -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 AnnotateRWLockAcquired(const char *f, int l, void *m, long rw);
|
||||||
|
|
||||||
int main() {
|
int main() {
|
||||||
|
|
|
||||||
|
|
@ -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 AnnotateRWLockAcquired(const char *f, int l, void *m, long rw);
|
||||||
extern "C" void AnnotateRWLockReleased(const char *f, int l, void *m, long rw);
|
extern "C" void AnnotateRWLockReleased(const char *f, int l, void *m, long rw);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -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);
|
extern "C" void AnnotateRWLockReleased(const char *f, int l, void *m, long rw);
|
||||||
|
|
||||||
int main() {
|
int main() {
|
||||||
|
|
|
||||||
|
|
@ -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 <pthread.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -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 <pthread.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -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 <pthread.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
|
||||||
|
|
@ -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 <pthread.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
|
||||||
|
|
@ -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 <pthread.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
|
||||||
|
|
@ -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 <pthread.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
|
||||||
|
|
@ -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 <pthread.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
|
||||||
|
|
@ -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 <pthread.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
|
||||||
|
|
@ -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 <pthread.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
|
||||||
|
|
@ -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 <pthread.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
|
||||||
|
|
@ -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 <pthread.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
|
||||||
|
|
@ -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
|
// Regression test for
|
||||||
// https://code.google.com/p/thread-sanitizer/issues/detail?id=61
|
// https://code.google.com/p/thread-sanitizer/issues/detail?id=61
|
||||||
// When the data race was reported, pthread_atfork() handler used to be
|
// When the data race was reported, pthread_atfork() handler used to be
|
||||||
|
|
|
||||||
|
|
@ -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 <pthread.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
|
|
|
||||||
|
|
@ -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 <pthread.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
|
|
|
||||||
|
|
@ -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 <pthread.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
@ -38,7 +38,7 @@ int main() {
|
||||||
// CHECK: WARNING: ThreadSanitizer: data race
|
// CHECK: WARNING: ThreadSanitizer: data race
|
||||||
// ...
|
// ...
|
||||||
// CHECK: Location is heap block of size 99 at [[ADDR]] allocated by thread T1:
|
// 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: #{{1|2}} alloc
|
||||||
// CHECK: #{{2|3}} AllocThread
|
// CHECK: #{{2|3}} AllocThread
|
||||||
// ...
|
// ...
|
||||||
|
|
|
||||||
|
|
@ -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 <pthread.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
|
|
|
||||||
|
|
@ -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 <pthread.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
|
|
|
||||||
|
|
@ -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 <pthread.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
|
||||||
|
|
@ -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 <pthread.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
|
||||||
|
|
@ -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 <pthread.h>
|
||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
|
||||||
|
|
@ -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 <pthread.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
|
||||||
|
|
@ -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 <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
|
|
|
||||||
|
|
@ -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.
|
// Always enable asserts.
|
||||||
#ifdef NDEBUG
|
#ifdef NDEBUG
|
||||||
|
|
|
||||||
|
|
@ -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 <pthread.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
@ -26,3 +26,4 @@ int main() {
|
||||||
}
|
}
|
||||||
|
|
||||||
// CHECK: WARNING: ThreadSanitizer: data race
|
// CHECK: WARNING: ThreadSanitizer: data race
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -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 <pthread.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -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 <pthread.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
|
||||||
|
|
@ -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 <pthread.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
|
||||||
|
|
@ -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 <pthread.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -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 <pthread.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -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 <pthread.h>
|
||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
|
||||||
|
|
@ -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 <pthread.h>
|
||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
|
||||||
|
|
@ -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 <pthread.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
|
||||||
|
|
@ -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 <pthread.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -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 <pthread.h>
|
||||||
|
|
||||||
volatile int N; // Prevent loop unrolling.
|
volatile int N; // Prevent loop unrolling.
|
||||||
|
|
|
||||||
|
|
@ -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 <pthread.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -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);
|
extern "C" void AnnotateIgnoreWritesBegin(const char *f, int l);
|
||||||
|
|
||||||
int main() {
|
int main() {
|
||||||
|
|
|
||||||
|
|
@ -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 AnnotateIgnoreReadsBegin(const char *f, int l);
|
||||||
extern "C" void AnnotateIgnoreReadsEnd(const char *f, int l);
|
extern "C" void AnnotateIgnoreReadsEnd(const char *f, int l);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -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 <pthread.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -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 <pthread.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -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 <pthread.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
|
||||||
|
|
@ -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 <pthread.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
|
||||||
|
|
@ -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 <pthread.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -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 <pthread.h>
|
||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
|
||||||
|
|
@ -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 <pthread.h>
|
||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
|
||||||
|
|
@ -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 <pthread.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
|
||||||
|
|
@ -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 <pthread.h>
|
||||||
#include <semaphore.h>
|
#include <semaphore.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
|
||||||
|
|
@ -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 <pthread.h>
|
||||||
#include <semaphore.h>
|
#include <semaphore.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
|
||||||
|
|
@ -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 <pthread.h>
|
||||||
#include <semaphore.h>
|
#include <semaphore.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
|
||||||
|
|
@ -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 <pthread.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue