1 // RUN: rm -rf %t-dir
2 // RUN: mkdir %t-dir
3 
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
12 
13 // Tests that interceptors coming from a library specified in called_from_lib
14 // suppression are ignored.
15 
16 // Some aarch64 kernels do not support non executable write pages
17 // REQUIRES: stable-runtime
18 
19 // UNSUPPORTED: ios
20 
21 #ifndef LIB
22 
23 extern "C" void libfunc();
24 
main()25 int main() {
26   libfunc();
27 }
28 
29 #else  // #ifdef LIB
30 
31 #include "ignore_lib_lib.h"
32 
33 #endif  // #ifdef LIB
34 
35 // CHECK-NOSUPP: WARNING: ThreadSanitizer: data race
36 // CHECK-NOSUPP: OK
37 
38 // CHECK-WITHSUPP-NOT: WARNING: ThreadSanitizer: data race
39 // CHECK-WITHSUPP: OK
40 
41