1 // Check that when launching with DYLD_INSERT_LIBRARIES, we properly remove
2 // the ASan dylib from the environment variable (both when using an absolute
3 // or relative path) and also that the other dylibs are left untouched.
7 // RUN: rm -rf %t && mkdir -p %t
8 // RUN: cp `%clang_asan -print-file-name=lib`/darwin/libclang_rt.asan_osx_dynamic.dylib \
9 // RUN: %t/libclang_rt.asan_osx_dynamic.dylib
11 // RUN: %clangxx_asan %s -o %t/a.out
12 // RUN: %clangxx -DSHARED_LIB %s \
13 // RUN: -dynamiclib -o %t/dummy-so.dylib
16 // RUN: DYLD_INSERT_LIBRARIES=@executable_path/libclang_rt.asan_osx_dynamic.dylib:dummy-so.dylib \
17 // RUN: %run ./a.out 2>&1 ) | FileCheck %s || exit 1
20 // RUN: DYLD_INSERT_LIBRARIES=libclang_rt.asan_osx_dynamic.dylib:dummy-so.dylib \
21 // RUN: %run ./a.out 2>&1 ) | FileCheck %s || exit 1
24 // RUN: %env_asan_opts=strip_env=0 \
25 // RUN: DYLD_INSERT_LIBRARIES=libclang_rt.asan_osx_dynamic.dylib:dummy-so.dylib \
26 // RUN: %run ./a.out 2>&1 ) | FileCheck %s --check-prefix=CHECK-KEEP || exit 1
29 // RUN: DYLD_INSERT_LIBRARIES=%t/libclang_rt.asan_osx_dynamic.dylib:dummy-so.dylib \
30 // RUN: %run ./a.out 2>&1 ) | FileCheck %s || exit 1
32 #if !defined(SHARED_LIB)
37 const char kEnvName
[] = "DYLD_INSERT_LIBRARIES";
38 printf("%s=%s\n", kEnvName
, getenv(kEnvName
));
39 // CHECK: {{DYLD_INSERT_LIBRARIES=dummy-so.dylib}}
40 // CHECK-KEEP: {{DYLD_INSERT_LIBRARIES=libclang_rt.asan_osx_dynamic.dylib:dummy-so.dylib}}