Documentation: dev-tools: clarify KTAP specification wording

Add the spec version to the title line.

Explain likely source of "Unknown lines".

"Unknown lines" in nested tests are optionally indented.

Add "Unknown lines" items to differences between TAP & KTAP list

Convert "Major differences between TAP and KTAP" from a bullet list
to a table.  The bullet list was being formatted as a single
paragraph.

Reviewed-by: Tim Bird <Tim.Bird@sony.com>
Reviewed-by: David Gow <davidgow@google.com>
Reviewed-by: Shuah Khan <skhan@linuxfoundation.org>
Signed-off-by: Frank Rowand <frank.rowand@sony.com>
Reviewed-by: Brendan Higgins <brendanhiggins@google.com>
Link: https://lore.kernel.org/r/20220210233630.3304495-1-frowand.list@gmail.com
Signed-off-by: Jonathan Corbet <corbet@lwn.net>
This commit is contained in:
Frank Rowand 2022-02-10 17:36:30 -06:00 committed by Jonathan Corbet
parent 6b22ce002f
commit a693396fd5
1 changed files with 23 additions and 8 deletions

View File

@ -1,8 +1,8 @@
.. SPDX-License-Identifier: GPL-2.0 .. SPDX-License-Identifier: GPL-2.0
======================================== ===================================================
The Kernel Test Anything Protocol (KTAP) The Kernel Test Anything Protocol (KTAP), version 1
======================================== ===================================================
TAP, or the Test Anything Protocol is a format for specifying test results used TAP, or the Test Anything Protocol is a format for specifying test results used
by a number of projects. It's website and specification are found at this `link by a number of projects. It's website and specification are found at this `link
@ -174,6 +174,13 @@ There may be lines within KTAP output that do not follow the format of one of
the four formats for lines described above. This is allowed, however, they will the four formats for lines described above. This is allowed, however, they will
not influence the status of the tests. not influence the status of the tests.
This is an important difference from TAP. Kernel tests may print messages
to the system console or a log file. Both of these destinations may contain
messages either from unrelated kernel or userspace activity, or kernel
messages from non-test code that is invoked by the test. The kernel code
invoked by the test likely is not aware that a test is in progress and
thus can not print the message as a diagnostic message.
Nested tests Nested tests
------------ ------------
@ -186,10 +193,13 @@ starting with another KTAP version line and test plan, and end with the overall
result. If one of the subtests fail, for example, the parent test should also result. If one of the subtests fail, for example, the parent test should also
fail. fail.
Additionally, all result lines in a subtest should be indented. One level of Additionally, all lines in a subtest should be indented. One level of
indentation is two spaces: " ". The indentation should begin at the version indentation is two spaces: " ". The indentation should begin at the version
line and should end before the parent test's result line. line and should end before the parent test's result line.
"Unknown lines" are not considered to be lines in a subtest and thus are
allowed to be either indented or not indented.
An example of a test with two nested subtests: An example of a test with two nested subtests:
.. code-block:: .. code-block::
@ -224,10 +234,15 @@ An example format with multiple levels of nested testing:
Major differences between TAP and KTAP Major differences between TAP and KTAP
-------------------------------------- --------------------------------------
Note the major differences between the TAP and KTAP specification: ================================================== ========= ===============
- yaml and json are not recommended in diagnostic messages Feature TAP KTAP
- TODO directive not recognized ================================================== ========= ===============
- KTAP allows for an arbitrary number of tests to be nested yaml and json in diagnosic message ok not recommended
TODO directive ok not recognized
allows an arbitrary number of tests to be nested no yes
"Unknown lines" are in category of "Anything else" yes no
"Unknown lines" are incorrect allowed
================================================== ========= ===============
The TAP14 specification does permit nested tests, but instead of using another The TAP14 specification does permit nested tests, but instead of using another
nested version line, uses a line of the form nested version line, uses a line of the form