Skip to contentSkip to conversation

selftests: drv-net: rss_input_xfrm: Check test prerequisites before running

PATCH Superseded Gal Pressman 3 participants 4 messages Mar 17, 2025 – Mar 24, 2025

Subsystems (3)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 selftests: drv-net: rss_input_xfrm: Check test prerequisites before running

Ensure the following prerequisites before executing the test:
1. 'socat' is installed on the remote host.
2. Python version supports socket.SO_INCOMING_CPU (available since v3.11).

Skip the test if either prerequisite is not met.

---
 .../testing/selftests/drivers/net/hw/rss_input_xfrm.py | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)
tools/testing/selftests/drivers/net/hw/rss_input_xfrm.py +9 -1
index 53bb08cc29ec..58d74ba6c343 100755
@@ -7,7 +7,7 @@ from lib.py import ksft_run, ksft_exit, ksft_eq, ksft_ge, cmd, fd_read_timeout
 from lib.py import NetDrvEpEnv
 from lib.py import EthtoolFamily, NetdevFamily
 from lib.py import KsftSkipEx, KsftFailEx
-from lib.py import rand_port
+from lib.py import rand_port, CmdExitFailure
 
 
 def traffic(cfg, local_port, remote_port, ipver):
@@ -32,6 +32,14 @@ def test_rss_input_xfrm(cfg, ipver):
     if multiprocessing.cpu_count() < 2:
         raise KsftSkipEx("Need at least two CPUs to test symmetric RSS hash")
 
+    try:
+        cmd("hash socat", host=cfg.remote)
+    except CmdExitFailure:
+        raise KsftSkipEx("socat not installed on remote")
+
+    if not hasattr(socket, "SO_INCOMING_CPU"):
+        raise KsftSkipEx("socket.SO_INCOMING_CPU was added in Python 3.11")
+
     input_xfrm = cfg.ethnl.rss_get(
         {'header': {'dev-name': cfg.ifname}}).get('input_xfrm')
 
Signature · 1 line
2.40.1
maintainer
#2 lore raw
In reply to Gal Pressman

tools/testing/selftests/drivers/net/hw/rss_input_xfrm.py def test_rss_input_xfrm(cfg, ipver): · line 38

Quoted 4 lines · On Mon, 17 Mar 2025 14:31:49 +0200 Gal Pressman wrote:
tools/testing/selftests/drivers/net/hw/rss_input_xfrm.py +4 -0
+    try:
+        cmd("hash socat", host=cfg.remote)
+    except CmdExitFailure:
+        raise KsftSkipEx("socat not installed on remote")

I'm not familiar with "hash", would using

cfg.require_cmd("socat", remote=True)

work? IOW we do have a helper for this sort of checking.

#3 lore raw
Quoted 11 lines · Jakub Kicinski

tools/testing/selftests/drivers/net/hw/rss_input_xfrm.py def test_rss_input_xfrm(cfg, ipver): · line 38

Quoted 4 lines · On Mon, 17 Mar 2025 14:31:49 +0200 Gal Pressman wrote:
tools/testing/selftests/drivers/net/hw/rss_input_xfrm.py +4 -0
+    try:
+        cmd("hash socat", host=cfg.remote)
+    except CmdExitFailure:
+        raise KsftSkipEx("socat not installed on remote")

I'm not familiar with "hash", would using

cfg.require_cmd("socat", remote=True)

work? IOW we do have a helper for this sort of checking.

Nice, I should've seen this helper, will change, thanks.