[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[patches] PATCH: properly pass both LD_AUDIT and LD_PRELOAD to wrapped tests
- To: patches@xxxxxxxxxx
- Subject: [patches] PATCH: properly pass both LD_AUDIT and LD_PRELOAD to wrapped tests
- From: Jim Blandy <jimb@xxxxxxxxxxxxxxxx>
- Date: Fri, 13 Apr 2007 17:39:14 -0700
I've committed the following, which generalizes
scripts/run-with-preload.sh to work with other variables, and then
uses that to handle the LD_AUDIT tests along with the LD_PRELOAD
tests.
ChangeLog.eglibc:
2007-04-13 Jim Blandy <jimb@xxxxxxxxxxxxxxxx>
* scripts/run-with-env.sh: New script.
* elf/Makefile: Use run-with-env.sh instead of
run-with-preload.sh.
* nptl/Makefile: Same.
(tst-audit1.out, tst-audit2.out): Use run-with-env.sh, and set
EGLIBC_TEST_LD_AUDIT instead of LD_AUDIT.
* scripts/run-with-preload.sh: Delete.
Index: scripts/run-with-preload.sh
===================================================================
--- scripts/run-with-preload.sh (revision 1970)
+++ scripts/run-with-preload.sh (working copy)
@@ -1,20 +0,0 @@
-#!/bin/sh
-# Usage: run-with-preload.sh CMD ...
-#
-# Set the LD_PRELOAD environment variable to the value of the
-# $EGLIBC_TEST_LD_PRELOAD environment variable, and run CMD ... .
-#
-# The EGLIBC test suite uses this to set LD_PRELOAD for test programs.
-# If we simply say:
-# LD_PRELOAD=smootz \
-# $(cross-test-wrapper) \
-# tst-foo arg1 arg2
-# then the LD_PRELOAD setting inteferes with the execution of
-# $(cross-test-wrapper). If we instead say:
-# EGLIBC_TEST_LD_PRELOAD=smootz \
-# $(cross-test-wrapper) \
-# run-with-preload.sh \
-# tst-foo arg1 arg2
-# then things work fine.
-
-LD_PRELOAD="$EGLIBC_TEST_LD_PRELOAD" exec "$@"
Index: scripts/run-with-env.sh
===================================================================
--- scripts/run-with-env.sh (revision 0)
+++ scripts/run-with-env.sh (revision 0)
@@ -0,0 +1,20 @@
+#!/bin/sh
+# Usage: run-with-env.sh CMD ...
+# Execute commands with environment variables set at the last minute.
+# For certain environment variable whose names are of the form
+# 'EGLIBC_TEST_foo', if they are set, we set an environment variable
+# 'foo' to their value.
+#
+# This lets us run test programs via wrappers with environment
+# variable settings that would otherwise interfere with the wrapper
+# itself, like LD_PRELOAD or LD_AUDIT.
+
+if [ "${EGLIBC_TEST_LD_PRELOAD+set}" ]; then
+ export LD_PRELOAD="${EGLIBC_TEST_LD_PRELOAD}"
+fi
+
+if [ "${EGLIBC_TEST_LD_AUDIT+set}" ]; then
+ export LD_AUDIT="${EGLIBC_TEST_LD_AUDIT}"
+fi
+
+exec "$@"
Property changes on: scripts/run-with-env.sh
___________________________________________________________________
Name: svn:executable
+ *
Index: nptl/Makefile
===================================================================
--- nptl/Makefile (revision 1970)
+++ nptl/Makefile (working copy)
@@ -471,7 +471,7 @@
$(objpfx)tst-tls5mode.so $(objpfx)tst-tls5modf.so
$(SHELL) -e tst-tls6.sh $(common-objpfx) $(elf-objpfx) \
$(rtld-installed-name) '$(cross-test-wrapper)' \
- $(..)scripts/run-with-preload.sh
+ $(..)scripts/run-with-env.sh
endif
$(objpfx)tst-dlsym1: $(libdl) $(shared-thread-library)
Index: nptl/tst-tls6.sh
===================================================================
--- nptl/tst-tls6.sh (revision 1970)
+++ nptl/tst-tls6.sh (working copy)
@@ -4,14 +4,14 @@
elf_objpfx=$1; shift
rtld_installed_name=$1; shift
cross_test_wrapper=$1; shift
-run_with_preload=$1; shift
+run_with_env=$1; shift
logfile=$common_objpfx/nptl/tst-tls6.out
# We have to find libc and nptl
library_path=${common_objpfx}:${common_objpfx}nptl
tst_tls5="${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \
${common_objpfx}/nptl/tst-tls5"
-tst_tls5="$cross_test_wrapper $run_with_preload $tst_tls5"
+tst_tls5="$cross_test_wrapper $run_with_env $tst_tls5"
LC_ALL=C
export LC_ALL
Index: elf/Makefile
===================================================================
--- elf/Makefile (revision 1970)
+++ elf/Makefile (working copy)
@@ -542,7 +542,7 @@
$(objpfx)preloadtest.out: $(preloadtest-preloads:%=$(objpfx)%.so)
preloadtest-ENV = \
EGLIBC_TEST_LD_PRELOAD=$(subst $(empty) ,:,$(strip $(preloadtest-preloads:=.so)))
-preloadtest-WRAPPER = $(..)scripts/run-with-preload.sh
+preloadtest-WRAPPER = $(..)scripts/run-with-env.sh
$(objpfx)loadfail: $(libdl)
LDFLAGS-loadfail = -rdynamic
@@ -589,7 +589,7 @@
$(objpfx)vismain: $(addprefix $(objpfx),vismod1.so vismod2.so)
$(objpfx)vismain.out: $(addprefix $(objpfx),vismod3.so)
vismain-ENV = EGLIBC_TEST_LD_PRELOAD=$(addprefix $(objpfx),vismod3.so)
-vismain-WRAPPER = $(..)scripts/run-with-preload.sh
+vismain-WRAPPER = $(..)scripts/run-with-env.sh
$(objpfx)noload: $(objpfx)testobj1.so
LDFLAGS-noload = -rdynamic
@@ -890,10 +890,12 @@
$(objpfx)tst-dlmopen3.out: $(objpfx)tst-dlmopen1mod.so
$(objpfx)tst-audit1.out: $(objpfx)tst-auditmod1.so
-tst-audit1-ENV = LD_AUDIT=$(objpfx)tst-auditmod1.so
+tst-audit1-ENV = EGLIBC_TEST_LD_AUDIT=$(objpfx)tst-auditmod1.so
+tst-audit1-WRAPPER = $(..)scripts/run-with-env.sh
$(objpfx)tst-audit2.out: $(objpfx)tst-auditmod1.so
-tst-audit2-ENV = LD_AUDIT=$(objpfx)tst-auditmod1.so
+tst-audit2-ENV = EGLIBC_TEST_LD_AUDIT=$(objpfx)tst-auditmod1.so
+tst-audit2-WRAPPER = $(..)scripts/run-with-env.sh
$(objpfx)tst-global1: $(libdl)
$(objpfx)tst-global1.out: $(objpfx)testobj6.so $(objpfx)testobj2.so