Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / compiler-rt / test / tsan / ignore_lib0.cpp
blobcba58c617703867f3830af682750688a878a4ed7
1 // RUN: rm -rf %t-dir
2 // RUN: mkdir %t-dir
4 // RUN: %clangxx_tsan -O1 -fno-builtin %s -DLIB -fPIC -fno-sanitize=thread -shared -o %t-dir/libignore_lib0.so
5 // RUN: %clangxx_tsan -O1 %s -L%t-dir -lignore_lib0 %link_libcxx_tsan -o %t
6 // RUN: echo running w/o suppressions:
7 // RUN: env LD_LIBRARY_PATH=%t-dir${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH} %deflake %run %t | FileCheck %s --check-prefix=CHECK-NOSUPP
8 // RUN: echo running with suppressions:
9 // RUN: env LD_LIBRARY_PATH=%t-dir${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH} %env_tsan_opts=suppressions='%s.supp' %run %t 2>&1 | FileCheck %s --check-prefix=CHECK-WITHSUPP
10 // RUN: echo running with generic suppression of noninstrumented code:
11 // RUN: env LD_LIBRARY_PATH=%t-dir${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH} %env_tsan_opts=ignore_noninstrumented_modules=1 %run %t 2>&1 | FileCheck %s --check-prefix=CHECK-WITHSUPP
13 // Tests that interceptors coming from a library specified in called_from_lib
14 // suppression are ignored.
16 // Some aarch64 kernels do not support non executable write pages
17 // REQUIRES: stable-runtime
19 // UNSUPPORTED: ios
21 #ifndef LIB
23 extern "C" void libfunc();
25 int main() {
26 libfunc();
29 #else // #ifdef LIB
31 #include "ignore_lib_lib.h"
33 #endif // #ifdef LIB
35 // CHECK-NOSUPP: WARNING: ThreadSanitizer: data race
36 // CHECK-NOSUPP: OK
38 // CHECK-WITHSUPP-NOT: WARNING: ThreadSanitizer: data race
39 // CHECK-WITHSUPP: OK