krb5 commit: Add framework for tracking skipped tests

Greg Hudson ghudson at mit.edu
Thu Jan 22 19:59:33 EST 2015


https://github.com/krb5/krb5/commit/fa93d60a7af86e37eb25c31349cf8a7207d0c41e
commit fa93d60a7af86e37eb25c31349cf8a7207d0c41e
Author: Greg Hudson <ghudson at mit.edu>
Date:   Sat Jan 3 20:09:11 2015 -0500

    Add framework for tracking skipped tests
    
    In k5test.py, add functions skipped() and skip_rest() which output a
    message about skipping tests (even without the verbose flag) and also
    add a note to the "skiptests" file at the top of the build tree.  In
    the top-level make check, empty out skiptests at the beginning and
    display it at the end.  Add a subsitution for the skiptests file to
    pre.in so that other makefiles can append to it.

 src/Makefile.in    |    5 +++++
 src/config/pre.in  |    1 +
 src/util/k5test.py |   22 ++++++++++++++++++++++
 3 files changed, 28 insertions(+), 0 deletions(-)

diff --git a/src/Makefile.in b/src/Makefile.in
index 60a17d9..31bb54a 100644
--- a/src/Makefile.in
+++ b/src/Makefile.in
@@ -539,6 +539,11 @@ install-windows::
 	copy windows\leash\htmlhelp\*.chm "$(KRB_INSTALL_DIR)\bin\."
 
 check-prerecurse: runenv.py
+	$(RM) $(SKIPTESTS)
+	touch $(SKIPTESTS)
+
+check-postrecurse:
+	cat $(SKIPTESTS)
 
 # Create a test realm and spawn a shell in an environment pointing to it.
 # If CROSSNUM is set, create that many fully connected test realms and
diff --git a/src/config/pre.in b/src/config/pre.in
index c7cff81..401d1c6 100644
--- a/src/config/pre.in
+++ b/src/config/pre.in
@@ -226,6 +226,7 @@ KRB5_INCSUBDIRS = \
 # Macros used by the KADM5 (OV-based) unit test system.
 # XXX check which of these are actually used!
 #
+SKIPTESTS	= $(BUILDTOP)/skiptests
 TESTDIR		= $(BUILDTOP)/kadmin/testing
 STESTDIR	= $(top_srcdir)/kadmin/testing
 ENV_SETUP	= $(TESTDIR)/scripts/env-setup.sh
diff --git a/src/util/k5test.py b/src/util/k5test.py
index 4a10974..13a00e9 100644
--- a/src/util/k5test.py
+++ b/src/util/k5test.py
@@ -129,6 +129,14 @@ Scripts may use the following functions and variables:
   the operations tested; it will only be displayed (with leading
   marker and trailing newline) if the script is running verbosely.
 
+* skipped(whatmsg, whymsg): Indicate that some tests were skipped.
+  whatmsg should concisely say what was skipped (e.g. "LDAP KDB
+  tests") and whymsg should give the reason (e.g. "because LDAP module
+  not built").
+
+* skip_rest(message): Indicate that some tests were skipped, then exit
+  the current script.
+
 * output(message, force_verbose=False): Place message (without any
   added newline) in testlog, and write it to stdout if running
   verbosely.
@@ -373,6 +381,20 @@ def success(msg):
     _success = True
 
 
+def skipped(whatmsg, whymsg):
+    output('*** Skipping: %s: %s\n' % (whatmsg, whymsg), force_verbose=True)
+    f = open(os.path.join(buildtop, 'skiptests'), 'a')
+    f.write('Skipped %s: %s\n' % (whatmsg, whymsg))
+    f.close()
+
+
+def skip_rest(whatmsg, whymsg):
+    global _success
+    skipped(whatmsg, whymsg)
+    _success = True
+    sys.exit(0)
+
+
 def output(msg, force_verbose=False):
     """Output a message to testlog, and to stdout if running verbosely."""
     _outfile.write(msg)


More information about the cvs-krb5 mailing list