view compiler-rt/test/tsan/Darwin/dyld-library-path.c @ 236:c4bab56944e8 llvm-original

LLVM 16
author kono
date Wed, 09 Nov 2022 17:45:10 +0900
parents
children
line wrap: on
line source

// Test that dyld interposition works in the presence of DYLD_LIBRARY_PATH.

// RUN: %clang_tsan %s -o %t
// RUN: env DYLD_LIBRARY_PATH=/usr/lib/system/introspection/ %run %t 2>&1 | FileCheck %s --implicit-check-not='ThreadSanitizer'

#include <pthread.h>
#include <stdio.h>

void *Thread(void *a) {
  fprintf(stderr, "Hello from pthread\n");
  return NULL;
}

int main() {
  pthread_t t;
  pthread_create(&t, NULL, Thread, NULL);
  pthread_join(t, NULL);
  fprintf(stderr, "Done.\n");
}

// CHECK: Hello from pthread
// CHECK: Done.