diff options
author | Tom Yu <tlyu@mit.edu> | 2010-04-16 21:45:22 +0000 |
---|---|---|
committer | Tom Yu <tlyu@mit.edu> | 2010-04-16 21:45:22 +0000 |
commit | 048c45e81be65f31cd698de6b3536e35f7f1599a (patch) | |
tree | dda52574fac9042667db70a9fba41a04d4f8d718 | |
parent | 4472eed040cf442a504f24158f80242d6fbd94c2 (diff) | |
download | krb5-048c45e81be65f31cd698de6b3536e35f7f1599a.zip krb5-048c45e81be65f31cd698de6b3536e35f7f1599a.tar.gz krb5-048c45e81be65f31cd698de6b3536e35f7f1599a.tar.bz2 |
Build runenv.py, holding environment variable settings required for
running programs out of the build tree during python-based tests.
Also updates shilb.conf to set RUN_VARS to make it easier to generate
this sort of thing.
git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@23905 dc483132-0cff-0310-8789-dd5450dbe970
-rw-r--r-- | src/aclocal.m4 | 4 | ||||
-rw-r--r-- | src/config/post.in | 19 | ||||
-rw-r--r-- | src/config/pre.in | 1 | ||||
-rw-r--r-- | src/config/shlib.conf | 15 | ||||
-rw-r--r-- | src/tests/dejagnu/Makefile.in | 8 | ||||
-rw-r--r-- | src/util/k5test.py | 16 |
6 files changed, 41 insertions, 22 deletions
diff --git a/src/aclocal.m4 b/src/aclocal.m4 index a9725fc..5637f68 100644 --- a/src/aclocal.m4 +++ b/src/aclocal.m4 @@ -1131,7 +1131,9 @@ dnl Set up environment for running dynamic executables out of build tree AC_DEFUN(KRB5_RUN_FLAGS, [AC_REQUIRE([KRB5_LIB_AUX])dnl KRB5_RUN_ENV="$RUN_ENV" -AC_SUBST(KRB5_RUN_ENV)]) +KRB5_RUN_VARS="$RUN_VARS" +AC_SUBST(KRB5_RUN_ENV) +AC_SUBST(KRB5_RUN_VARS)]) dnl dnl KRB5_LIB_AUX diff --git a/src/config/post.in b/src/config/post.in index f9fae21..c4cdcae 100644 --- a/src/config/post.in +++ b/src/config/post.in @@ -136,14 +136,12 @@ check-unix:: check-pytests check-pytests:: check-pytests-@HAVE_PYTHON@ -check-pytests-yes: +check-pytests-yes: runenv.py @pytests="$(PYTESTS)"; \ for t in $$pytests; do \ - echo "$(KRB5_RUN_ENV)" \ - PYTHONPATH=$(top_srcdir)/util VALGRIND="$(VALGRIND)" \ + echo PYTHONPATH=`pwd`:$(top_srcdir)/util VALGRIND="$(VALGRIND)" \ $(PYTHON) $(srcdir)/$$t $(PYTESTFLAGS); \ - $(KRB5_RUN_ENV) \ - PYTHONPATH=$(top_srcdir)/util VALGRIND="$(VALGRIND)" \ + PYTHONPATH=`pwd`:$(top_srcdir)/util VALGRIND="$(VALGRIND)" \ $(PYTHON) $(srcdir)/$$t $(PYTESTFLAGS) || exit 1; \ done @@ -152,11 +150,22 @@ check-pytests-no: echo "+++ Skipping because Python not available: $(PYTESTS)"; \ fi +pyrunenv.vals: Makefile + $(KRB5_RUN_ENV) \ + for i in $(KRB5_RUN_VARS); do \ + eval echo 'env['\\\'$$i\\\''] = '\\\'\$$$$i\\\'; \ + done > $@ + +runenv.py: pyrunenv.vals + echo 'env = {}' > $@ + cat pyrunenv.vals >> $@ + clean:: clean-$(WHAT) clean-unix:: $(RM) $(OBJS) $(DEPTARGETS_CLEAN) $(EXTRA_FILES) et-[ch]-*.et et-[ch]-*.[ch] -$(RM) -r $(top_srcdir)/autom4te.cache + $(RM) runenv.py pyrunenv.vals clean-windows:: $(RM) *.$(OBJEXT) diff --git a/src/config/pre.in b/src/config/pre.in index 6bf9cc4..a39c0fa 100644 --- a/src/config/pre.in +++ b/src/config/pre.in @@ -398,6 +398,7 @@ APPUTILS_LIB = -lapputils # So test programs can find their libraries without "make install", etc. KRB5_RUN_ENV=@KRB5_RUN_ENV@ +KRB5_RUN_VARS=@KRB5_RUN_VARS@ # # variables for --with-tcl= diff --git a/src/config/shlib.conf b/src/config/shlib.conf index 88fa1dc..f176921 100644 --- a/src/config/shlib.conf +++ b/src/config/shlib.conf @@ -98,6 +98,7 @@ alpha*-dec-osf*) # of searching for shared libs, since RPATHs take precedence over # LD_LIBRARY_PATH. RUN_ENV='LD_LIBRARY_PATH=`echo $(PROG_LIBPATH) | sed -e "s/-L//g" -e "s/ /:/g"`$${LD_LIBRARY_PATH+:$$LD_LIBRARY_PATH}; export LD_LIBRARY_PATH; _RLD_ROOT=$(FAKEDEST):$${_RLD_ROOT+$$_RLD_ROOT}$${_RLD_ROOT-/}; export _RLD_ROOT;' + RUN_VARS='LD_LIBRARY_PATH _RLD_ROOT' ;; # HPUX *seems* to work under 10.20. @@ -141,6 +142,7 @@ alpha*-dec-osf*) CXX_LINK_SHARED='$(CXX) $(PROG_LIBPATH) -Wl,+s $(PROG_RPATH_FLAGS) $(CXXFLAGS) $(LDFLAGS)' CXX_LINK_STATIC='$(CXX) $(PROG_LIBPATH) $(CXXFLAGS) $(LDFLAGS)' RUN_ENV='SHLIB_PATH=`echo $(PROG_LIBPATH) | sed -e "s/-L//g" -e "s/ /:/g"`; export SHLIB_PATH;' + RUN_VARS='SHLIB_PATH' SHLIB_EXPORT_FILE_DEP=hpux10.exports # Do *not* set use_linker_init_option=yes here, because in the # case where the library is specified at program link time, the @@ -188,6 +190,7 @@ mips-sgi-irix6.3) # This is a Kludge; see below for i in N32 64 ''; do RUN_ENV="${RUN_ENV+ $RUN_ENV}LD_LIBRARY${i}_PATH=$add\$\${LD_LIBRARY${i}_PATH+:\$\$LD_LIBRARY${i}_PATH}; export LD_LIBRARY${i}_PATH;" RUN_ENV="${RUN_ENV} _RLD${i}_ROOT=\$(FAKEDEST):\$\${_RLD${i}_ROOT+\$\${_RLD${i}_ROOT}}\$\${_RLD${i}_ROOT-/}; export _RLD${i}_ROOT;" + RUN_VARS="$RUN_VARS LD_LIBRARY${i}_PATH _RLD${i}_ROOT" done ;; @@ -236,6 +239,7 @@ mips-sgi-irix*) for i in N32 64 ''; do RUN_ENV="${RUN_ENV+ $RUN_ENV}LD_LIBRARY${i}_PATH=$add\$\${LD_LIBRARY${i}_PATH+:\$\$LD_LIBRARY${i}_PATH}; export LD_LIBRARY${i}_PATH;" RUN_ENV="${RUN_ENV} _RLD${i}_ROOT=\$(FAKEDEST):\$\${_RLD${i}_ROOT+\$\${_RLD${i}_ROOT}}\$\${_RLD${i}_ROOT-/}; export _RLD${i}_ROOT;" + RUN_VARS="$RUN_VARS LD_LIBRARY${i}_PATH _RLD${i}_ROOT" done ;; @@ -260,6 +264,7 @@ mips-sni-sysv4) CXX_LINK_SHARED='$(CXX) $(PROG_LIBPATH) $(PROG_RPATH_FLAGS) $(CXXFLAGS) $(LDFLAGS)' CXX_LINK_STATIC='$(CXX) $(PROG_LIBPATH) $(CXXFLAGS) $(LDFLAGS)' RUN_ENV='LD_LIBRARY_PATH=`echo $(PROG_LIBPATH) | sed -e "s/-L//g" -e "s/ /:/g"`; export LD_LIBRARY_PATH;' + RUN_VARS='LD_LIBRARY_PATH' PROFFLAGS=-pg ;; @@ -278,6 +283,7 @@ mips-*-netbsd*) CXX_LINK_SHARED='$(CXX) $(PROG_LIBPATH) $(PROG_RPATH_FLAGS) $(CXXFLAGS) $(LDFLAGS)' CXX_LINK_STATIC='$(CXX) $(PROG_LIBPATH) $(CXXFLAGS) $(LDFLAGS)' RUN_ENV='LD_LIBRARY_PATH=`echo $(PROG_LIBPATH) | sed -e "s/-L//g" -e "s/ /:/g"`; export LD_LIBRARY_PATH;' + RUN_VARS='LD_LIBRARY_PATH' PROFFLAGS=-pg ;; @@ -295,6 +301,7 @@ mips-*-netbsd*) CXX_LINK_SHARED='$(CXX) $(PROG_LIBPATH) $(PROG_RPATH_FLAGS) $(CXXFLAGS) $(LDFLAGS)' CXX_LINK_STATIC='$(CXX) $(PROG_LIBPATH) $(CXXFLAGS) $(LDFLAGS)' RUN_ENV='LD_LIBRARY_PATH=`echo $(PROG_LIBPATH) | sed -e "s/-L//g" -e "s/ /:/g"`; export LD_LIBRARY_PATH;' + RUN_VARS='LD_LIBRARY_PATH' PROFFLAGS=-pg ;; @@ -322,6 +329,7 @@ mips-*-netbsd*) CC_LINK_STATIC='$(CC) $(PROG_LIBPATH) $(CFLAGS) $(LDFLAGS)' CXX_LINK_STATIC='$(CXX) $(PROG_LIBPATH) $(CXXFLAGS) $(LDFLAGS)' RUN_ENV='LD_LIBRARY_PATH=`echo $(PROG_LIBPATH) | sed -e "s/-L//g" -e "s/ /:/g"`; export LD_LIBRARY_PATH;' + RUN_VARS='LD_LIBRARY_PATH' PROFFLAGS=-pg ;; @@ -339,6 +347,7 @@ mips-*-netbsd*) CXX_LINK_SHARED='$(CXX) $(PROG_LIBPATH) $(PROG_RPATH_FLAGS) $(CXXFLAGS) $(LDFLAGS)' CXX_LINK_STATIC='$(CXX) $(PROG_LIBPATH) $(CXXFLAGS) $(LDFLAGS)' RUN_ENV='LD_LIBRARY_PATH=`echo $(PROG_LIBPATH) | sed -e "s/-L//g" -e "s/ /:/g"`; export LD_LIBRARY_PATH;' + RUN_VARS='LD_LIBRARY_PATH' PROFFLAGS=-pg ;; @@ -364,6 +373,7 @@ mips-*-netbsd*) CXX_LINK_SHARED='$(CXX) $(PROG_LIBPATH) -dynamic $(CXXFLAGS) $(LDFLAGS)' CXX_LINK_STATIC='$(CXX) $(PROG_LIBPATH) $(CXXFLAGS) $(LDFLAGS)' RUN_ENV='DYLD_LIBRARY_PATH=`echo $(PROG_LIBPATH) | sed -e "s/-L//g" -e "s/ /:/g"`; export DYLD_LIBRARY_PATH;' + RUN_VARS='DYLD_LIBRARY_PATH' ;; *-*-solaris*) @@ -399,6 +409,7 @@ mips-*-netbsd*) CXX_LINK_SHARED='$(PURE) $(CXX) $(PROG_LIBPATH) $(PROG_RPATH_FLAGS) $(CXXFLAGS) $(LDFLAGS)' CXX_LINK_STATIC='$(PURE) $(CXX) $(PROG_LIBPATH) $(CXXFLAGS) $(LDFLAGS)' RUN_ENV='LD_LIBRARY_PATH=`echo $(PROG_LIBPATH) | sed -e "s/-L//g" -e "s/ /:/g"`; export LD_LIBRARY_PATH;' + RUN_VARS='LD_LIBRARY_PATH' ;; *-*-linux* | *-*-gnu* | *-*-k*bsd*-gnu) @@ -424,6 +435,7 @@ mips-*-netbsd*) CXX_LINK_SHARED='$(CXX) $(PROG_LIBPATH) $(PROG_RPATH_FLAGS) $(CXXFLAGS) $(LDFLAGS)' CXX_LINK_STATIC='$(CXX) $(PROG_LIBPATH) $(CXXFLAGS) $(LDFLAGS)' RUN_ENV='LD_LIBRARY_PATH=`echo $(PROG_LIBPATH) | sed -e "s/-L//g" -e "s/ /:/g"`; export LD_LIBRARY_PATH; ' + RUN_VARS='LD_LIBRARY_PATH' ## old version: # Linux libc does weird stuff at shlib link time, must be @@ -451,6 +463,7 @@ mips-*-netbsd*) CXX_LINK_STATIC='$(CXX) $(PROG_LIBPATH)' RUN_ENV='LD_LIBRARY_PATH=`echo $(PROG_LIBPATH) | sed -e "s/-L//g" -e "s/ /:/g"`; export LD_LIBRARY_PATH;' + RUN_VARS='LD_LIBRARY_PATH' PROFFLAGS=-pg ;; @@ -482,6 +495,7 @@ mips-*-netbsd*) CXX_LINK_STATIC='$(CXX) $(PROG_LIBPATH) $(CXXFLAGS) $(LDFLAGS)' # $(PROG_RPATH) is here to handle things like a shared tcl library RUN_ENV='LIBPATH=`echo $(PROG_LIBPATH) | sed -e "s/-L//g" -e "s/ /:/g"`:$(PROG_RPATH):/usr/lib:/usr/local/lib; export LIBPATH; ' + RUN_VARS='LIBPATH' ;; *-*-aix4.*) @@ -519,6 +533,7 @@ mips-*-netbsd*) CXX_LINK_STATIC='$(CXX) $(PROG_LIBPATH) $(CXXFLAGS) $(LDFLAGS)' # $(PROG_RPATH) is here to handle things like a shared tcl library RUN_ENV='LIBPATH=`echo $(PROG_LIBPATH) | sed -e "s/-L//g" -e "s/ /:/g"`:$(PROG_RPATH):/usr/lib:/usr/local/lib; export LIBPATH; ' + RUN_VARS='LIBPATH' ;; esac diff --git a/src/tests/dejagnu/Makefile.in b/src/tests/dejagnu/Makefile.in index d8e7530..1cb7509 100644 --- a/src/tests/dejagnu/Makefile.in +++ b/src/tests/dejagnu/Makefile.in @@ -33,12 +33,8 @@ clean:: clean-unix:: $(RM) -rf tmpdir dbg.log krb.log krb.sum -runenv.vars: Makefile - echo '$(KRB5_RUN_ENV)' | tr ';' '\012' | \ - sed -ne 's% *\([^=]*\)=.*%\1%p' > runenv.vars - -runenv.vals: runenv.vars - $(KRB5_RUN_ENV) for i in `cat runenv.vars`; do \ +runenv.vals: Makefile + $(KRB5_RUN_ENV) for i in $(KRB5_RUN_VARS); do \ eval echo "{$$i=\$$$$i}"; done > runenv.vals site.exp: runenv.vals Makefile diff --git a/src/util/k5test.py b/src/util/k5test.py index 2404a46..1065191 100644 --- a/src/util/k5test.py +++ b/src/util/k5test.py @@ -304,6 +304,11 @@ import string import subprocess import sys +# runenv.py is built in each directory where tests are run, providing +# the environment variable settings needed for running programs in the +# build tree. These can vary by platform. +import runenv + # Used when most things go wrong (other than programming errors) so # that the user sees an error message rather than a Python traceback, # without help from the test script. The on-exit handler will display @@ -462,16 +467,7 @@ def _match_cmdnum(cmdnum, ind): # Return an environment suitable for running programs in the build # tree. It is safe to modify the result. def _build_env(): - libdir = os.path.join(buildtop, 'lib') - env = os.environ.copy() - ldlpath = env.get('LD_LIBRARY_PATH') - if ldlpath: - ldlpath = libdir + os.pathsep + ldlpath - else: - ldlpath = libdir - env['LD_LIBRARY_PATH'] = ldlpath - return env - + return dict(runenv.env) # Merge the nested dictionaries cfg1 and cfg2 into a new dictionary. # cfg1 or cfg2 may be None, in which case the other is returned. If |