public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: Nico Boehr <nrb@linux.ibm.com>
To: kvm@vger.kernel.org
Cc: frankja@linux.ibm.com, imbrenda@linux.ibm.com, thuth@redhat.com,
	drjones@redhat.com, pbonzini@redhat.com
Subject: [kvm-unit-tests RFC PATCH 1/1] scripts/runtime: add test result to log and TAP output
Date: Wed, 23 Feb 2022 11:34:46 +0100	[thread overview]
Message-ID: <20220223103446.2681293-2-nrb@linux.ibm.com> (raw)
In-Reply-To: <20220223103446.2681293-1-nrb@linux.ibm.com>

Currently, when a test exits prematurely for whatever reason (crash, guest
exception, ...) the test is correctly reported as FAIL by run_tests.sh - even
when all report()s up to that point passed.

The failure is reported by print_result which checks (among others) the exit
code of the arch-specific run script.

But, as soon as one enables the TAP output in run_tests.sh, there is no way to
see that any more, as the print_result is discarded and only the run script's
output is converted to TAP.

External test runners relying on TAP output will thus believe everything is
fine even though we got a crash.

The same also applies to the logfiles.

As a simple fix, have print_result also print to RUNTIME_log_stderr.  For each
test, we will then get an additional test line in the TAP which reports the
test's result:

  not ok 36 - css: (35 tests, 2 unexpected failures)

The log files will also contain the result:

  FAIL: (35 tests, 2 unexpected failures)

This makes it easy to see whether we had a premature exit in the test. The
disadvantage being the number of test lines in the TAP will no longer match the
number of report()s in a test.

Signed-off-by: Nico Boehr <nrb@linux.ibm.com>
---
 scripts/runtime.bash | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/scripts/runtime.bash b/scripts/runtime.bash
index 6d5fced94246..7bb70d50012a 100644
--- a/scripts/runtime.bash
+++ b/scripts/runtime.bash
@@ -60,8 +60,10 @@ function print_result()
 
     if [ -z "$reason" ]; then
         echo "`$status` $testname $summary"
+        RUNTIME_log_stderr "$testname" <<< "$status: $summary"
     else
         echo "`$status` $testname ($reason)"
+        RUNTIME_log_stderr "$testname" <<< "$status: $reason"
     fi
 }
 
-- 
2.31.1


      reply	other threads:[~2022-02-23 10:34 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-23 10:34 [kvm-unit-tests RFC PATCH 0/1] Detecting crashes in TAP output Nico Boehr
2022-02-23 10:34 ` Nico Boehr [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220223103446.2681293-2-nrb@linux.ibm.com \
    --to=nrb@linux.ibm.com \
    --cc=drjones@redhat.com \
    --cc=frankja@linux.ibm.com \
    --cc=imbrenda@linux.ibm.com \
    --cc=kvm@vger.kernel.org \
    --cc=pbonzini@redhat.com \
    --cc=thuth@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox