aboutsummaryrefslogtreecommitdiffstats
path: root/tools/testing/selftests/drivers/net/ping.py
diff options
context:
space:
mode:
authorJakub Kicinski <[email protected]>2024-04-20 02:52:37 +0000
committerJakub Kicinski <[email protected]>2024-04-23 17:13:56 +0000
commitf1e68a1a4a404e739f93b4e48344f9101b581771 (patch)
tree6496a643ac05c7016e0487929163e707c4a29b0b /tools/testing/selftests/drivers/net/ping.py
parentselftests: drv-net: add a TCP ping test case (and useful helpers) (diff)
downloadkernel-f1e68a1a4a404e739f93b4e48344f9101b581771.tar.gz
kernel-f1e68a1a4a404e739f93b4e48344f9101b581771.zip
selftests: drv-net: add require_XYZ() helpers for validating env
Wrap typical checks like whether given command used by the test is available in helpers. Reviewed-by: Willem de Bruijn <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
Diffstat (limited to 'tools/testing/selftests/drivers/net/ping.py')
-rwxr-xr-xtools/testing/selftests/drivers/net/ping.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/tools/testing/selftests/drivers/net/ping.py b/tools/testing/selftests/drivers/net/ping.py
index 4b49de59231c..eb83e7b48797 100755
--- a/tools/testing/selftests/drivers/net/ping.py
+++ b/tools/testing/selftests/drivers/net/ping.py
@@ -8,16 +8,22 @@ from lib.py import bkg, cmd, wait_port_listen, rand_port
def test_v4(cfg) -> None:
+ cfg.require_v4()
+
cmd(f"ping -c 1 -W0.5 {cfg.remote_v4}")
cmd(f"ping -c 1 -W0.5 {cfg.v4}", host=cfg.remote)
def test_v6(cfg) -> None:
+ cfg.require_v6()
+
cmd(f"ping -c 1 -W0.5 {cfg.remote_v6}")
cmd(f"ping -c 1 -W0.5 {cfg.v6}", host=cfg.remote)
def test_tcp(cfg) -> None:
+ cfg.require_cmd("socat", remote=True)
+
port = rand_port()
listen_cmd = f"socat -{cfg.addr_ipver} -t 2 -u TCP-LISTEN:{port},reuseport STDOUT"