]> git.proxmox.com Git - rustc.git/blame - src/compiler-rt/test/asan/TestCases/Darwin/reexec-insert-libraries-env.cc
Imported Upstream version 1.6.0+dfsg1
[rustc.git] / src / compiler-rt / test / asan / TestCases / Darwin / reexec-insert-libraries-env.cc
CommitLineData
1a4d82fc
JJ
1// Make sure ASan doesn't hang in an exec loop if DYLD_INSERT_LIBRARIES is set.
2// This is a regression test for
3// https://code.google.com/p/address-sanitizer/issues/detail?id=159
4
5// RUN: %clangxx_asan %s -o %t
92a42be0 6// RUN: %clangxx -DSHARED_LIB %s \
1a4d82fc
JJ
7// RUN: -dynamiclib -o darwin-dummy-shared-lib-so.dylib
8
9// FIXME: the following command line may hang in the case of a regression.
92a42be0 10// RUN: env DYLD_INSERT_LIBRARIES=darwin-dummy-shared-lib-so.dylib \
1a4d82fc 11// RUN: %run %t 2>&1 | FileCheck %s || exit 1
92a42be0
SL
12
13#if !defined(SHARED_LIB)
1a4d82fc
JJ
14#include <stdio.h>
15#include <stdlib.h>
16
17int main() {
18 const char kEnvName[] = "DYLD_INSERT_LIBRARIES";
19 printf("%s=%s\n", kEnvName, getenv(kEnvName));
20 // CHECK: {{DYLD_INSERT_LIBRARIES=.*darwin-dummy-shared-lib-so.dylib.*}}
21 return 0;
22}
92a42be0
SL
23#else // SHARED_LIB
24void foo() {}
25#endif // SHARED_LIB