Hi,
I'm working on writing a LKDTM selftest, and I noticed that the output format for the existing selftest tests don't seem to actually conform to the TAP 13 specification[1]. Namely, there is a ton of output between the "ok" and "not ok" lines, in various places for various reasons. IIUC, the spec says these lines should follow the "ok" lines and be (at least) indented to be parsed as YAML.
How does the existing CI do the selftest output parsing? Is there some other spec I should have read for the correct interpretation here? (TAP 13 says this part isn't exactly agreed on yet.)
e.g., I see this right now:
# cd tools/testing/selftests # make --silent -C lib run_tests TAP version 13 selftests: lib: printf.sh ======================================== printf: module test_printf is not found [SKIP] not ok 1..1 selftests: lib: printf.sh [SKIP] selftests: lib: bitmap.sh ======================================== bitmap: module test_bitmap is not found [SKIP] not ok 1..2 selftests: lib: bitmap.sh [SKIP] selftests: lib: prime_numbers.sh ======================================== prime_numbers: module prime_numbers is not found [SKIP] not ok 1..3 selftests: lib: prime_numbers.sh [SKIP]
There is no "plan" line, lots of lines between test lines, and the test numbering is non-spec. I would have expected the following output:
TAP version 13 1..3 lib not ok 1 lib: printf.sh # SKIP module test_printf is not found not ok 2 lib: bitmap.sh # SKIP module test_bitmap is not found not ok 3 lib: prime_numbers.sh # SKIP module prime_numbers is not found
And for output, here's another:
# make --silent -C ipc run_tests TAP version 13 selftests: ipc: msgque ======================================== Pass 0 Fail 0 Xfail 0 Xpass 0 Skip 0 Error 0 1..0 ok 1..1 selftests: ipc: msgque [PASS]
The test-specific output should be after the "ok" line:
TAP version 13 1..1 ipc ok 1 ipc: msgque --- output: |+ Pass 0 Fail 0 Xfail 0 Xpass 0 Skip 0 Error 0 ...
The test runner knows how many tests are going to be run, so the "plan" line can be correct. The ok/not-ok lines can be fixed to avoid the prefixed "1..", and the output during the tests can be captured and indented for valid YAML (above uses "output" to capture the text output with a literal block quote style of "|+"[2]).
It seems like the current output cannot be parsed by things like Test::Harness. The spec is pretty specific about "Any output that is not a version, a plan, a test line, a YAML block, a diagnostic or a bail out is incorrect."
Has this been discussed before? I spent a little time looking but couldn't find an earlier thread...
Thanks!
-Kees
[1] https://testanything.org/tap-version-13-specification.html [2] https://yaml-multiline.info
On 4/8/19 10:46 AM, Kees Cook wrote:
Hi,
I'm working on writing a LKDTM selftest, and I noticed that the output format for the existing selftest tests don't seem to actually conform to the TAP 13 specification[1]. Namely, there is a ton of output between the "ok" and "not ok" lines, in various places for various reasons. IIUC, the spec says these lines should follow the "ok" lines and be (at least) indented to be parsed as YAML.
How does the existing CI do the selftest output parsing? Is there some other spec I should have read for the correct interpretation here? (TAP 13 says this part isn't exactly agreed on yet.)
=============================== It is possible, we missed the making a distinction and adding a diagnostic block, as in the following example.
TAP version 13 1..N ok 1 Description # Directive # Diagnostic --- message: 'Failure message' severity: fail data: got: - 1 - 3 - 2 expect: - 1 - 2 - 3 ... ok 47 Description ok 48 Description =================================
We discussed the nesting TAB13 support a bit, but I don't think we talked much about the diagnostic type messages that tests print that end up between the header and the ok/notok lines.
Can you point me to the TAP parser you are using? I would like to run a few tests and see if we can make it fully TAP13 compliant.
thanks, -- Shuah
On Mon, Apr 8, 2019 at 10:08 AM shuah shuah@kernel.org wrote:
Can you point me to the TAP parser you are using? I would like to run a few tests and see if we can make it fully TAP13 compliant.
Mainly this was just with my eyes, but I was hoping to use "tappy" for summaries and it is quite unhappy with the current state of things:
$ (cd tools/testing/selftests/ && make --silent -C lib run_tests) | tappy FFFF ====================================================================== FAIL: <file=stream> ..1 selftests: lib: printf.sh [SKIP] ----------------------------------------------------------------------
====================================================================== FAIL: <file=stream> ..2 selftests: lib: bitmap.sh [SKIP] ----------------------------------------------------------------------
====================================================================== FAIL: <file=stream> ..3 selftests: lib: prime_numbers.sh [SKIP] ----------------------------------------------------------------------
====================================================================== FAIL: <file=stream> Missing a plan. ----------------------------------------------------------------------
---------------------------------------------------------------------- Ran 4 tests in 0.000s
FAILED (failures=4)
linux-kselftest-mirror@lists.linaro.org