From 732fa298b5797e83b27340837332cce4384d157a Mon Sep 17 00:00:00 2001 From: Martin Quinson Date: Sun, 29 Oct 2023 14:41:10 +0100 Subject: [PATCH] tesh: report when the command got signaled in addition to output mismatch --- tools/tesh/catch-timeout-output.tesh | 1 + tools/tesh/tesh.py | 10 ++++++++++ 2 files changed, 11 insertions(+) diff --git a/tools/tesh/catch-timeout-output.tesh b/tools/tesh/catch-timeout-output.tesh index 227d93c77a..e308580806 100644 --- a/tools/tesh/catch-timeout-output.tesh +++ b/tools/tesh/catch-timeout-output.tesh @@ -14,6 +14,7 @@ > @@ -0,0 +1 @@ > +I crashed > Test suite `(stdin)': NOK (<(stdin):2> output mismatch) +> In addition, <(stdin):2> got signal SIGTERM. $ ${bindir:=.}/tesh diff --git a/tools/tesh/tesh.py b/tools/tesh/tesh.py index 2baa1b31df..bec45335a4 100755 --- a/tools/tesh/tesh.py +++ b/tools/tesh/tesh.py @@ -461,6 +461,16 @@ class Cmd: logs.append("Test suite `{file}': NOK (<{cmd}> output mismatch)".format( file=FileReader().filename, cmd=cmd_name)) + + # Also report any failed return code and/or signal we got in case of output mismatch + if not proc.returncode in self.expect_return: + if proc.returncode >= 0: + logs.append("In addition, <{cmd}> returned code {code}.".format( + cmd=cmd_name, code=proc.returncode)) + else: + logs.append("In addition, <{cmd}> got signal {sig}.".format(cmd=cmd_name, + sig=SIGNALS_TO_NAMES_DICT[-proc.returncode])) + if lock is not None: lock.release() if TeshState().keep: -- 2.20.1