Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / compiler-rt / test / tsan / ignore_lib2.cpp
blob05b7c2ed915a766a7546d65b4da6d5f70a268b6a
1 // RUN: rm -rf %t-dir
2 // RUN: mkdir %t-dir
4 // RUN: %clangxx_tsan -O1 %s -DLIB -fPIC -fno-sanitize=thread -shared -o %t-dir/libignore_lib2_0.so
5 // RUN: %clangxx_tsan -O1 %s -DLIB -fPIC -fno-sanitize=thread -shared -o %t-dir/libignore_lib2_1.so
6 // RUN: %clangxx_tsan -O1 %s %link_libcxx_tsan -o %t-dir/executable
7 // RUN: %env_tsan_opts=suppressions='%s.supp' %deflake %run %t-dir/executable | FileCheck %s
9 // Tests that called_from_lib suppression matched against 2 libraries
10 // causes program crash (this is not supported).
12 #ifndef LIB
14 #include <dlfcn.h>
15 #include <stdio.h>
16 #include <libgen.h>
17 #include <string>
19 int main(int argc, char **argv) {
20 std::string lib0 = std::string(dirname(argv[0])) + "/libignore_lib2_0.so";
21 std::string lib1 = std::string(dirname(argv[0])) + "/libignore_lib2_1.so";
22 dlopen(lib0.c_str(), RTLD_GLOBAL | RTLD_NOW);
23 dlopen(lib1.c_str(), RTLD_GLOBAL | RTLD_NOW);
24 fprintf(stderr, "OK\n");
27 #else // #ifdef LIB
29 extern "C" void libfunc() {
32 #endif // #ifdef LIB
34 // CHECK: ThreadSanitizer: called_from_lib suppression 'ignore_lib2' is matched against 2 libraries
35 // CHECK-NOT: OK