selftests: drv-net: Fix and improve command requirement checking
Subsystems (3)
cover selftests: drv-net: Fix and improve command requirement checking
This series fixes remote command checking and cleans up command requirement calls across tests.
The first patch fixes require_cmd() incorrectly checking commands locally even when remote=True was specified due to a missing host parameter.
The second patch makes require_cmd() usage explicit about local/remote requirements, avoiding unnecessary test failures and consolidating duplicate calls.
Gal Pressman (2):
selftests: drv-net: Fix remote command checking in require_cmd()
selftests: drv-net: Make command requirements explicit
tools/testing/selftests/drivers/net/hw/devlink_rate_tc_bw.py | 3 +-- tools/testing/selftests/drivers/net/hw/rss_input_xfrm.py | 2 +- tools/testing/selftests/drivers/net/hw/tso.py | 2 +- tools/testing/selftests/drivers/net/lib/py/env.py | 2 +- tools/testing/selftests/drivers/net/lib/py/load.py | 2 +- tools/testing/selftests/drivers/net/ping.py | 2 +- 6 files changed, 6 insertions(+), 7 deletions(-)
Signature · 1 line
2.40.1
PATCH 1/2 selftests: drv-net: Fix remote command checking in require_cmd()
The require_cmd() method was checking for command availability locally even when remote=True was specified, due to a missing host parameter.
Fix by passing host=self.remote when checking remote command availability, ensuring commands are verified on the correct host.
--- tools/testing/selftests/drivers/net/lib/py/env.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/testing/selftests/drivers/net/lib/py/env.py +1 -1
@@ -259,7 +259,7 @@ class NetDrvEpEnv(NetDrvEnvBase): if not self._require_cmd(comm, "local"): raise KsftSkipEx("Test requires command: " + comm) if remote: - if not self._require_cmd(comm, "remote"): + if not self._require_cmd(comm, "remote", host=self.remote): raise KsftSkipEx("Test requires (remote) command: " + comm) def wait_hw_stats_settle(self):
Signature · 1 line
2.40.1
PATCH 2/2 selftests: drv-net: Make command requirements explicit
In reply to Gal PressmanMake 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.
--- tools/testing/selftests/drivers/net/hw/devlink_rate_tc_bw.py | 3 +-- tools/testing/selftests/drivers/net/hw/rss_input_xfrm.py | 2 +- tools/testing/selftests/drivers/net/hw/tso.py | 2 +- tools/testing/selftests/drivers/net/lib/py/load.py | 2 +- tools/testing/selftests/drivers/net/ping.py | 2 +- 5 files changed, 5 insertions(+), 6 deletions(-)
tools/testing/selftests/drivers/net/hw/devlink_rate_tc_bw.py +1 -2
@@ -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()
tools/testing/selftests/drivers/net/hw/rss_input_xfrm.py +1 -1
@@ -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")
tools/testing/selftests/drivers/net/hw/tso.py +1 -1
@@ -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"
tools/testing/selftests/drivers/net/lib/py/load.py +1 -1
@@ -6,7 +6,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
tools/testing/selftests/drivers/net/ping.py +1 -1
@@ -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"
Signature · 1 line
2.40.1
This series was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:
Hello:
This series was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:
Quoted 8 lines · On Wed, 23 Jul 2025 16:54:52 +0300 you wrote:
This series fixes remote command checking and cleans up command requirement calls across tests.
The first patch fixes
require_cmd()incorrectly checking commands locally even when remote=True was specified due to a missing host parameter.[...]
Here is the summary with links:
- [net-next,1/2] selftests: drv-net: Fix remote command checking in require_cmd()
https://git.kernel.org/netdev/net-next/c/b4d52c698210 - [net-next,2/2] selftests: drv-net: Make command requirements explicit https://git.kernel.org/netdev/net-next/c/d74cd9a02f02
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html