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 0/1] Detecting crashes in TAP output
Date: Wed, 23 Feb 2022 11:34:45 +0100	[thread overview]
Message-ID: <20220223103446.2681293-1-nrb@linux.ibm.com> (raw)

Hi,

I recently had a test on s390x which caused an exception in the guest. As
expected, run_tests.sh reported it as failing:

    FAIL sometest (1 tests)

However, when I turn on the TAP output everything looks like it is fine:

    TAP version 13
    ok 1 - sometest: sometest: some report
    1..1

There is no way to see from the TAP output the test actually had an unexpected
exception. Our internal scripts rely on the TAP output and will thus believe
everything is fine, even though it really isn't.

In the logfile, one can at least see the exception backtrace, but if something
exits silently, there is no indication something went wrong there either.

TAP provides the test plan (the "1..1") as a solution to this problem. It
gives the expected number of test lines if all tests would run. The harness can
count test lines in TAP output and compare this to the number of tests in the
plan and report an error if it doesn't match.

This won't work with kvm-unit-tests, since there really isn't any way to know
how many report()s and thus test lines you will have without actually running
the tests.

That's why I came up with an alternative approach in the patch below. It
adds an additional test line to the TAP output and the logfiles which
states the overall result of a test.

With the attached patch, the TAP output of the test above will now look like
this:

    TAP version 13
    ok 1 - sometest: sometest: some report
    not ok 2 - sometest: (1 tests)
    1..2

This shows something went wrong.

Your feedback or alternative solutions to this problem are welcome.

Nico Boehr (1):
  scripts/runtime: add test result to log and TAP output

 scripts/runtime.bash | 2 ++
 1 file changed, 2 insertions(+)

-- 
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 Nico Boehr [this message]
2022-02-23 10:34 ` [kvm-unit-tests RFC PATCH 1/1] scripts/runtime: add test result to log and TAP output Nico Boehr

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-1-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