1// Test that dyld interposition works in the presence of DYLD_LIBRARY_PATH.
2
3// RUN: %clang_tsan %s -o %t
4// RUN: env DYLD_LIBRARY_PATH=/usr/lib/system/introspection/ %run %t 2>&1 | FileCheck %s --implicit-check-not='ThreadSanitizer'
5
6#include <pthread.h>
7#include <stdio.h>
8
9void *Thread(void *a) {
10 fprintf(stderr, format: "Hello from pthread\n");
11 return NULL;
12}
13
14int main() {
15 pthread_t t;
16 pthread_create(newthread: &t, NULL, start_routine: Thread, NULL);
17 pthread_join(th: t, NULL);
18 fprintf(stderr, format: "Done.\n");
19}
20
21// CHECK: Hello from pthread
22// CHECK: Done.
23

source code of compiler-rt/test/tsan/Darwin/dyld-library-path.c