kselftest: fix TAP output for skipped tests
authorPaolo Bonzini <pbonzini@redhat.com>
Tue, 23 Jun 2020 00:15:42 +0000 (20:15 -0400)
committerShuah Khan <skhan@linuxfoundation.org>
Mon, 6 Jul 2020 21:17:59 +0000 (15:17 -0600)
commitb85d387c9b091953d5e8ac4c72af6747c1a554e3
treeab6503c28cbe9f4b78bd74d751f3fc1ff87d5ac6
parent9ebcfadb0610322ac537dd7aa5d9cbc2b2894c68
kselftest: fix TAP output for skipped tests

According to the TAP specification, a skipped test must be marked as "ok"
and annotated with the SKIP directive, for example

   ok 23 # skip Insufficient flogiston pressure.
   (https://testanything.org/tap-specification.html)

Fix the kselftest infrastructure to match this.

For ksft_exit_skip, it is preferrable to emit a dummy plan line that
indicates the whole test was skipped, but this is not always possible
because of ksft_exit_skip being used as a "shortcut" by the tests.
In that case, print the test counts and a normal "ok" line.  The format
is now the same independent of whether msg is NULL or not (but it is
never NULL in any caller right now).

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
tools/testing/selftests/kselftest.h
tools/testing/selftests/kselftest/runner.sh