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