diff options
author | Alexey Samsonov <samsonov@google.com> | 2012-12-28 09:32:36 +0000 |
---|---|---|
committer | Alexey Samsonov <samsonov@google.com> | 2012-12-28 09:32:36 +0000 |
commit | 8c01e76d27d57af7913a9c9a9b925b1264fab98f (patch) | |
tree | 60b2c7817bafc7a5f6952ca57616f121689be1a1 | |
parent | c6515b6a41244c5af0f57528a9527e636bacccb1 (diff) | |
download | bcm5719-llvm-8c01e76d27d57af7913a9c9a9b925b1264fab98f.tar.gz bcm5719-llvm-8c01e76d27d57af7913a9c9a9b925b1264fab98f.zip |
[TSan] Add lit test for -fsanitize-blacklist= flag
llvm-svn: 171185
-rw-r--r-- | compiler-rt/lib/tsan/lit_tests/Helpers/blacklist.txt | 1 | ||||
-rw-r--r-- | compiler-rt/lib/tsan/lit_tests/Helpers/lit.local.cfg | 2 | ||||
-rw-r--r-- | compiler-rt/lib/tsan/lit_tests/blacklist.cc | 31 |
3 files changed, 34 insertions, 0 deletions
diff --git a/compiler-rt/lib/tsan/lit_tests/Helpers/blacklist.txt b/compiler-rt/lib/tsan/lit_tests/Helpers/blacklist.txt new file mode 100644 index 00000000000..8000206078b --- /dev/null +++ b/compiler-rt/lib/tsan/lit_tests/Helpers/blacklist.txt @@ -0,0 +1 @@ +fun:*Thread2* diff --git a/compiler-rt/lib/tsan/lit_tests/Helpers/lit.local.cfg b/compiler-rt/lib/tsan/lit_tests/Helpers/lit.local.cfg new file mode 100644 index 00000000000..9246b10352a --- /dev/null +++ b/compiler-rt/lib/tsan/lit_tests/Helpers/lit.local.cfg @@ -0,0 +1,2 @@ +# Files in this directory are helper files for other output tests. +config.suffixes = [] diff --git a/compiler-rt/lib/tsan/lit_tests/blacklist.cc b/compiler-rt/lib/tsan/lit_tests/blacklist.cc new file mode 100644 index 00000000000..855c4ff1aea --- /dev/null +++ b/compiler-rt/lib/tsan/lit_tests/blacklist.cc @@ -0,0 +1,31 @@ +// Test blacklist functionality for TSan. + +// RUN: %clangxx_tsan -O1 %s \ +// RUN: -fsanitize-blacklist=%p/Helpers/blacklist.txt \ +// RUN: -o %t && %t 2>&1 | FileCheck %s +#include <pthread.h> +#include <stdio.h> + +int Global; + +void *Thread1(void *x) { + Global++; + return NULL; +} + +void *Thread2(void *x) { + Global--; + return NULL; +} + +int main() { + pthread_t t[2]; + pthread_create(&t[0], NULL, Thread1, NULL); + pthread_create(&t[1], NULL, Thread2, NULL); + pthread_join(t[0], NULL); + pthread_join(t[1], NULL); + printf("PASS\n"); + return 0; +} + +// CHECK-NOT: ThreadSanitizer: data race |