Only create runenv.py at BUILDTOP. Fix bugs in k5test.py relating to
authorTom Yu <tlyu@mit.edu>
Tue, 20 Apr 2010 22:35:42 +0000 (22:35 +0000)
committerTom Yu <tlyu@mit.edu>
Tue, 20 Apr 2010 22:35:42 +0000 (22:35 +0000)
environment initialization, also so that "make testrealm" works again.

git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@23913 dc483132-0cff-0310-8789-dd5450dbe970

src/Makefile.in
src/config/post.in
src/util/k5test.py

index ed0e69c14214a6ed059298f52a32f6f49a967cc1..2f64c497bac42c1368650b7e27533757f3c633ba 100644 (file)
@@ -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
index c4cdcae3bf9577f8941b5fce07c911d1cc35d6fa..861117c9e9e7a22f138849766f64604d60f8eb3d 100644 (file)
@@ -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)
index 1065191e2fa74624fb779e818e024d7ef8caa018..f90f8ac51ce30e4ce1afedfda4adca63205bfa08 100644 (file)
@@ -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