]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
selftests: drv-net: Make command requirements explicit
authorGal Pressman <gal@nvidia.com>
Wed, 23 Jul 2025 13:54:54 +0000 (16:54 +0300)
committerJakub Kicinski <kuba@kernel.org>
Fri, 25 Jul 2025 01:52:00 +0000 (18:52 -0700)
Make require_cmd() calls explicit about whether commands are needed
locally, remotely, or both.
Since require_cmd() defaults to local=True, tests should explicitly set
local=False when commands are only needed remotely.

- socat: Set local=False since it's only needed on remote hosts.
- iperf3: Use single call with both local=True and remote=True since
  it's needed on both hosts.

This avoids unnecessary test failures when commands are missing locally
but available remotely where actually needed, and consolidates a
duplicate require_cmd() call into single call that checks both hosts.

Fixes: 0d0f4174f6c8 ("selftests: drv-net: add a simple TSO test")
Fixes: f1e68a1a4a40 ("selftests: drv-net: add require_XYZ() helpers for validating env")
Fixes: c76bab22e920 ("selftests: drv-net: rss_input_xfrm: Check test prerequisites before running")
Reviewed-by: Nimrod Oren <noren@nvidia.com>
Signed-off-by: Gal Pressman <gal@nvidia.com>
Link: https://patch.msgid.link/20250723135454.649342-3-gal@nvidia.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
tools/testing/selftests/drivers/net/hw/devlink_rate_tc_bw.py
tools/testing/selftests/drivers/net/hw/rss_input_xfrm.py
tools/testing/selftests/drivers/net/hw/tso.py
tools/testing/selftests/drivers/net/lib/py/load.py
tools/testing/selftests/drivers/net/ping.py

index 835c357919a81238f20090f58f2b169651568869..ead6784d19104c941c95ace6845100b00b49c382 100755 (executable)
@@ -451,8 +451,7 @@ def main() -> None:
         )
         if not cfg.pci:
             raise KsftSkipEx("Could not get PCI address of the interface")
-        cfg.require_cmd("iperf3")
-        cfg.require_cmd("iperf3", remote=True)
+        cfg.require_cmd("iperf3", local=True, remote=True)
 
         cfg.bw_validator = BandwidthValidator()
 
index 6e90fb2905645d45bd00fce5ba3269974eafe113..72880e3884785e83a463791e913d53fc9e9fa2ce 100755 (executable)
@@ -32,7 +32,7 @@ def test_rss_input_xfrm(cfg, ipver):
     if multiprocessing.cpu_count() < 2:
         raise KsftSkipEx("Need at least two CPUs to test symmetric RSS hash")
 
-    cfg.require_cmd("socat", remote=True)
+    cfg.require_cmd("socat", local=False, remote=True)
 
     if not hasattr(socket, "SO_INCOMING_CPU"):
         raise KsftSkipEx("socket.SO_INCOMING_CPU was added in Python 3.11")
index 3370827409aa028d0c248c3d855c415bcc4dfe9e..3500d8f1bac45e43f1469f030a71bc482978e7a3 100755 (executable)
@@ -34,7 +34,7 @@ def tcp_sock_get_retrans(sock):
 
 
 def run_one_stream(cfg, ipver, remote_v4, remote_v6, should_lso):
-    cfg.require_cmd("socat", remote=True)
+    cfg.require_cmd("socat", local=False, remote=True)
 
     port = rand_port()
     listen_cmd = f"socat -{ipver} -t 2 -u TCP-LISTEN:{port},reuseport /dev/null,ignoreeof"
index 44151b7b1a24b635f119ae41a8425148041364f3..c4e808407cc448e635eadcc6dc234e19955b84fb 100644 (file)
@@ -7,7 +7,7 @@ from lib.py import ksft_pr, cmd, ip, rand_port, wait_port_listen
 
 class GenerateTraffic:
     def __init__(self, env, port=None):
-        env.require_cmd("iperf3", remote=True)
+        env.require_cmd("iperf3", local=True, remote=True)
 
         self.env = env
 
index e0f114612c1a095e14c8289422af12f5c20574ed..da3623c5e8a95d95dad76b4259fa2c70e89dafdc 100755 (executable)
@@ -30,7 +30,7 @@ def _test_v6(cfg) -> None:
     cmd("ping -s 65000 -c 1 -W0.5 " + cfg.addr_v["6"], host=cfg.remote)
 
 def _test_tcp(cfg) -> None:
-    cfg.require_cmd("socat", remote=True)
+    cfg.require_cmd("socat", local=False, remote=True)
 
     port = rand_port()
     listen_cmd = f"socat -{cfg.addr_ipver} -t 2 -u TCP-LISTEN:{port},reuseport STDOUT"