brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.5 KiB · c8cd3f4 Raw
51 lines · cpp
1// RUN: rm -rf %t-dir2// RUN: mkdir %t-dir3 4// RUN: %clangxx_tsan -O1 -fno-builtin %s -DLIB -fPIC -fno-sanitize=thread -shared -o %t-dir/libignore_lib1.so5// RUN: %clangxx_tsan -O1 %s %link_libcxx_tsan -o %t-dir/executable6// RUN: echo running w/o suppressions:7// RUN: %deflake %run %t-dir/executable | FileCheck %s --check-prefix=CHECK-NOSUPP8// RUN: echo running with suppressions:9// RUN: %env_tsan_opts=suppressions='%s.supp' %run %t-dir/executable 2>&1 | FileCheck %s --check-prefix=CHECK-WITHSUPP10 11// Tests that interceptors coming from a dynamically loaded library specified12// in called_from_lib suppression are ignored.13 14// REQUIRES: stable-runtime15// UNSUPPORTED: target=powerpc64le{{.*}}16// FIXME: This test regularly fails on powerpc64 LE possibly starting with17// r279664.  Re-enable the test once the problem(s) have been fixed.18 19#ifndef LIB20 21#include <dlfcn.h>22#include <stdlib.h>23#include <stdio.h>24#include <errno.h>25#include <libgen.h>26#include <string>27 28int main(int argc, char **argv) {29  std::string lib = std::string(dirname(argv[0])) + "/libignore_lib1.so";30  void *h = dlopen(lib.c_str(), RTLD_GLOBAL | RTLD_NOW);31  if (h == 0)32    exit(printf("failed to load the library (%d)\n", errno));33  void (*f)() = (void(*)())dlsym(h, "libfunc");34  if (f == 0)35    exit(printf("failed to find the func (%d)\n", errno));36  f();37}38 39#else  // #ifdef LIB40 41#include "ignore_lib_lib.h"42 43#endif  // #ifdef LIB44 45// CHECK-NOSUPP: WARNING: ThreadSanitizer: data race46// CHECK-NOSUPP: OK47 48// CHECK-WITHSUPP-NOT: WARNING: ThreadSanitizer: data race49// CHECK-WITHSUPP: OK50 51