summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMina Almasry <almasrymina@google.com>2025-05-23 23:05:23 +0000
committerJakub Kicinski <kuba@kernel.org>2025-05-27 19:19:36 -0700
commitbaa18bc5353fcb99bc49944c51c6c7829cb1da55 (patch)
treec3bc14ee789045f24b7b8c203e39f0f610bddf76
parent243d47a5e1e47b2b72d654d7278fc8bff0199b0c (diff)
net: devmem: ksft: upgrade rx test to send 1K data
The current test just sends "hello\nworld" and verifies that is the string received on the RX side. That is fine, but improve the test a bit by sending 1K data. The test should be improved further to send more data, but for now this should be a welcome improvement. The test will send a repeating pattern of 0x01, 0x02, ... 0x06. The ncdevmem `-v 7` flag will verify this pattern. ncdevmem will provide useful debugging info when the test fails, such as the frags received and verified fine, and which frag exactly failed, what was the expected byte pattern, and what is the actual byte pattern received. All this debug information will be useful when the test fails. Signed-off-by: Mina Almasry <almasrymina@google.com> Acked-by: Stanislav Fomichev <sdf@fomichev.me> Link: https://patch.msgid.link/20250523230524.1107879-8-almasrymina@google.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
-rwxr-xr-xtools/testing/selftests/drivers/net/hw/devmem.py8
1 files changed, 5 insertions, 3 deletions
diff --git a/tools/testing/selftests/drivers/net/hw/devmem.py b/tools/testing/selftests/drivers/net/hw/devmem.py
index 52ee52c51029..7947650210a0 100755
--- a/tools/testing/selftests/drivers/net/hw/devmem.py
+++ b/tools/testing/selftests/drivers/net/hw/devmem.py
@@ -24,13 +24,15 @@ def check_rx(cfg) -> None:
require_devmem(cfg)
port = rand_port()
- listen_cmd = f"{cfg.bin_local} -l -f {cfg.ifname} -s {cfg.addr} -p {port} -c {cfg.remote_addr}"
+ socat = f"socat -u - TCP{cfg.addr_ipver}:{cfg.addr}:{port},bind={cfg.remote_addr}:{port}"
+ listen_cmd = f"{cfg.bin_local} -l -f {cfg.ifname} -s {cfg.addr} -p {port} -c {cfg.remote_addr} -v 7"
with bkg(listen_cmd, exit_wait=True) as ncdevmem:
wait_port_listen(port)
- cmd(f"echo -e \"hello\\nworld\"| socat -u - TCP{cfg.addr_ipver}:{cfg.addr}:{port},bind={cfg.remote_addr}:{port}", host=cfg.remote, shell=True)
+ cmd(f"yes $(echo -e \x01\x02\x03\x04\x05\x06) | \
+ head -c 1K | {socat}", host=cfg.remote, shell=True)
- ksft_eq(ncdevmem.stdout.strip(), "hello\nworld")
+ ksft_eq(ncdevmem.ret, 0)
@ksft_disruptive