mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH net 0/2] selftests: drv-net: psp: fix templated test names in psp.py
@ 2025-12-16 14:21 Daniel Zahka
  2025-12-16 14:21 ` [PATCH net 1/2] selftests: drv-net: psp: fix templated test names in psp_ip_ver_test_builder() Daniel Zahka
  2025-12-16 14:21 ` [PATCH net 2/2] selftests: drv-net: psp: fix test names in ipver_test_builder() Daniel Zahka
  0 siblings, 2 replies; 3+ messages in thread
From: Daniel Zahka @ 2025-12-16 14:21 UTC (permalink / raw)
  To: Andrew Lunn, David S. Miller, Eric Dumazet, Jakub Kicinski,
	Paolo Abeni, Shuah Khan, Willem de Bruijn
  Cc: netdev, linux-kselftest, linux-kernel, Daniel Zahka

The templated test names in psp.py had a bug that was not exposed
until 80970e0fc07e ("selftests: net: py: extract the case generation
logic") changed the order of test case evaluation and test case name
extraction.

The test cases created in psp_ip_ver_test_builder() and
ipver_test_builder() were only assigning formatted names to the test
cases they returned, when the test itself was run. This series moves
the test case naming to the point where the test function is created.

Using netdevsim psp:
Before:
./tools/testing/selftests/drivers/net/psp.py
  TAP version 13
  1..28
  ok 1 psp.test_case
  ok 2 psp.test_case
  ok 3 psp.test_case
  ok 4 psp.test_case
  ok 5 psp.test_case
  ok 6 psp.test_case
  ok 7 psp.test_case
  ok 8 psp.test_case
  ok 9 psp.test_case
  ok 10 psp.test_case
  ok 11 psp.dev_list_devices
  ...
  ok 28 psp.removal_device_bi
  # Totals: pass:28 fail:0 xfail:0 xpass:0 skip:0 error:0
  # 
  # Responder logs (0):
  # STDERR:
  #  Set PSP enable on device 3 to 0xf
  #  Set PSP enable on device 3 to 0x0

After:
./tools/testing/selftests/drivers/net/psp.py
  TAP version 13
  1..28
  ok 1 psp.data_basic_send_v0_ip4
  ok 2 psp.data_basic_send_v0_ip6
  ok 3 psp.data_basic_send_v1_ip4
  ok 4 psp.data_basic_send_v1_ip6
  ok 5 psp.data_basic_send_v2_ip4
  ok 6 psp.data_basic_send_v2_ip6
  ok 7 psp.data_basic_send_v3_ip4
  ok 8 psp.data_basic_send_v3_ip6
  ok 9 psp.data_mss_adjust_ip4
  ok 10 psp.data_mss_adjust_ip6
  ok 11 psp.dev_list_devices
  ...
  ok 28 psp.removal_device_bi
  # Totals: pass:28 fail:0 xfail:0 xpass:0 skip:0 error:0
  # 
  # Responder logs (0):
  # STDERR:
  #  Set PSP enable on device 3 to 0xf
  #  Set PSP enable on device 3 to 0x0

Signed-off-by: Daniel Zahka <daniel.zahka@gmail.com>
---
Daniel Zahka (2):
      selftests: drv-net: psp: fix templated test names in psp_ip_ver_test_builder()
      selftests: drv-net: psp: fix test names in ipver_test_builder()

 tools/testing/selftests/drivers/net/psp.py | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
---
base-commit: 885bebac9909994050bbbeed0829c727e42bd1b7
change-id: 20251212-psp-test-fix-f0816c40a2c1

Best regards,
-- 
Daniel Zahka <daniel.zahka@gmail.com>


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH net 1/2] selftests: drv-net: psp: fix templated test names in psp_ip_ver_test_builder()
  2025-12-16 14:21 [PATCH net 0/2] selftests: drv-net: psp: fix templated test names in psp.py Daniel Zahka
@ 2025-12-16 14:21 ` Daniel Zahka
  2025-12-16 14:21 ` [PATCH net 2/2] selftests: drv-net: psp: fix test names in ipver_test_builder() Daniel Zahka
  1 sibling, 0 replies; 3+ messages in thread
From: Daniel Zahka @ 2025-12-16 14:21 UTC (permalink / raw)
  To: Andrew Lunn, David S. Miller, Eric Dumazet, Jakub Kicinski,
	Paolo Abeni, Shuah Khan, Willem de Bruijn
  Cc: netdev, linux-kselftest, linux-kernel, Daniel Zahka

test_case will only take on its formatted name after it is called by
the test runner. Move the assignment to test_case.__name__ to when the
test_case is constructed, not called.

Fixes: 8f90dc6e417a ("selftests: drv-net: psp: add basic data transfer and key rotation tests")
Signed-off-by: Daniel Zahka <daniel.zahka@gmail.com>
---
 tools/testing/selftests/drivers/net/psp.py | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/tools/testing/selftests/drivers/net/psp.py b/tools/testing/selftests/drivers/net/psp.py
index 06559ef49b9a..56dee824bb4c 100755
--- a/tools/testing/selftests/drivers/net/psp.py
+++ b/tools/testing/selftests/drivers/net/psp.py
@@ -573,8 +573,9 @@ def psp_ip_ver_test_builder(name, test_func, psp_ver, ipver):
     """Build test cases for each combo of PSP version and IP version"""
     def test_case(cfg):
         cfg.require_ipver(ipver)
-        test_case.__name__ = f"{name}_v{psp_ver}_ip{ipver}"
         test_func(cfg, psp_ver, ipver)
+
+    test_case.__name__ = f"{name}_v{psp_ver}_ip{ipver}"
     return test_case
 
 

-- 
2.47.3


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH net 2/2] selftests: drv-net: psp: fix test names in ipver_test_builder()
  2025-12-16 14:21 [PATCH net 0/2] selftests: drv-net: psp: fix templated test names in psp.py Daniel Zahka
  2025-12-16 14:21 ` [PATCH net 1/2] selftests: drv-net: psp: fix templated test names in psp_ip_ver_test_builder() Daniel Zahka
@ 2025-12-16 14:21 ` Daniel Zahka
  1 sibling, 0 replies; 3+ messages in thread
From: Daniel Zahka @ 2025-12-16 14:21 UTC (permalink / raw)
  To: Andrew Lunn, David S. Miller, Eric Dumazet, Jakub Kicinski,
	Paolo Abeni, Shuah Khan, Willem de Bruijn
  Cc: netdev, linux-kselftest, linux-kernel, Daniel Zahka

test_case will only take on the formatted name after being
called. This does not work with the way ksft_run() currently
works. Assign the name after the test_case is created.

Fixes: 81236c74dba6 ("selftests: drv-net: psp: add test for auto-adjusting TCP MSS")
Signed-off-by: Daniel Zahka <daniel.zahka@gmail.com>
---
 tools/testing/selftests/drivers/net/psp.py | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/tools/testing/selftests/drivers/net/psp.py b/tools/testing/selftests/drivers/net/psp.py
index 56dee824bb4c..52523bdad240 100755
--- a/tools/testing/selftests/drivers/net/psp.py
+++ b/tools/testing/selftests/drivers/net/psp.py
@@ -583,8 +583,9 @@ def ipver_test_builder(name, test_func, ipver):
     """Build test cases for each IP version"""
     def test_case(cfg):
         cfg.require_ipver(ipver)
-        test_case.__name__ = f"{name}_ip{ipver}"
         test_func(cfg, ipver)
+
+    test_case.__name__ = f"{name}_ip{ipver}"
     return test_case
 
 

-- 
2.47.3


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2025-12-16 14:21 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-12-16 14:21 [PATCH net 0/2] selftests: drv-net: psp: fix templated test names in psp.py Daniel Zahka
2025-12-16 14:21 ` [PATCH net 1/2] selftests: drv-net: psp: fix templated test names in psp_ip_ver_test_builder() Daniel Zahka
2025-12-16 14:21 ` [PATCH net 2/2] selftests: drv-net: psp: fix test names in ipver_test_builder() Daniel Zahka

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®