[TSan] Make lit-tests more self-contained

llvm-svn: 210370
This commit is contained in:
Alexey Samsonov 2014-06-06 21:04:55 +00:00
parent 06a4042c8d
commit 2c8dda4e53
8 changed files with 30 additions and 43 deletions

View File

@ -1,2 +0,0 @@
fun:*Blacklisted_Thread2*
fun:*CallTouchGlobal*

View File

@ -1,2 +0,0 @@
# Files in this directory are helper files for other output tests.
config.suffixes = []

View File

@ -1,4 +0,0 @@
# Sources in this directory are compiled as shared libraries and used by
# tests in parent directory.
config.suffixes = []

View File

@ -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;
}

View 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>

View 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>

View 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

View 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() {