Stephen Hines | 2d1fdb2 | 2014-05-28 23:58:16 -0700 | [diff] [blame] | 1 | // RUN: %clangxx_tsan -O1 %s -DLIB -fPIC -fno-sanitize=thread -shared -o %T/libignore_lib3.so |
| 2 | // RUN: %clangxx_tsan -O1 %s -o %t |
Stephen Hines | 86277eb | 2015-03-23 12:06:32 -0700 | [diff] [blame] | 3 | // RUN: TSAN_OPTIONS="$TSAN_OPTIONS suppressions='%s.supp'" %deflake %run %t | FileCheck %s |
Stephen Hines | 2d1fdb2 | 2014-05-28 23:58:16 -0700 | [diff] [blame] | 4 | |
| 5 | // Tests that unloading of a library matched against called_from_lib suppression |
| 6 | // causes program crash (this is not supported). |
| 7 | |
| 8 | #ifndef LIB |
| 9 | |
| 10 | #include <dlfcn.h> |
| 11 | #include <stdlib.h> |
| 12 | #include <stdio.h> |
| 13 | #include <errno.h> |
| 14 | #include <libgen.h> |
| 15 | #include <string> |
| 16 | |
| 17 | int main(int argc, char **argv) { |
| 18 | std::string lib = std::string(dirname(argv[0])) + "/libignore_lib3.so"; |
| 19 | void *h = dlopen(lib.c_str(), RTLD_GLOBAL | RTLD_NOW); |
| 20 | dlclose(h); |
| 21 | fprintf(stderr, "OK\n"); |
| 22 | } |
| 23 | |
| 24 | #else // #ifdef LIB |
| 25 | |
| 26 | extern "C" void libfunc() { |
| 27 | } |
| 28 | |
| 29 | #endif // #ifdef LIB |
| 30 | |
| 31 | // CHECK: ThreadSanitizer: library {{.*}} that was matched against called_from_lib suppression 'ignore_lib3.so' is unloaded |
| 32 | // CHECK-NOT: OK |
| 33 | |