[30153] in CVS-changelog-for-Kerberos-V5

home help back first fref pref prev next nref lref last post

krb5 commit: Add k5test mark() function

daemon@ATHENA.MIT.EDU (Greg Hudson)
Sun Apr 22 13:11:14 2018

Date: Sun, 22 Apr 2018 13:11:01 -0400
From: Greg Hudson <ghudson@mit.edu>
Message-Id: <201804221711.w3MHB1nY032107@drugstore.mit.edu>
To: cvs-krb5@mit.edu
Reply-To: krbdev@mit.edu
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Errors-To: cvs-krb5-bounces@mit.edu

https://github.com/krb5/krb5/commit/4e813204ac3dace93297f47d64dfc0aaecc370f8
commit 4e813204ac3dace93297f47d64dfc0aaecc370f8
Author: Greg Hudson <ghudson@mit.edu>
Date:   Wed Apr 18 19:21:40 2018 -0400

    Add k5test mark() function
    
    Make it easier to locate a failing command in long Python test scripts
    by allowing the script to output marks, and displaying the most recent
    mark with command failures.

 src/util/k5test.py |   14 ++++++++++++++
 1 files changed, 14 insertions(+), 0 deletions(-)

diff --git a/src/util/k5test.py b/src/util/k5test.py
index 4d30baf..bc32877 100644
--- a/src/util/k5test.py
+++ b/src/util/k5test.py
@@ -141,6 +141,11 @@ Scripts may use the following functions and variables:
   added newline) in testlog, and write it to stdout if running
   verbosely.
 
+* mark(message): Place a divider message in the test output, to make
+  it easier to determine what part of the test script a command
+  invocation belongs to.  The last mark message will also be displayed
+  if a command invocation fails.  Do not include a newline in message.
+
 * which(progname): Return the location of progname in the executable
   path, or None if it is not found.
 
@@ -376,6 +381,8 @@ def fail(msg):
     """Print a message and exit with failure."""
     global _current_pass
     print "*** Failure:", msg
+    if _last_mark:
+        print "*** Last mark: %s" % _last_mark
     if _last_cmd:
         print "*** Last command (#%d): %s" % (_cmd_index - 1, _last_cmd)
     if _last_cmd_output:
@@ -392,6 +399,12 @@ def success(msg):
     _success = True
 
 
+def mark(msg):
+    global _last_mark
+    output('\n====== %s ======\n' % msg)
+    _last_mark = msg
+
+
 def skipped(whatmsg, whymsg):
     output('*** Skipping: %s: %s\n' % (whatmsg, whymsg), force_verbose=True)
     f = open(os.path.join(buildtop, 'skiptests'), 'a')
@@ -1275,6 +1288,7 @@ atexit.register(_onexit)
 signal.signal(signal.SIGINT, _onsigint)
 _outfile = open('testlog', 'w')
 _cmd_index = 1
+_last_mark = None
 _last_cmd = None
 _last_cmd_output = None
 buildtop = _find_buildtop()
_______________________________________________
cvs-krb5 mailing list
cvs-krb5@mit.edu
https://mailman.mit.edu/mailman/listinfo/cvs-krb5

home help back first fref pref prev next nref lref last post