From: Tom Yu Date: Tue, 20 Apr 2010 22:35:42 +0000 (+0000) Subject: Only create runenv.py at BUILDTOP. Fix bugs in k5test.py relating to X-Git-Tag: krb5-1.9-beta1~280 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=496aa945b271b670628a5c69df591f5768d5987f;p=krb5.git Only create runenv.py at BUILDTOP. Fix bugs in k5test.py relating to environment initialization, also so that "make testrealm" works again. git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@23913 dc483132-0cff-0310-8789-dd5450dbe970 --- diff --git a/src/Makefile.in b/src/Makefile.in index ed0e69c14..2f64c497b 100644 --- a/src/Makefile.in +++ b/src/Makefile.in @@ -14,8 +14,10 @@ SUBDIRS=util include lib \ plugins/preauth/encrypted_challenge \ kdc kadmin slave clients appl tests \ config-files gen-manpages -BUILDTOP=$(REL)$(C) +BUILDTOP=$(REL). LOCALINCLUDES = -I$(srcdir) +PROG_LIBPATH=-L$(TOPLIBD) +PROG_RPATH=$(KRB5_LIBDIR) SRCS = HDRS = @@ -625,8 +627,25 @@ check-unix:: krb5-config check-prerecurse: fake-install # Create a test realm and spawn a shell in an environment pointing to it. -testrealm: fake-install - PYTHONPATH=$(top_srcdir)/util $(PYTHON) $(srcdir)/util/testrealm.py +testrealm: fake-install runenv.py + PYTHONPATH=$(BUILDTOP):$(top_srcdir)/util $(PYTHON) $(srcdir)/util/testrealm.py + +# environment variable settings to propagate to Python-based tests + +check-pytests-yes: runenv.py + +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-unix:: + $(RM) runenv.py pyrunenv.vals COV_BUILD= cov-build COV_ANALYZE= cov-analyze diff --git a/src/config/post.in b/src/config/post.in index c4cdcae3b..861117c9e 100644 --- a/src/config/post.in +++ b/src/config/post.in @@ -136,10 +136,10 @@ check-unix:: check-pytests check-pytests:: check-pytests-@HAVE_PYTHON@ -check-pytests-yes: runenv.py +check-pytests-yes: @pytests="$(PYTESTS)"; \ for t in $$pytests; do \ - echo PYTHONPATH=`pwd`:$(top_srcdir)/util VALGRIND="$(VALGRIND)" \ + echo PYTHONPATH=$(BUILDTOP):$(top_srcdir)/util VALGRIND="$(VALGRIND)" \ $(PYTHON) $(srcdir)/$$t $(PYTESTFLAGS); \ PYTHONPATH=`pwd`:$(top_srcdir)/util VALGRIND="$(VALGRIND)" \ $(PYTHON) $(srcdir)/$$t $(PYTESTFLAGS) || exit 1; \ @@ -150,22 +150,11 @@ 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/util/k5test.py b/src/util/k5test.py index 1065191e2..f90f8ac51 100644 --- a/src/util/k5test.py +++ b/src/util/k5test.py @@ -467,7 +467,14 @@ 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(): - return dict(runenv.env) + global buildtop + env = os.environ.copy() + for (k, v) in runenv.env.iteritems(): + if v.find('./') == 0: + env[k] = os.path.join(buildtop, v) + else: + env[k] = v + return 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