1 // RUN: %clangxx_tsan -O1 %s -DLIB -fPIC -fno-sanitize=thread -shared -o %T/libignore_lib1.so
2 // RUN: %clangxx_tsan -O1 %s -o %t
3 // RUN: echo running w/o suppressions:
4 // RUN: not %run %t 2>&1 | FileCheck %s --check-prefix=CHECK-NOSUPP
5 // RUN: echo running with suppressions:
6 // RUN: TSAN_OPTIONS="$TSAN_OPTIONS suppressions=%s.supp" %run %t 2>&1 | FileCheck %s --check-prefix=CHECK-WITHSUPP
8 // Tests that interceptors coming from a dynamically loaded library specified
9 // in called_from_lib suppression are ignored.
20 int main(int argc
, char **argv
) {
21 std::string lib
= std::string(dirname(argv
[0])) + "/libignore_lib1.so";
22 void *h
= dlopen(lib
.c_str(), RTLD_GLOBAL
| RTLD_NOW
);
24 exit(printf("failed to load the library (%d)\n", errno
));
25 void (*f
)() = (void(*)())dlsym(h
, "libfunc");
27 exit(printf("failed to find the func (%d)\n", errno
));
33 #include "ignore_lib_lib.h"
37 // CHECK-NOSUPP: WARNING: ThreadSanitizer: data race
40 // CHECK-WITHSUPP-NOT: WARNING: ThreadSanitizer: data race