summaryrefslogtreecommitdiff
path: root/tools/testing/selftests/net/lib/py/utils.py
diff options
context:
space:
mode:
authorJakub Kicinski <kuba@kernel.org>2024-04-30 08:15:33 -0700
committerJakub Kicinski <kuba@kernel.org>2024-04-30 08:15:34 -0700
commitb45176703647e5302314c740a51e7d1054a7bd3c (patch)
treecc187ebd5dcbf93d1db54c23788b8ef2c62ccaa6 /tools/testing/selftests/net/lib/py/utils.py
parentf581bcf02f0e0b42516bfeb3e34860919b9e78d2 (diff)
parent9da271f825e42156058a2eb09360bc993853bbba (diff)
Merge branch 'selftests-net-page_poll-allocation-error-injection'
Jakub Kicinski says: ==================== selftests: net: page_poll allocation error injection Add a test for exercising driver memory allocation failure paths. page pool is a bit tricky to inject errors into at the page allocator level because of the bulk alloc and recycling, so add explicit error injection support "in front" of the caches. Add a test to exercise that using only the standard APIs. This is the first useful test for the new tests with an endpoint. There's no point testing netdevsim here, so this is also the first HW-only test in Python. I'm not super happy with the traffic generation using iperf3, my initial approach was to use mausezahn. But it turned out to be 5x slower in terms of PPS. Hopefully this is good enough for now. v1: https://lore.kernel.org/all/20240426232400.624864-1-kuba@kernel.org/ ==================== Link: https://lore.kernel.org/r/20240429144426.743476-1-kuba@kernel.org Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Diffstat (limited to 'tools/testing/selftests/net/lib/py/utils.py')
-rw-r--r--tools/testing/selftests/net/lib/py/utils.py14
1 files changed, 10 insertions, 4 deletions
diff --git a/tools/testing/selftests/net/lib/py/utils.py b/tools/testing/selftests/net/lib/py/utils.py
index d3715e6c21f2..b57d467afd0f 100644
--- a/tools/testing/selftests/net/lib/py/utils.py
+++ b/tools/testing/selftests/net/lib/py/utils.py
@@ -56,10 +56,10 @@ class bkg(cmd):
return self.process(terminate=self.terminate)
-def ip(args, json=None, ns=None, host=None):
- cmd_str = "ip "
+def tool(name, args, json=None, ns=None, host=None):
+ cmd_str = name + ' '
if json:
- cmd_str += '-j '
+ cmd_str += '--json '
cmd_str += args
cmd_obj = cmd(cmd_str, ns=ns, host=host)
if json:
@@ -67,11 +67,17 @@ def ip(args, json=None, ns=None, host=None):
return cmd_obj
+def ip(args, json=None, ns=None, host=None):
+ if ns:
+ args = f'-netns {ns} ' + args
+ return tool('ip', args, json=json, host=host)
+
+
def rand_port():
"""
Get unprivileged port, for now just random, one day we may decide to check if used.
"""
- return random.randint(1024, 65535)
+ return random.randint(10000, 65535)
def wait_port_listen(port, proto="tcp", ns=None, host=None, sleep=0.005, deadline=5):