diff 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 diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/compiler-rt/test/tsan/Darwin/dyld-library-path.c	Wed Nov 09 17:45:10 2022 +0900
@@ -0,0 +1,22 @@
+// 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.