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

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

krb5 commit: Collect failed command trace logs in k5test

daemon@ATHENA.MIT.EDU (ghudson@mit.edu)
Tue Sep 30 17:06:09 2025

From: ghudson@mit.edu
To: cvs-krb5@mit.edu
Message-Id: <20250930210604.78FBE101C34@krbdev.mit.edu>
Date: Tue, 30 Sep 2025 17:06:04 -0400 (EDT)
MIME-Version: 1.0
Reply-To: krbdev@mit.edu
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Errors-To: cvs-krb5-bounces@mit.edu

https://github.com/krb5/krb5/commit/d908e4b505ccf038602bf8e4bb1540fd1826fc84
commit d908e4b505ccf038602bf8e4bb1540fd1826fc84
Author: Greg Hudson <ghudson@mit.edu>
Date:   Sat Sep 27 02:32:58 2025 -0400

    Collect failed command trace logs in k5test
    
    In _run_cmd(), read the trace file and copy it into the log before
    checking the return code and expected output message.

 src/util/k5test.py | 20 ++++++++++++--------
 1 file changed, 12 insertions(+), 8 deletions(-)

diff --git a/src/util/k5test.py b/src/util/k5test.py
index 5659fed1c..bef645dd0 100644
--- a/src/util/k5test.py
+++ b/src/util/k5test.py
@@ -776,20 +776,24 @@ def _run_cmd(args, env, input=None, expected_code=0, expected_msg=None,
     _stop_or_shell(_stop_after, _shell_after, env, _cmd_index)
     _cmd_index += 1
 
-    # Check the return code and return the output.
+    # Copy trace output into the log if we collected it.
+    if tracefile is not None:
+        with open(tracefile, 'r') as f:
+            trace = f.read()
+        output('*** Trace output for previous command:\n')
+        output(trace)
+
+    # Check the return code.
     if code != expected_code:
         fail('%s failed with code %d.' % (args[0], code))
 
+    # Check for the expected message if given.
     if expected_msg is not None and expected_msg not in outdata:
         fail('Expected string not found in command output: ' + expected_msg)
 
-    if tracefile is not None:
-        with open(tracefile, 'r') as f:
-            trace = f.read()
-        output('*** Trace output for previous command:\n')
-        output(trace)
-        if expected_trace is not None:
-            _check_trace(trace, expected_trace)
+    # Check for expected trace log messages if given.
+    if expected_trace is not None:
+        _check_trace(trace, expected_trace)
 
     return (outdata, trace) if return_trace else outdata
 
_______________________________________________
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