[compiler-rt] r183662 - [ASan] Fix unset-insert-libraries-on-exec.cc on 32-bit Darwin.
Alexander Potapenko
glider at google.com
Mon Jun 10 07:47:44 PDT 2013
Author: glider
Date: Mon Jun 10 09:47:43 2013
New Revision: 183662
URL: http://llvm.org/viewvc/llvm-project?rev=183662&view=rev
Log:
[ASan] Fix unset-insert-libraries-on-exec.cc on 32-bit Darwin.
The test used to execute a 64-bit /bin/bash binary and preload a 32-bit dynamic library into it.
Now the arch-specific version of echo-env is executed instead.
Added:
compiler-rt/trunk/lib/asan/lit_tests/TestCases/Helpers/echo-env.cc (with props)
Modified:
compiler-rt/trunk/lib/asan/lit_tests/TestCases/Darwin/unset-insert-libraries-on-exec.cc
Modified: compiler-rt/trunk/lib/asan/lit_tests/TestCases/Darwin/unset-insert-libraries-on-exec.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/asan/lit_tests/TestCases/Darwin/unset-insert-libraries-on-exec.cc?rev=183662&r1=183661&r2=183662&view=diff
==============================================================================
--- compiler-rt/trunk/lib/asan/lit_tests/TestCases/Darwin/unset-insert-libraries-on-exec.cc (original)
+++ compiler-rt/trunk/lib/asan/lit_tests/TestCases/Darwin/unset-insert-libraries-on-exec.cc Mon Jun 10 09:47:43 2013
@@ -2,19 +2,19 @@
// executing other programs.
// RUN: %clangxx_asan %s -o %t
+// RUN: %clangxx %p/../Helpers/echo-env.cc -o %T/echo-env
// RUN: %clangxx %p/../SharedLibs/darwin-dummy-shared-lib-so.cc \
// RUN: -dynamiclib -o %t-darwin-dummy-shared-lib-so.dylib
// Make sure DYLD_INSERT_LIBRARIES doesn't contain the runtime library before
// execl().
-// RUN: %t >/dev/null 2>&1
+// RUN: %t %T/echo-env >/dev/null 2>&1
// RUN: DYLD_INSERT_LIBRARIES=%t-darwin-dummy-shared-lib-so.dylib \
-// RUN: %t 2>&1 | FileCheck %s || exit 1
+// RUN: %t %T/echo-env 2>&1 | FileCheck %s || exit 1
#include <unistd.h>
-int main() {
- execl("/bin/bash", "/bin/bash", "-c",
- "echo DYLD_INSERT_LIBRARIES=$DYLD_INSERT_LIBRARIES", NULL);
- // CHECK: {{DYLD_INSERT_LIBRARIES=.*darwin-dummy-shared-lib-so.dylib.*}}
+int main(int argc, char *argv[]) {
+ execl(argv[1], argv[1], "DYLD_INSERT_LIBRARIES", NULL);
+ // CHECK: {{DYLD_INSERT_LIBRARIES = .*darwin-dummy-shared-lib-so.dylib.*}}
return 0;
}
Added: compiler-rt/trunk/lib/asan/lit_tests/TestCases/Helpers/echo-env.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/asan/lit_tests/TestCases/Helpers/echo-env.cc?rev=183662&view=auto
==============================================================================
--- compiler-rt/trunk/lib/asan/lit_tests/TestCases/Helpers/echo-env.cc (added)
+++ compiler-rt/trunk/lib/asan/lit_tests/TestCases/Helpers/echo-env.cc Mon Jun 10 09:47:43 2013
@@ -0,0 +1,19 @@
+// Helper binary for
+// lit_tests/TestCases/Darwin/unset-insert-libraries-on-exec.cc
+// Prints the environment variable with the given name.
+#include <stdio.h>
+#include <stdlib.h>
+
+int main(int argc, char *argv[]) {
+ if (argc != 2) {
+ printf("Usage: %s ENVNAME\n", argv[0]);
+ exit(1);
+ }
+ const char *value = getenv(argv[1]);
+ if (value) {
+ printf("%s = %s\n", argv[1], value);
+ } else {
+ printf("%s not set.\n", argv[1]);
+ }
+ return 0;
+}
Propchange: compiler-rt/trunk/lib/asan/lit_tests/TestCases/Helpers/echo-env.cc
------------------------------------------------------------------------------
svn:eol-style = LF
More information about the llvm-commits
mailing list