Skip to content

Commit baa18bc

Browse files
minakuba-moo
authored andcommitted
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>
1 parent 243d47a commit baa18bc

File tree

1 file changed

+5
-3
lines changed
  • tools/testing/selftests/drivers/net/hw

1 file changed

+5
-3
lines changed

tools/testing/selftests/drivers/net/hw/devmem.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,15 @@ def check_rx(cfg) -> None:
2424
require_devmem(cfg)
2525

2626
port = rand_port()
27-
listen_cmd = f"{cfg.bin_local} -l -f {cfg.ifname} -s {cfg.addr} -p {port} -c {cfg.remote_addr}"
27+
socat = f"socat -u - TCP{cfg.addr_ipver}:{cfg.addr}:{port},bind={cfg.remote_addr}:{port}"
28+
listen_cmd = f"{cfg.bin_local} -l -f {cfg.ifname} -s {cfg.addr} -p {port} -c {cfg.remote_addr} -v 7"
2829

2930
with bkg(listen_cmd, exit_wait=True) as ncdevmem:
3031
wait_port_listen(port)
31-
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)
32+
cmd(f"yes $(echo -e \x01\x02\x03\x04\x05\x06) | \
33+
head -c 1K | {socat}", host=cfg.remote, shell=True)
3234

33-
ksft_eq(ncdevmem.stdout.strip(), "hello\nworld")
35+
ksft_eq(ncdevmem.ret, 0)
3436

3537

3638
@ksft_disruptive

0 commit comments

Comments
 (0)