summaryrefslogtreecommitdiff
path: root/tools/testing
diff options
context:
space:
mode:
authorJakub Kicinski <kuba@kernel.org>2026-02-27 20:13:05 +0300
committerJakub Kicinski <kuba@kernel.org>2026-03-03 05:21:16 +0300
commitc7b228418e8b34282d266ffeef59996434a73b32 (patch)
tree6fe9d77dc920763244c23db84ab8652872630d3d /tools/testing
parent67792dde27a66fa6dc262d5e2ee8260096a9deb3 (diff)
downloadlinux-c7b228418e8b34282d266ffeef59996434a73b32.tar.xz
selftests: drv-net: iou-zcrx: allocate hugepages for large chunks test
The large chunks test needs 2MB hugepages for its mmap allocation, but the test system may not have any pre-allocated. Ensure at least 64 hugepages are available before running the test, and restore the original value on cleanup. While at it strip the stdout, it has a trailing new line. Before: ok 5 iou-zcrx.test_zcrx_large_chunks # SKIP Can't allocate huge pages Link: https://patch.msgid.link/20260227171305.2848240-4-kuba@kernel.org Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Diffstat (limited to 'tools/testing')
-rwxr-xr-xtools/testing/selftests/drivers/net/hw/iou-zcrx.py10
1 files changed, 9 insertions, 1 deletions
diff --git a/tools/testing/selftests/drivers/net/hw/iou-zcrx.py b/tools/testing/selftests/drivers/net/hw/iou-zcrx.py
index 1649c23e05e2..66dd496ec5cf 100755
--- a/tools/testing/selftests/drivers/net/hw/iou-zcrx.py
+++ b/tools/testing/selftests/drivers/net/hw/iou-zcrx.py
@@ -135,13 +135,21 @@ def test_zcrx_large_chunks(cfg) -> None:
cfg.require_ipver('6')
+ hp_file = "/proc/sys/vm/nr_hugepages"
+ with open(hp_file, 'r+', encoding='utf-8') as f:
+ nr_hugepages = int(f.read().strip())
+ if nr_hugepages < 64:
+ f.seek(0)
+ f.write("64")
+ defer(lambda: open(hp_file, 'w', encoding='utf-8').write(str(nr_hugepages)))
+
single(cfg)
rx_cmd = f"{cfg.bin_local} -s -p {cfg.port} -i {cfg.ifname} -q {cfg.target} -x 2"
tx_cmd = f"{cfg.bin_remote} -c -h {cfg.addr_v['6']} -p {cfg.port} -l 12840"
probe = cmd(rx_cmd + " -d", fail=False)
if probe.ret == SKIP_CODE:
- raise KsftSkipEx(probe.stdout)
+ raise KsftSkipEx(probe.stdout.strip())
with bkg(rx_cmd, exit_wait=True):
wait_port_listen(cfg.port, proto="tcp")