Stephen Hines | 6d18623 | 2014-11-26 17:56:19 -0800 | [diff] [blame] | 1 | // When DYLD-inserting the ASan dylib from a different location than the |
| 2 | // original, make sure we don't try to reexec. |
| 3 | |
| 4 | // RUN: mkdir -p %T/dyld_insert_libraries_reexec |
| 5 | // RUN: cp `%clang_asan %s -fsanitize=address -### 2>&1 \ |
| 6 | // RUN: | grep "libclang_rt.asan_osx_dynamic.dylib" \ |
| 7 | // RUN: | sed -e 's/.*"\(.*libclang_rt.asan_osx_dynamic.dylib\)".*/\1/'` \ |
| 8 | // RUN: %T/dyld_insert_libraries_reexec/libclang_rt.asan_osx_dynamic.dylib |
| 9 | // RUN: %clangxx_asan %s -o %T/dyld_insert_libraries_reexec/a.out |
Pirama Arumuga Nainar | cdce50b | 2015-07-01 12:26:56 -0700 | [diff] [blame] | 10 | // RUN: env DYLD_INSERT_LIBRARIES=@executable_path/libclang_rt.asan_osx_dynamic.dylib \ |
| 11 | // RUN: ASAN_OPTIONS=$ASAN_OPTIONS:verbosity=1 %run %T/dyld_insert_libraries_reexec/a.out 2>&1 \ |
Stephen Hines | 6d18623 | 2014-11-26 17:56:19 -0800 | [diff] [blame] | 12 | // RUN: | FileCheck %s |
Pirama Arumuga Nainar | cdce50b | 2015-07-01 12:26:56 -0700 | [diff] [blame] | 13 | // RUN: env ASAN_OPTIONS=$ASAN_OPTIONS:verbosity=1 %run %T/dyld_insert_libraries_reexec/a.out 2>&1 \ |
Stephen Hines | 6d18623 | 2014-11-26 17:56:19 -0800 | [diff] [blame] | 14 | // RUN: | FileCheck --check-prefix=CHECK-NOINSERT %s |
| 15 | |
| 16 | #include <stdio.h> |
| 17 | |
| 18 | int main() { |
| 19 | printf("Passed\n"); |
| 20 | return 0; |
| 21 | } |
| 22 | |
Stephen Hines | 6d18623 | 2014-11-26 17:56:19 -0800 | [diff] [blame] | 23 | // CHECK-NOINSERT: exec()-ing the program with |
| 24 | // CHECK-NOINSERT: DYLD_INSERT_LIBRARIES |
| 25 | // CHECK-NOINSERT: to enable ASan wrappers. |
| 26 | // CHECK-NOINSERT: Passed |
| 27 | |
Stephen Hines | 6d18623 | 2014-11-26 17:56:19 -0800 | [diff] [blame] | 28 | // CHECK-NOT: exec()-ing the program with |
| 29 | // CHECK-NOT: DYLD_INSERT_LIBRARIES |
| 30 | // CHECK-NOT: to enable ASan wrappers. |
| 31 | // CHECK: Passed |