diff options
author | Alexey Samsonov <vonosmas@gmail.com> | 2014-06-06 21:04:55 +0000 |
---|---|---|
committer | Alexey Samsonov <vonosmas@gmail.com> | 2014-06-06 21:04:55 +0000 |
commit | 2c8dda4e53a305566bfd92967166ffe68d53851b (patch) | |
tree | e0a228a20d801f14b5cbd814647996d3e726cf02 /compiler-rt/test/tsan/load_shared_lib.cc | |
parent | 06a4042c8d64d21a3cc0642067ced3e0ad62129f (diff) | |
download | bcm5719-llvm-2c8dda4e53a305566bfd92967166ffe68d53851b.tar.gz bcm5719-llvm-2c8dda4e53a305566bfd92967166ffe68d53851b.zip |
[TSan] Make lit-tests more self-contained
llvm-svn: 210370
Diffstat (limited to 'compiler-rt/test/tsan/load_shared_lib.cc')
-rw-r--r-- | compiler-rt/test/tsan/load_shared_lib.cc | 22 |
1 files changed, 20 insertions, 2 deletions
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 |