svn rev #23932: trunk/src/ config/ tests/ tests/gssapi/ util/

ghudson@MIT.EDU ghudson at MIT.EDU
Sat Apr 24 13:33:04 EDT 2010


http://src.mit.edu/fisheye/changelog/krb5/?cs=23932
Commit By: ghudson
Log Message:
Run Python tests as individual rule commands (friendlier to make -k)
instead of in a loop.  Build runenv.py as part of make fake-install;
it's harmless if Python is unavailable.  Import runenv later in
k5test so that we get a beter error message if make fake-install
hasn't been run.



Changed Files:
U   trunk/src/Makefile.in
U   trunk/src/config/post.in
U   trunk/src/config/pre.in
U   trunk/src/tests/Makefile.in
U   trunk/src/tests/gssapi/Makefile.in
U   trunk/src/util/k5test.py
Modified: trunk/src/Makefile.in
===================================================================
--- trunk/src/Makefile.in	2010-04-24 16:39:49 UTC (rev 23931)
+++ trunk/src/Makefile.in	2010-04-24 17:33:04 UTC (rev 23932)
@@ -106,7 +106,7 @@
 # install::
 #	$(MAKE) $(MFLAGS) install.man
 
-fake-install:
+fake-install: runenv.py
 	$(RM) -r $(FAKEPREFIX)
 	@for i in $(INSTALLMKDIRS); do \
 		$(srcdir)/config/mkinstalldirs util/fakedest$$i; \
@@ -627,13 +627,11 @@
 check-prerecurse: fake-install
 
 # Create a test realm and spawn a shell in an environment pointing to it.
-testrealm: fake-install runenv.py
+testrealm: fake-install
 	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 \

Modified: trunk/src/config/post.in
===================================================================
--- trunk/src/config/post.in	2010-04-24 16:39:49 UTC (rev 23931)
+++ trunk/src/config/post.in	2010-04-24 17:33:04 UTC (rev 23932)
@@ -129,29 +129,13 @@
 ##############################
 
 # Python tests
-check-unix:: check-pytests
+check-unix:: check-pytests- at HAVE_PYTHON@
 
-# Makefile.in should add dependencies to check-pytests for test
-# programs that need to be built before scripts are run.
+# Makefile.in should add rules to check-pytests to execute Python tests.
+check-pytests-yes:: check-pytests
+check-pytests-no::
+check-pytests::
 
-check-pytests:: check-pytests- at HAVE_PYTHON@
-
-check-pytests-yes:
-	@pytests="$(PYTESTS)"; \
-	for t in $$pytests; do \
-		echo PYTHONPATH=$(BUILDTOP):$(top_srcdir)/util \
-			VALGRIND="$(VALGRIND)" \
-			$(PYTHON) $(srcdir)/$$t $(PYTESTFLAGS); \
-		PYTHONPATH=$(BUILDTOP):$(top_srcdir)/util \
-			VALGRIND="$(VALGRIND)" \
-			$(PYTHON) $(srcdir)/$$t $(PYTESTFLAGS) || exit 1; \
-	done
-
-check-pytests-no:
-	@if test -n "$(PYTESTS)"; then \
-		echo "+++ Skipping because Python not available: $(PYTESTS)"; \
-	fi
-
 clean:: clean-$(WHAT)
 
 clean-unix::

Modified: trunk/src/config/pre.in
===================================================================
--- trunk/src/config/pre.in	2010-04-24 16:39:49 UTC (rev 23931)
+++ trunk/src/config/pre.in	2010-04-24 17:33:04 UTC (rev 23932)
@@ -244,6 +244,9 @@
 DEJAFLAGS	= --debug --srcdir $(srcdir) --host $(host)
 RUNTEST		= runtest $(DEJAFLAGS)
 
+RUNPYTEST	= PYTHONPATH=$(BUILDTOP):$(top_srcdir)/util \
+			VALGRIND="$(VALGRIND)" $(PYTHON)
+
 START_SERVERS	= $(STESTDIR)/scripts/start_servers $(TEST_SERVER) $(TEST_PATH)
 START_SERVERS_LOCAL = $(STESTDIR)/scripts/start_servers_local
 
@@ -572,8 +575,7 @@
 # something that looks like an FQDN, with an IPv4 address.
 OFFLINE=no
 
-# Makefile.in should set PYTESTS to a list of Python test scripts to run.
-PYTESTS=
+# Used when running Python tests.
 PYTESTFLAGS=
 
 ##

Modified: trunk/src/tests/Makefile.in
===================================================================
--- trunk/src/tests/Makefile.in	2010-04-24 16:39:49 UTC (rev 23931)
+++ trunk/src/tests/Makefile.in	2010-04-24 17:33:04 UTC (rev 23932)
@@ -2,7 +2,6 @@
 BUILDTOP=$(REL)..
 SUBDIRS = resolve asn.1 create hammer verify gssapi dejagnu shlib \
 	gss-threads misc mkeystash_compat
-PYTESTS = t_general.py t_anonpkinit.py
 
 RUN_SETUP = @KRB5_RUN_ENV@ KRB5_KDC_PROFILE=kdc.conf KRB5_CONFIG=krb5.conf
 KRB5_RUN_ENV= @KRB5_RUN_ENV@
@@ -61,6 +60,10 @@
 	$(RUN_SETUP) $(VALGRIND) ../kadmin/dbutil/kdb5_util $(KADMIN_OPTS) destroy -f
 	$(RM) $(TEST_DB)* stash_file
 
+check-pytests::
+	$(RUNPYTEST) $(srcdir)/t_general.py $(PYTESTFLAGS)
+	$(RUNPYTEST) $(srcdir)/t_anonpkinit.py $(PYTESTFLAGS)
+
 clean::
 	$(RM) kdc.conf
 

Modified: trunk/src/tests/gssapi/Makefile.in
===================================================================
--- trunk/src/tests/gssapi/Makefile.in	2010-04-24 16:39:49 UTC (rev 23931)
+++ trunk/src/tests/gssapi/Makefile.in	2010-04-24 17:33:04 UTC (rev 23932)
@@ -8,11 +8,10 @@
 
 OBJS= t_imp_name.o t_s4u.o t_namingexts.o t_gssexts.o t_spnego.o
 
-PYTESTS= t_gssapi.py
-
 all:: t_imp_name t_s4u t_namingexts t_gssexts t_spnego
 
 check-pytests:: t_spnego
+	$(RUNPYTEST) $(srcdir)/t_gssapi.py $(PYTESTFLAGS)
 
 t_imp_name: t_imp_name.o $(GSS_DEPLIBS) $(KRB5_BASE_DEPLIBS)
 	$(CC_LINK) -o t_imp_name t_imp_name.o $(GSS_LIBS) $(KRB5_BASE_LIBS)

Modified: trunk/src/util/k5test.py
===================================================================
--- trunk/src/util/k5test.py	2010-04-24 16:39:49 UTC (rev 23931)
+++ trunk/src/util/k5test.py	2010-04-24 17:33:04 UTC (rev 23932)
@@ -22,10 +22,14 @@
 
 """A module for krb5 test scripts
 
-Put test script names in the PYTESTS make variable to get them run
-with the appropriate PYTHONPATH during "make check".  Sample test
-script usage:
+To run test scripts during "make check" (if Python 2.4 or later is
+available), add rules like the following to Makeflie.in:
 
+    check-pytests::
+	$(RUNPYTEST) $(srcdir)/t_testname.py $(PYTESTFLAGS)
+
+A sample test script:
+
     from k5test import *
 
     # Run a test program under a variety of configurations:
@@ -304,11 +308,6 @@
 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
@@ -1022,6 +1021,12 @@
 hostname = socket.getfqdn()
 null_input = open(os.devnull, 'r')
 
+# runenv.py is built in the top level by "make fake-install".  Import
+# it now (rather than at the beginning of the file) so that we get a
+# friendly error message from _find_plugins() if "make fake-install"
+# has not been run.
+import runenv
+
 krb5kdc = os.path.join(buildtop, 'kdc', 'krb5kdc')
 kadmind = os.path.join(buildtop, 'kadmin', 'server', 'kadmind')
 kadmin = os.path.join(buildtop, 'kadmin', 'cli', 'kadmin')




More information about the cvs-krb5 mailing list