[llvm-commits] [compiler-rt] r171185 - in /compiler-rt/trunk/lib/tsan/lit_tests: Helpers/ Helpers/blacklist.txt Helpers/lit.local.cfg blacklist.cc
Alexey Samsonov
samsonov at google.com
Fri Dec 28 01:32:36 PST 2012
Author: samsonov
Date: Fri Dec 28 03:32:36 2012
New Revision: 171185
URL: http://llvm.org/viewvc/llvm-project?rev=171185&view=rev
Log:
[TSan] Add lit test for -fsanitize-blacklist= flag
Added:
compiler-rt/trunk/lib/tsan/lit_tests/Helpers/
compiler-rt/trunk/lib/tsan/lit_tests/Helpers/blacklist.txt
compiler-rt/trunk/lib/tsan/lit_tests/Helpers/lit.local.cfg
compiler-rt/trunk/lib/tsan/lit_tests/blacklist.cc
Added: compiler-rt/trunk/lib/tsan/lit_tests/Helpers/blacklist.txt
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/tsan/lit_tests/Helpers/blacklist.txt?rev=171185&view=auto
==============================================================================
--- compiler-rt/trunk/lib/tsan/lit_tests/Helpers/blacklist.txt (added)
+++ compiler-rt/trunk/lib/tsan/lit_tests/Helpers/blacklist.txt Fri Dec 28 03:32:36 2012
@@ -0,0 +1 @@
+fun:*Thread2*
Added: compiler-rt/trunk/lib/tsan/lit_tests/Helpers/lit.local.cfg
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/tsan/lit_tests/Helpers/lit.local.cfg?rev=171185&view=auto
==============================================================================
--- compiler-rt/trunk/lib/tsan/lit_tests/Helpers/lit.local.cfg (added)
+++ compiler-rt/trunk/lib/tsan/lit_tests/Helpers/lit.local.cfg Fri Dec 28 03:32:36 2012
@@ -0,0 +1,2 @@
+# Files in this directory are helper files for other output tests.
+config.suffixes = []
Added: compiler-rt/trunk/lib/tsan/lit_tests/blacklist.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/tsan/lit_tests/blacklist.cc?rev=171185&view=auto
==============================================================================
--- compiler-rt/trunk/lib/tsan/lit_tests/blacklist.cc (added)
+++ compiler-rt/trunk/lib/tsan/lit_tests/blacklist.cc Fri Dec 28 03:32:36 2012
@@ -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
More information about the llvm-commits
mailing list