[TSan] Make lit-tests more self-contained
authorAlexey Samsonov <vonosmas@gmail.com>
Fri, 6 Jun 2014 21:04:55 +0000 (21:04 +0000)
committerAlexey Samsonov <vonosmas@gmail.com>
Fri, 6 Jun 2014 21:04:55 +0000 (21:04 +0000)
llvm-svn: 210370

compiler-rt/test/tsan/Helpers/blacklist.txt [deleted file]
compiler-rt/test/tsan/Helpers/lit.local.cfg [deleted file]
compiler-rt/test/tsan/SharedLibs/lit.local.cfg [deleted file]
compiler-rt/test/tsan/SharedLibs/load_shared_lib-so.cc [deleted file]
compiler-rt/test/tsan/blacklist.cc
compiler-rt/test/tsan/blacklist2.cc
compiler-rt/test/tsan/load_shared_lib.cc
compiler-rt/test/tsan/mutex_cycle2.c

diff --git a/compiler-rt/test/tsan/Helpers/blacklist.txt b/compiler-rt/test/tsan/Helpers/blacklist.txt
deleted file mode 100644 (file)
index 999d07d..0000000
+++ /dev/null
@@ -1,2 +0,0 @@
-fun:*Blacklisted_Thread2*
-fun:*CallTouchGlobal*
diff --git a/compiler-rt/test/tsan/Helpers/lit.local.cfg b/compiler-rt/test/tsan/Helpers/lit.local.cfg
deleted file mode 100644 (file)
index 9246b10..0000000
+++ /dev/null
@@ -1,2 +0,0 @@
-# Files in this directory are helper files for other output tests.
-config.suffixes = []
diff --git a/compiler-rt/test/tsan/SharedLibs/lit.local.cfg b/compiler-rt/test/tsan/SharedLibs/lit.local.cfg
deleted file mode 100644 (file)
index b3677c1..0000000
+++ /dev/null
@@ -1,4 +0,0 @@
-# Sources in this directory are compiled as shared libraries and used by
-# tests in parent directory.
-
-config.suffixes = []
diff --git a/compiler-rt/test/tsan/SharedLibs/load_shared_lib-so.cc b/compiler-rt/test/tsan/SharedLibs/load_shared_lib-so.cc
deleted file mode 100644 (file)
index f449fe9..0000000
+++ /dev/null
@@ -1,25 +0,0 @@
-//===----------- load_shared_lib-so.cc --------------------------*- C++ -*-===//
-//
-//                     The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-//
-// This file is a part of ThreadSanitizer (TSan), a race detector.
-//
-//===----------------------------------------------------------------------===//
-
-#include <stddef.h>
-#include <unistd.h>
-
-int GLOB_SHARED = 0;
-
-extern "C"
-void *write_from_so(void *unused) {
-  if (unused)
-    sleep(1);
-  GLOB_SHARED++;
-  return NULL;
-}
index ab6f1d1..d6ca383 100644 (file)
@@ -1,8 +1,7 @@
 // Test blacklist functionality for TSan.
 
-// RUN: %clangxx_tsan -O1 %s \
-// RUN:   -fsanitize-blacklist=%p/Helpers/blacklist.txt \
-// RUN:   -o %t && %run %t 2>&1 | FileCheck %s
+// RUN: echo "fun:*Blacklisted_Thread2*" > %t.blacklist
+// RUN: %clangxx_tsan -O1 %s -fsanitize-blacklist=%t.blacklist -o %t && %run %t 2>&1 | FileCheck %s
 #include <pthread.h>
 #include <stdio.h>
 
index b39eef8..1258208 100644 (file)
@@ -1,6 +1,9 @@
 // Test that blacklisted functions are still contained in the stack trace.
 
-// RUN: %clangxx_tsan -O1 %s -fsanitize-blacklist=%p/Helpers/blacklist.txt -o %t
+// RUN: echo "fun:*Blacklisted_Thread2*" > %t.blacklist
+// RUN: echo "fun:*CallTouchGlobal*" >> %t.blacklist
+
+// RUN: %clangxx_tsan -O1 %s -fsanitize-blacklist=%t.blacklist -o %t
 // RUN: %deflake %run %t 2>&1 | FileCheck %s
 #include <pthread.h>
 #include <stdio.h>
index 2747b29..a27dc1c 100644 (file)
@@ -2,10 +2,26 @@
 // reports, the second report occurring in a new shared library is still
 // symbolized correctly.
 
-// RUN: %clangxx_tsan -O1 %p/SharedLibs/load_shared_lib-so.cc \
-// RUN:     -fPIC -shared -o %t-so.so
+// RUN: %clangxx_tsan -O1 %s -DBUILD_SO -fPIC -shared -o %t-so.so
 // RUN: %clangxx_tsan -O1 %s -o %t && %deflake %run %t | FileCheck %s
 
+#ifdef BUILD_SO
+
+#include <stddef.h>
+#include <unistd.h>
+
+int GLOB_SHARED = 0;
+
+extern "C"
+void *write_from_so(void *unused) {
+  if (unused)
+    sleep(1);
+  GLOB_SHARED++;
+  return NULL;
+}
+
+#else  // BUILD_SO
+
 #include <dlfcn.h>
 #include <pthread.h>
 #include <stdio.h>
@@ -46,3 +62,5 @@ int main(int argc, char *argv[]) {
   // CHECK: write_from_so
   return 0;
 }
+
+#endif  // BUILD_SO
index fb2b533..cd9a467 100644 (file)
@@ -1,9 +1,9 @@
 // RUN: %clangxx_tsan %s -o %t
 // RUN: TSAN_OPTIONS=detect_deadlocks=1 not %run %t 2>&1 | FileCheck %s
-// RUN: echo "deadlock:main" > sup
-// RUN: TSAN_OPTIONS="detect_deadlocks=1 suppressions=sup" %run %t
-// RUN: echo "deadlock:zzzz" > sup
-// RUN: TSAN_OPTIONS="detect_deadlocks=1 suppressions=sup" not %run %t 2>&1 | FileCheck %s
+// RUN: echo "deadlock:main" > %t.sup
+// RUN: TSAN_OPTIONS="detect_deadlocks=1 suppressions=%t.sup" %run %t
+// RUN: echo "deadlock:zzzz" > %t.sup
+// RUN: TSAN_OPTIONS="detect_deadlocks=1 suppressions=%t.sup" not %run %t 2>&1 | FileCheck %s
 #include <pthread.h>
 
 int main() {