summaryrefslogtreecommitdiffstats
path: root/compiler-rt/test
diff options
context:
space:
mode:
authorAlexey Samsonov <vonosmas@gmail.com>2014-06-06 21:04:55 +0000
committerAlexey Samsonov <vonosmas@gmail.com>2014-06-06 21:04:55 +0000
commit2c8dda4e53a305566bfd92967166ffe68d53851b (patch)
treee0a228a20d801f14b5cbd814647996d3e726cf02 /compiler-rt/test
parent06a4042c8d64d21a3cc0642067ced3e0ad62129f (diff)
downloadbcm5719-llvm-2c8dda4e53a305566bfd92967166ffe68d53851b.tar.gz
bcm5719-llvm-2c8dda4e53a305566bfd92967166ffe68d53851b.zip
[TSan] Make lit-tests more self-contained
llvm-svn: 210370
Diffstat (limited to 'compiler-rt/test')
-rw-r--r--compiler-rt/test/tsan/Helpers/blacklist.txt2
-rw-r--r--compiler-rt/test/tsan/Helpers/lit.local.cfg2
-rw-r--r--compiler-rt/test/tsan/SharedLibs/lit.local.cfg4
-rw-r--r--compiler-rt/test/tsan/SharedLibs/load_shared_lib-so.cc25
-rw-r--r--compiler-rt/test/tsan/blacklist.cc5
-rw-r--r--compiler-rt/test/tsan/blacklist2.cc5
-rw-r--r--compiler-rt/test/tsan/load_shared_lib.cc22
-rw-r--r--compiler-rt/test/tsan/mutex_cycle2.c8
8 files changed, 30 insertions, 43 deletions
diff --git a/compiler-rt/test/tsan/Helpers/blacklist.txt b/compiler-rt/test/tsan/Helpers/blacklist.txt
deleted file mode 100644
index 999d07dc9ec..00000000000
--- a/compiler-rt/test/tsan/Helpers/blacklist.txt
+++ /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
index 9246b10352a..00000000000
--- a/compiler-rt/test/tsan/Helpers/lit.local.cfg
+++ /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
index b3677c17a0f..00000000000
--- a/compiler-rt/test/tsan/SharedLibs/lit.local.cfg
+++ /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
index f449fe97a15..00000000000
--- a/compiler-rt/test/tsan/SharedLibs/load_shared_lib-so.cc
+++ /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;
-}
diff --git a/compiler-rt/test/tsan/blacklist.cc b/compiler-rt/test/tsan/blacklist.cc
index ab6f1d13d80..d6ca383cb75 100644
--- a/compiler-rt/test/tsan/blacklist.cc
+++ b/compiler-rt/test/tsan/blacklist.cc
@@ -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>
diff --git a/compiler-rt/test/tsan/blacklist2.cc b/compiler-rt/test/tsan/blacklist2.cc
index b39eef8bd33..12582082754 100644
--- a/compiler-rt/test/tsan/blacklist2.cc
+++ b/compiler-rt/test/tsan/blacklist2.cc
@@ -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>
diff --git a/compiler-rt/test/tsan/load_shared_lib.cc b/compiler-rt/test/tsan/load_shared_lib.cc
index 2747b295114..a27dc1cc6ff 100644
--- a/compiler-rt/test/tsan/load_shared_lib.cc
+++ b/compiler-rt/test/tsan/load_shared_lib.cc
@@ -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
diff --git a/compiler-rt/test/tsan/mutex_cycle2.c b/compiler-rt/test/tsan/mutex_cycle2.c
index fb2b533a103..cd9a46733f2 100644
--- a/compiler-rt/test/tsan/mutex_cycle2.c
+++ b/compiler-rt/test/tsan/mutex_cycle2.c
@@ -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() {
OpenPOWER on IntegriCloud