From: Greg Hudson Date: Sun, 4 Jan 2015 01:09:11 +0000 (-0500) Subject: Add framework for tracking skipped tests X-Git-Tag: krb5-1.14-alpha1~182 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=fa93d60a7af86e37eb25c31349cf8a7207d0c41e;p=thirdparty%2Fkrb5.git 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. --- diff --git a/src/Makefile.in b/src/Makefile.in index 60a17d913f..31bb54a7dd 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 c7cff814c6..401d1c612b 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 4a10974cef..13a00e9bab 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)