diff mbox series

[net,3/3] selftests: drv: net: add version indicator

Message ID 20250503013518.1722913-4-mohsin.bashr@gmail.com
State New
Headers show
Series selftests: drv: net: fix `ping.py` test failure | expand

Commit Message

Mohsin Bashir May 3, 2025, 1:35 a.m. UTC
Currently, the test result does not differentiate between the cases when
either one of the address families are configured or if both the address
families are configured. Ideally, the result should report if a
particular case was skipped.

./drivers/net/ping.py
TAP version 13
1..7
ok 1 ping.test_default_v4 # SKIP Test requires IPv4 connectivity
ok 2 ping.test_default_v6
ok 3 ping.test_xdp_generic_sb
ok 4 ping.test_xdp_generic_mb
ok 5 ping.test_xdp_native_sb
ok 6 ping.test_xdp_native_mb
ok 7 ping.test_xdp_offload # SKIP device does not support offloaded XDP
Totals: pass:5 fail:0 xfail:0 xpass:0 skip:2 error:0

Fixes: 75cc19c8ff89 ("selftests: drv-net: add xdp cases for ping.py")
Signed-off-by: Mohsin Bashir <mohsin.bashr@gmail.com>
---
 tools/testing/selftests/drivers/net/ping.py | 17 ++++++++++++++---
 1 file changed, 14 insertions(+), 3 deletions(-)

Comments

Jakub Kicinski May 5, 2025, 5:49 p.m. UTC | #1
On Fri, 2 May 2025 22:02:43 -0700 David Wei wrote:
> > -def test_default(cfg, netnl) -> None:
> > +def test_default_v4(cfg, netnl) -> None:
> > +    cfg.require_ipver("4")  
> 
> With this patch, is the previous patch and this hunk still needed? I
> think you can drop patch 2/3 or both.

The previous patch makes the more "meaty" tests run when either ipver 
is available. But we still want an indication if both versions are
supported by env but reporting *a* skip. Historically this is what
the ping test was for, TBH, pretty much a sanity check for the env.
But it ended up accumulating random XDP test cases :( 
Perhaps something to address in net-next..
David Wei May 5, 2025, 6:25 p.m. UTC | #2
On 5/5/25 10:49, Jakub Kicinski wrote:
> On Fri, 2 May 2025 22:02:43 -0700 David Wei wrote:
>>> -def test_default(cfg, netnl) -> None:
>>> +def test_default_v4(cfg, netnl) -> None:
>>> +    cfg.require_ipver("4")
>>
>> With this patch, is the previous patch and this hunk still needed? I
>> think you can drop patch 2/3 or both.
> 
> The previous patch makes the more "meaty" tests run when either ipver
> is available. But we still want an indication if both versions are
> supported by env but reporting *a* skip. Historically this is what
> the ping test was for, TBH, pretty much a sanity check for the env.
> But it ended up accumulating random XDP test cases :(
> Perhaps something to address in net-next..

I see, makes sense.

Reviewed-by: David Wei <dw@davidwei.uk>
diff mbox series

Patch

diff --git a/tools/testing/selftests/drivers/net/ping.py b/tools/testing/selftests/drivers/net/ping.py
index 16b7d3ab0fc8..af8df2313a3b 100755
--- a/tools/testing/selftests/drivers/net/ping.py
+++ b/tools/testing/selftests/drivers/net/ping.py
@@ -136,13 +136,23 @@  def set_interface_init(cfg) -> None:
     cmd(f"ip link set dev {cfg.ifname} xdpoffload off", shell=True)
     cmd(f"ip link set dev {cfg.remote_ifname} mtu 1500", shell=True, host=cfg.remote)
 
-def test_default(cfg, netnl) -> None:
+def test_default_v4(cfg, netnl) -> None:
+    cfg.require_ipver("4")
+
     _set_offload_checksum(cfg, netnl, "off")
     _test_v4(cfg)
-    _test_v6(cfg)
     _test_tcp(cfg)
     _set_offload_checksum(cfg, netnl, "on")
     _test_v4(cfg)
+    _test_tcp(cfg)
+
+def test_default_v6(cfg, netnl) -> None:
+    cfg.require_ipver("6")
+
+    _set_offload_checksum(cfg, netnl, "off")
+    _test_v6(cfg)
+    _test_tcp(cfg)
+    _set_offload_checksum(cfg, netnl, "on")
     _test_v6(cfg)
     _test_tcp(cfg)
 
@@ -200,7 +210,8 @@  def main() -> None:
     with NetDrvEpEnv(__file__) as cfg:
         get_interface_info(cfg)
         set_interface_init(cfg)
-        ksft_run([test_default,
+        ksft_run([test_default_v4,
+                  test_default_v6,
                   test_xdp_generic_sb,
                   test_xdp_generic_mb,
                   test_xdp_native_sb,