diff mbox series

[net-next] selftests: net: report output format as TAP 13 in Python tests

Message ID 20250228180007.83325-1-kuba@kernel.org (mailing list archive)
State Accepted
Commit d110dbf1490b130f70fd0cd73a658ff495bc75e0
Delegated to: Netdev Maintainers
Headers show
Series [net-next] selftests: net: report output format as TAP 13 in Python tests | expand

Checks

Context Check Description
netdev/series_format success Single patches do not need cover letters
netdev/tree_selection success Clearly marked for net-next
netdev/ynl success Generated files up to date; no warnings/errors; no diff in generated;
netdev/fixes_present success Fixes tag not required for -next series
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 0 this patch: 0
netdev/build_tools success Errors and warnings before: 26 (+1) this patch: 26 (+1)
netdev/cc_maintainers success CCed 9 of 9 maintainers
netdev/build_clang success Errors and warnings before: 0 this patch: 0
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/deprecated_api success None detected
netdev/check_selftest success No net selftest shell script
netdev/verify_fixes success No Fixes tag
netdev/build_allmodconfig_warn success Errors and warnings before: 0 this patch: 0
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 24 lines checked
netdev/build_clang_rust success No Rust files in patch. Skipping build
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0
netdev/contest success net-next-2025-03-01--03-00 (tests: 893)

Commit Message

Jakub Kicinski Feb. 28, 2025, 6 p.m. UTC
The Python lib based tests report that they are producing
"KTAP version 1", but really we aren't making use of any
KTAP features, like subtests. Our output is plain TAP.

Report TAP 13 instead of KTAP 1, this is what mptcp tests do,
and what NIPA knows how to parse best. For HW testing we need
precise subtest result tracking.

Signed-off-by: Jakub Kicinski <kuba@kernel.org>
---
CC: shuah@kernel.org
CC: petrm@nvidia.com
CC: matttbe@kernel.org
CC: willemb@google.com
CC: linux-kselftest@vger.kernel.org
---
 tools/testing/selftests/drivers/net/README.rst | 4 ++--
 tools/testing/selftests/net/lib/py/ksft.py     | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

Comments

Matthieu Baerts March 1, 2025, 10:52 a.m. UTC | #1
Hi Jakub,

On 28/02/2025 19:00, Jakub Kicinski wrote:
> The Python lib based tests report that they are producing
> "KTAP version 1", but really we aren't making use of any
> KTAP features, like subtests. Our output is plain TAP.
> 
> Report TAP 13 instead of KTAP 1, this is what mptcp tests do,

Indeed, and also TC tests, and all the ones using kselftest_harness.h I
think.

> and what NIPA knows how to parse best. For HW testing we need
> precise subtest result tracking.

I guess the best would be to have the kselftests infrastructure fully
supporting KTAP, and then have a way for each test to print subtests
correctly, not nested in the comments like it is done for the moment.
But that looks harder to put in place, and the current solution is used
in a few areas.

Good idea to switch to 'TAP version 13' for the moment, and re-use the
existing parsing in NIPA!

Acked-by: Matthieu Baerts (NGI0) <matttbe@kernel.org>

Cheers,
Matt
Jakub Kicinski March 2, 2025, 6:50 p.m. UTC | #2
On Sat, 1 Mar 2025 11:52:06 +0100 Matthieu Baerts wrote:
> On 28/02/2025 19:00, Jakub Kicinski wrote:
> > The Python lib based tests report that they are producing
> > "KTAP version 1", but really we aren't making use of any
> > KTAP features, like subtests. Our output is plain TAP.
> > 
> > Report TAP 13 instead of KTAP 1, this is what mptcp tests do,  
> 
> Indeed, and also TC tests, and all the ones using kselftest_harness.h I
> think.
> 
> > and what NIPA knows how to parse best. For HW testing we need
> > precise subtest result tracking.  
> 
> I guess the best would be to have the kselftests infrastructure fully
> supporting KTAP, and then have a way for each test to print subtests
> correctly, not nested in the comments like it is done for the moment.
> But that looks harder to put in place, and the current solution is used
> in a few areas.

Right. So for additional context for folks less familiar with selftests
the two minor inconveniences which made "supporting KTAP" a less
exciting option are: (a) we run make run_tests which wraps things
in an outer TAP, so we'd end up with a hybrid, anyway; (b) NIPA
only supports one level of subtests.

Thanks for the review!
patchwork-bot+netdevbpf@kernel.org March 3, 2025, 11:36 p.m. UTC | #3
Hello:

This patch was applied to netdev/net-next.git (main)
by Jakub Kicinski <kuba@kernel.org>:

On Fri, 28 Feb 2025 10:00:07 -0800 you wrote:
> The Python lib based tests report that they are producing
> "KTAP version 1", but really we aren't making use of any
> KTAP features, like subtests. Our output is plain TAP.
> 
> Report TAP 13 instead of KTAP 1, this is what mptcp tests do,
> and what NIPA knows how to parse best. For HW testing we need
> precise subtest result tracking.
> 
> [...]

Here is the summary with links:
  - [net-next] selftests: net: report output format as TAP 13 in Python tests
    https://git.kernel.org/netdev/net-next/c/d110dbf1490b

You are awesome, thank you!
diff mbox series

Patch

diff --git a/tools/testing/selftests/drivers/net/README.rst b/tools/testing/selftests/drivers/net/README.rst
index 3b6a29e6564b..eb838ae94844 100644
--- a/tools/testing/selftests/drivers/net/README.rst
+++ b/tools/testing/selftests/drivers/net/README.rst
@@ -107,7 +107,7 @@  Example
   1..1
   # timeout set to 45
   # selftests: drivers/net: ping.py
-  # KTAP version 1
+  # TAP version 13
   # 1..3
   # ok 1 ping.test_v4
   # ok 2 ping.test_v6
@@ -128,7 +128,7 @@  Example
 Run the test::
 
   [/root] # ./ksft-net-drv/drivers/net/ping.py
-  KTAP version 1
+  TAP version 13
   1..3
   ok 1 ping.test_v4
   ok 2 ping.test_v6 # SKIP Test requires IPv6 connectivity
diff --git a/tools/testing/selftests/net/lib/py/ksft.py b/tools/testing/selftests/net/lib/py/ksft.py
index fd23349fa8ca..3cfad0fd4570 100644
--- a/tools/testing/selftests/net/lib/py/ksft.py
+++ b/tools/testing/selftests/net/lib/py/ksft.py
@@ -207,7 +207,7 @@  KSFT_DISRUPTIVE = True
 
     totals = {"pass": 0, "fail": 0, "skip": 0, "xfail": 0}
 
-    print("KTAP version 1")
+    print("TAP version 13")
     print("1.." + str(len(cases)))
 
     global KSFT_RESULT