1 // When DYLD-inserting the ASan dylib from a different location than the
2 // original, make sure we don't try to reexec.
6 // RUN: rm -rf %t && mkdir -p %t
7 // RUN: cp `%clang_asan -print-file-name=lib`/darwin/libclang_rt.asan_osx_dynamic.dylib \
8 // RUN: %t/libclang_rt.asan_osx_dynamic.dylib
9 // RUN: %clangxx_asan %s -o %t/a.out
11 // RUN: %env_asan_opts=verbosity=1 \
12 // RUN: DYLD_INSERT_LIBRARIES=@executable_path/libclang_rt.asan_osx_dynamic.dylib \
13 // RUN: %run %t/a.out 2>&1 \
14 // RUN: | FileCheck %s
16 // RUN: MACOS_MAJOR=$(sw_vers -productVersion | cut -d'.' -f1)
17 // RUN: MACOS_MINOR=$(sw_vers -productVersion | cut -d'.' -f2)
19 // RUN: IS_MACOS_10_11_OR_HIGHER=$([ $MACOS_MAJOR -eq 10 ] && [ $MACOS_MINOR -lt 11 ]; echo $?)
21 // On OS X 10.10 and lower, if the dylib is not DYLD-inserted, ASan will re-exec.
22 // RUN: if [ $IS_MACOS_10_11_OR_HIGHER == 0 ]; then \
23 // RUN: %env_asan_opts=verbosity=1 %run %t/a.out 2>&1 \
24 // RUN: | FileCheck --check-prefix=CHECK-NOINSERT %s; \
27 // On OS X 10.11 and higher, we don't need to DYLD-insert anymore, and the interceptors
28 // still installed correctly. Let's just check that things work and we don't try to re-exec.
29 // RUN: if [ $IS_MACOS_10_11_OR_HIGHER == 1 ]; then \
30 // RUN: %env_asan_opts=verbosity=1 %run %t/a.out 2>&1 \
31 // RUN: | FileCheck %s; \
41 // CHECK-NOINSERT: exec()-ing the program with
42 // CHECK-NOINSERT: DYLD_INSERT_LIBRARIES
43 // CHECK-NOINSERT: to enable wrappers.
44 // CHECK-NOINSERT: Passed
46 // CHECK-NOT: exec()-ing the program with
47 // CHECK-NOT: DYLD_INSERT_LIBRARIES
48 // CHECK-NOT: to enable wrappers.