[ASan/Win] Add a comment about DCL-using-static vs threads
[blocksruntime.git] / test / tsan / ignore_lib2.cc
blob7467ec0f2e2b0b1c05fb8e6b8f0237fa33934fd3
1 // RUN: %clangxx_tsan -O1 %s -DLIB -fPIC -fno-sanitize=thread -shared -o %T/libignore_lib2_0.so
2 // RUN: %clangxx_tsan -O1 %s -DLIB -fPIC -fno-sanitize=thread -shared -o %T/libignore_lib2_1.so
3 // RUN: %clangxx_tsan -O1 %s -o %t
4 // RUN: TSAN_OPTIONS="$TSAN_OPTIONS suppressions=%s.supp" not %run %t 2>&1 | FileCheck %s
6 // Tests that called_from_lib suppression matched against 2 libraries
7 // causes program crash (this is not supported).
9 #ifndef LIB
11 #include <dlfcn.h>
12 #include <stdio.h>
13 #include <libgen.h>
14 #include <string>
16 int main(int argc, char **argv) {
17 std::string lib0 = std::string(dirname(argv[0])) + "/libignore_lib2_0.so";
18 std::string lib1 = std::string(dirname(argv[0])) + "/libignore_lib2_1.so";
19 dlopen(lib0.c_str(), RTLD_GLOBAL | RTLD_NOW);
20 dlopen(lib1.c_str(), RTLD_GLOBAL | RTLD_NOW);
21 fprintf(stderr, "OK\n");
24 #else // #ifdef LIB
26 extern "C" void libfunc() {
29 #endif // #ifdef LIB
31 // CHECK: ThreadSanitizer: called_from_lib suppression 'ignore_lib2' is matched against 2 libraries
32 // CHECK-NOT: OK