28 lines · cpp
1// Make sure ASan doesn't hang in an exec loop if DYLD_INSERT_LIBRARIES is set.2// This is a regression test for3// https://code.google.com/p/address-sanitizer/issues/detail?id=1594 5// RUN: %clangxx_asan %s -o %t6// RUN: %clangxx -DSHARED_LIB %s \7// RUN: -dynamiclib -o darwin-dummy-shared-lib-so.dylib8 9// FIXME: the following command line may hang in the case of a regression.10// RUN: %env DYLD_INSERT_LIBRARIES=darwin-dummy-shared-lib-so.dylib \11// RUN: %run %t 2>&1 | FileCheck %s || exit 112 13// UNSUPPORTED: ios14 15#if !defined(SHARED_LIB)16#include <stdio.h>17#include <stdlib.h>18 19int main() {20 const char kEnvName[] = "DYLD_INSERT_LIBRARIES";21 printf("%s=%s\n", kEnvName, getenv(kEnvName));22 // CHECK: {{DYLD_INSERT_LIBRARIES=.*darwin-dummy-shared-lib-so.dylib.*}}23 return 0;24}25#else // SHARED_LIB26void foo() {}27#endif // SHARED_LIB28