Skip to contentSkip to conversation

Documentation: dev-tools: clarify KTAP specification wording

PATCH Superseded [email protected] 4 participants 7 messages Feb 10, 2022

Subsystems (3)

v4 of 5 Superseded Latest is v5 →

lore
Share & tools
lore
#0 lore raw

v4 cover Documentation: dev-tools: clarify KTAP specification wording

From: Frank Rowand <[email protected]>

Clarify ambiguous wording in KTAP specification version 1.

Fix build warnings.

Changes since version 3
- Add Reviewed-by: Shuah Khan
- Add patch 2/2 to fix build warnings

Frank Rowand (2):
Documentation: dev-tools: clarify KTAP specification wording
Documentation: dev-tools: fix KTAP specification build warnings

 Documentation/dev-tools/ktap.rst | 49 +++++++++++++++++++++-----------
 1 file changed, 32 insertions(+), 17 deletions(-)
Signature · 1 line
Frank Rowand <[email protected]>
#1 lore raw

PATCH v4 1/2 Documentation: dev-tools: clarify KTAP specification wording

From: Frank Rowand <[email protected]>

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

---
Changes since version 3
- Add reviewed by Shuah

Changes since version 2
- Add missing quote after word: incorrect
- Add Reviewed-by tags

Changes since version 1
- Explain likely source of "Unknown lines"
- "Unknown line" in nested tests are optionally indented
- Add "Unknown lines" items to differences between TAP & KTAP list

 Documentation/dev-tools/ktap.rst | 24 ++++++++++++++++++------
 1 file changed, 18 insertions(+), 6 deletions(-)
Documentation/dev-tools/ktap.rst +18 -6
index 878530cb9c27..dfb3f10a8b2d 100644
@@ -1,8 +1,8 @@
 .. 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
 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
 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
 ------------
 
@@ -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
 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
 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:
 
 .. code-block::
@@ -225,9 +235,11 @@ 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
-- TODO directive not recognized
+- yaml and json are not recommended in KTAP diagnostic messages
+- TODO directive not recognized in KTAP
 - KTAP allows for an arbitrary number of tests to be nested
+- TAP includes "Unknown lines" in the category of "Anything else"
+- TAP says "Unknown lines" are "incorrect"; KTAP allows "Unknown lines"
 
 The TAP14 specification does permit nested tests, but instead of using another
 nested version line, uses a line of the form
Signature · 1 line
Frank Rowand <[email protected]>
Reviewed-by on v4 1/2
#2 lore raw
Quoted 6 lines · On Wed, Feb 09, 2022 at 08:35:18PM -0600, [email protected] wrote:

From: Frank Rowand <[email protected]>

Add the spec version to the title line.

Explain likely source of "Unknown lines".

Quoted 8 lines

"Unknown lines" in nested tests are optionally indented.

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

Thanks for nailing this down!

Signature · 1 line
Kees Cook
#3 lore raw

PATCH v4 2/2 Documentation: dev-tools: fix KTAP specification build warnings

In reply to [email protected]

From: Frank Rowand <[email protected]>

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

Add missing required argument in code-block directives.

---

Table conversion suggested by Shuah.

Patch 2/2 not previously reviewed, so Reviewed-by tags not provided.

Changes since version 3
- Add this commit (patch 2/2) to the series

---
 Documentation/dev-tools/ktap.rst | 33 +++++++++++++++++---------------
 1 file changed, 18 insertions(+), 15 deletions(-)
Documentation/dev-tools/ktap.rst +18 -15
index dfb3f10a8b2d..5ee735c6687f 100644
@@ -68,7 +68,7 @@ Test case result lines
 Test case result lines indicate the final status of a test.
 They are required and must have the format:
 
-.. code-block::
+.. code-block:: none
 
 	<result> <number> [<description>][ # [<directive>] [<diagnostic data>]]
 
@@ -117,32 +117,32 @@ separator.
 
 Example result lines include:
 
-.. code-block::
+.. code-block:: none
 
 	ok 1 test_case_name
 
 The test "test_case_name" passed.
 
-.. code-block::
+.. code-block:: none
 
 	not ok 1 test_case_name
 
 The test "test_case_name" failed.
 
-.. code-block::
+.. code-block:: none
 
 	ok 1 test # SKIP necessary dependency unavailable
 
 The test "test" was SKIPPED with the diagnostic message "necessary dependency
 unavailable".
 
-.. code-block::
+.. code-block:: none
 
 	not ok 1 test # TIMEOUT 30 seconds
 
 The test "test" timed out, with diagnostic data "30 seconds".
 
-.. code-block::
+.. code-block:: none
 
 	ok 5 check return code # rcode=0
 
@@ -202,7 +202,7 @@ allowed to be either indented or not indented.
 
 An example of a test with two nested subtests:
 
-.. code-block::
+.. code-block:: none
 
 	KTAP version 1
 	1..1
@@ -215,7 +215,7 @@ An example of a test with two nested subtests:
 
 An example format with multiple levels of nested testing:
 
-.. code-block::
+.. code-block:: none
 
 	KTAP version 1
 	1..2
@@ -234,12 +234,15 @@ An example format with multiple levels of nested testing:
 Major differences between TAP and KTAP
 --------------------------------------
 
-Note the major differences between the TAP and KTAP specification:
-- yaml and json are not recommended in KTAP diagnostic messages
-- TODO directive not recognized in KTAP
-- KTAP allows for an arbitrary number of tests to be nested
-- TAP includes "Unknown lines" in the category of "Anything else"
-- TAP says "Unknown lines" are "incorrect"; KTAP allows "Unknown lines"
+==================================================   =========  ===============
+Feature                                              TAP        KTAP
+==================================================   =========  ===============
+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
 nested version line, uses a line of the form
@@ -247,7 +250,7 @@ nested version line, uses a line of the form
 
 Example KTAP output
 --------------------
-.. code-block::
+.. code-block:: none
 
 	KTAP version 1
 	1..1
Signature · 1 line
Frank Rowand <[email protected]>
Reviewed-by on v4 2/2
#4 lore raw

Re: [PATCH v4 2/2] Documentation: dev-tools: fix KTAP specification build warnings

Quoted 13 lines · On Thu, Feb 10, 2022 at 10:35 AM <[email protected]> wrote:

From: Frank Rowand <[email protected]>

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

Add missing required argument in code-block directives.

---

Table conversion suggested by Shuah.

Quoted 7 lines

Patch 2/2 not previously reviewed, so Reviewed-by tags not provided.

Changes since version 3
- Add this commit (patch 2/2) to the series

---

The table looks good to me, the "none" argument in code-block directives is already fixed in another patch.

The table bits are:

Cheers,
-- David

Documentation/dev-tools/ktap.rst Test case result lines · line 71

Quoted 13 lines
 Documentation/dev-tools/ktap.rst | 33 +++++++++++++++++---------------
 1 file changed, 18 insertions(+), 15 deletions(-)
Documentation/dev-tools/ktap.rst +1 -1
index dfb3f10a8b2d..5ee735c6687f 100644
@@ -68,7 +68,7 @@ Test case result lines
 Test case result lines indicate the final status of a test.
 They are required and must have the format:
 
-.. code-block::
+.. code-block:: none

These code-block changes were already submitted in:
https://lore.kernel.org/lkml/[email protected]/T/

Quoted 68 lines
Documentation/dev-tools/ktap.rst +7 -12
        <result> <number> [<description>][ # [<directive>] [<diagnostic data>]]
 
@@ -117,32 +117,32 @@ separator.
 
 Example result lines include:
 
-.. code-block::
+.. code-block:: none
 
        ok 1 test_case_name
 
 The test "test_case_name" passed.
 
-.. code-block::
+.. code-block:: none
 
        not ok 1 test_case_name
 
 The test "test_case_name" failed.
 
-.. code-block::
+.. code-block:: none
 
        ok 1 test # SKIP necessary dependency unavailable
 
 The test "test" was SKIPPED with the diagnostic message "necessary dependency
 unavailable".
 
-.. code-block::
+.. code-block:: none
 
        not ok 1 test # TIMEOUT 30 seconds
 
 The test "test" timed out, with diagnostic data "30 seconds".
 
-.. code-block::
+.. code-block:: none
 
        ok 5 check return code # rcode=0
 
@@ -202,7 +202,7 @@ allowed to be either indented or not indented.
 
 An example of a test with two nested subtests:
 
-.. code-block::
+.. code-block:: none
 
        KTAP version 1
        1..1
@@ -215,7 +215,7 @@ An example of a test with two nested subtests:
 
 An example format with multiple levels of nested testing:
 
-.. code-block::
+.. code-block:: none
 
        KTAP version 1
        1..2
@@ -234,12 +234,15 @@ An example format with multiple levels of nested testing:
 Major differences between TAP and KTAP
 --------------------------------------
 
-Note the major differences between the TAP and KTAP specification:
-- yaml and json are not recommended in KTAP diagnostic messages
-- TODO directive not recognized in KTAP
-- KTAP allows for an arbitrary number of tests to be nested
-- TAP includes "Unknown lines" in the category of "Anything else"

Documentation/dev-tools/ktap.rst An example format with multiple levels of nested testing: · line 245

Quoted 10 lines
Documentation/dev-tools/ktap.rst +9 -1
-- TAP says "Unknown lines" are "incorrect"; KTAP allows "Unknown lines"
+==================================================   =========  ===============
+Feature                                              TAP        KTAP
+==================================================   =========  ===============
+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
+==================================================   =========  ===============

This looks good to me, thanks!

Quoted 15 lines
Documentation/dev-tools/ktap.rst +1 -2
 The TAP14 specification does permit nested tests, but instead of using another
 nested version line, uses a line of the form
@@ -247,7 +250,7 @@ nested version line, uses a line of the form
 
 Example KTAP output
 --------------------
-.. code-block::
+.. code-block:: none
 
        KTAP version 1
        1..1
--

Frank Rowand <[email protected]>

maintainer Reviewed-by on v4 2/2
#5 lore raw

Re: [PATCH v4 2/2] Documentation: dev-tools: fix KTAP specification build warnings

In reply to [email protected]
Quoted 115 lines · On 2/9/22 7:35 PM, [email protected] wrote:

From: Frank Rowand <[email protected]>

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

Add missing required argument in code-block directives.

---

Table conversion suggested by Shuah.

Patch 2/2 not previously reviewed, so Reviewed-by tags not provided.

Changes since version 3
- Add this commit (patch 2/2) to the series

---
  Documentation/dev-tools/ktap.rst | 33 +++++++++++++++++---------------
  1 file changed, 18 insertions(+), 15 deletions(-)
Documentation/dev-tools/ktap.rst +17 -14
index dfb3f10a8b2d..5ee735c6687f 100644
@@ -68,7 +68,7 @@ Test case result lines
  Test case result lines indicate the final status of a test.
  They are required and must have the format:
 
-.. code-block::
+.. code-block:: none
 
  	<result> <number> [<description>][ # [<directive>] [<diagnostic data>]]
 
@@ -117,32 +117,32 @@ separator.
 
  Example result lines include:
 
-.. code-block::
+.. code-block:: none
 
  	ok 1 test_case_name
 
  The test "test_case_name" passed.
 
-.. code-block::
+.. code-block:: none
 
  	not ok 1 test_case_name
 
  The test "test_case_name" failed.
 
-.. code-block::
+.. code-block:: none
 
  	ok 1 test # SKIP necessary dependency unavailable
 
  The test "test" was SKIPPED with the diagnostic message "necessary dependency
  unavailable".
 
-.. code-block::
+.. code-block:: none
 
  	not ok 1 test # TIMEOUT 30 seconds
 
  The test "test" timed out, with diagnostic data "30 seconds".
 
-.. code-block::
+.. code-block:: none
 
  	ok 5 check return code # rcode=0
 
@@ -202,7 +202,7 @@ allowed to be either indented or not indented.
 
  An example of a test with two nested subtests:
 
-.. code-block::
+.. code-block:: none
 
  	KTAP version 1
  	1..1
@@ -215,7 +215,7 @@ An example of a test with two nested subtests:
 
  An example format with multiple levels of nested testing:
 
-.. code-block::
+.. code-block:: none
 
  	KTAP version 1
  	1..2
@@ -234,12 +234,15 @@ An example format with multiple levels of nested testing:
  Major differences between TAP and KTAP
  --------------------------------------
 
-Note the major differences between the TAP and KTAP specification:
-- yaml and json are not recommended in KTAP diagnostic messages
-- TODO directive not recognized in KTAP
-- KTAP allows for an arbitrary number of tests to be nested
-- TAP includes "Unknown lines" in the category of "Anything else"
-- TAP says "Unknown lines" are "incorrect"; KTAP allows "Unknown lines"
+==================================================   =========  ===============
+Feature                                              TAP        KTAP
+==================================================   =========  ===============
+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
  nested version line, uses a line of the form

Documentation/dev-tools/ktap.rst nested version line, uses a line of the form · line 256

Quoted 8 lines
Documentation/dev-tools/ktap.rst +1 -1
@@ -247,7 +250,7 @@ nested version line, uses a line of the form
 
  Example KTAP output
  --------------------
-.. code-block::
+.. code-block:: none
 
  	KTAP version 1
  	1..1

Table looks good. Thanks for adding it. The two patches could be collapsed into one perhaps? Either way:

thanks,
-- Shuah

Reviewed-by on v4 2/2
#6 lore raw

Re: [PATCH v4 2/2] Documentation: dev-tools: fix KTAP specification build warnings

In reply to [email protected]
Quoted 10 lines · On Wed, Feb 09, 2022 at 08:35:19PM -0600, [email protected] wrote:

From: Frank Rowand <[email protected]>

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

Add missing required argument in code-block directives.

---

Quoted 8 lines

Table conversion suggested by Shuah.

Patch 2/2 not previously reviewed, so Reviewed-by tags not provided.

Changes since version 3
- Add this commit (patch 2/2) to the series

Signature · 1 line
Kees Cook