netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next] selftests: drv-net: rss_input_xfrm: Check test prerequisites before running
@ 2025-03-17 12:31 Gal Pressman
  2025-03-20 14:44 ` Simon Horman
  2025-03-24 17:19 ` Jakub Kicinski
  0 siblings, 2 replies; 4+ messages in thread
From: Gal Pressman @ 2025-03-17 12:31 UTC (permalink / raw)
  To: David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	Andrew Lunn, netdev
  Cc: Shuah Khan, linux-kselftest, Gal Pressman, Nimrod Oren

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.

Reviewed-by: Nimrod Oren <noren@nvidia.com>
Signed-off-by: Gal Pressman <gal@nvidia.com>
---
 .../testing/selftests/drivers/net/hw/rss_input_xfrm.py | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/tools/testing/selftests/drivers/net/hw/rss_input_xfrm.py b/tools/testing/selftests/drivers/net/hw/rss_input_xfrm.py
index 53bb08cc29ec..58d74ba6c343 100755
--- a/tools/testing/selftests/drivers/net/hw/rss_input_xfrm.py
+++ b/tools/testing/selftests/drivers/net/hw/rss_input_xfrm.py
@@ -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')
 
-- 
2.40.1


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

* Re: [PATCH net-next] selftests: drv-net: rss_input_xfrm: Check test prerequisites before running
  2025-03-17 12:31 [PATCH net-next] selftests: drv-net: rss_input_xfrm: Check test prerequisites before running Gal Pressman
@ 2025-03-20 14:44 ` Simon Horman
  2025-03-24 17:19 ` Jakub Kicinski
  1 sibling, 0 replies; 4+ messages in thread
From: Simon Horman @ 2025-03-20 14:44 UTC (permalink / raw)
  To: Gal Pressman
  Cc: David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	Andrew Lunn, netdev, Shuah Khan, linux-kselftest, Nimrod Oren

On Mon, Mar 17, 2025 at 02:31:49PM +0200, Gal Pressman wrote:
> 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.
> 
> Reviewed-by: Nimrod Oren <noren@nvidia.com>
> Signed-off-by: Gal Pressman <gal@nvidia.com>

Reviewed-by: Simon Horman <horms@kernel.org>


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

* Re: [PATCH net-next] selftests: drv-net: rss_input_xfrm: Check test prerequisites before running
  2025-03-17 12:31 [PATCH net-next] selftests: drv-net: rss_input_xfrm: Check test prerequisites before running Gal Pressman
  2025-03-20 14:44 ` Simon Horman
@ 2025-03-24 17:19 ` Jakub Kicinski
  2025-03-24 17:53   ` Gal Pressman
  1 sibling, 1 reply; 4+ messages in thread
From: Jakub Kicinski @ 2025-03-24 17:19 UTC (permalink / raw)
  To: Gal Pressman
  Cc: David S. Miller, Eric Dumazet, Paolo Abeni, Andrew Lunn, netdev,
	Shuah Khan, linux-kselftest, Nimrod Oren

On Mon, 17 Mar 2025 14:31:49 +0200 Gal Pressman wrote:
> +    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.

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

* Re: [PATCH net-next] selftests: drv-net: rss_input_xfrm: Check test prerequisites before running
  2025-03-24 17:19 ` Jakub Kicinski
@ 2025-03-24 17:53   ` Gal Pressman
  0 siblings, 0 replies; 4+ messages in thread
From: Gal Pressman @ 2025-03-24 17:53 UTC (permalink / raw)
  To: Jakub Kicinski
  Cc: David S. Miller, Eric Dumazet, Paolo Abeni, Andrew Lunn, netdev,
	Shuah Khan, linux-kselftest, Nimrod Oren

On 24/03/2025 19:19, Jakub Kicinski wrote:
> On Mon, 17 Mar 2025 14:31:49 +0200 Gal Pressman wrote:
>> +    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.

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

end of thread, other threads:[~2025-03-24 17:54 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-03-17 12:31 [PATCH net-next] selftests: drv-net: rss_input_xfrm: Check test prerequisites before running Gal Pressman
2025-03-20 14:44 ` Simon Horman
2025-03-24 17:19 ` Jakub Kicinski
2025-03-24 17:53   ` Gal Pressman

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).