selftests: drv-net: cope with slow env in so_txtime.py test
Subsystems (4)
Willem de Bruijn
maintainerPATCH 1/1 selftests: drv-net: cope with slow env in so_txtime.py test
From: Willem de Bruijn <[email protected]>
This test was converted from shell script to drv-net test.
The new version is flaky in dbg builds on the netdev.bots dashboard. The previous shell script had more protections to avoid these. Added in commit a7ee79b9c455 ("selftests: net: cope with slow env in so_txtime.sh test").
Add the same overall protection:
- Suppress so_txtime process failure if KSFT_MACHINE_SLOW
Also relax two timeouts to reduce the number of process failures themselves
- Increase SO_RCVTIMEO to 2 seconds
- Increase process start-up stabilization to 2 seconds
Delays were experimentally arrived at while running with vng built with kernel/configs/debug.config
--- tools/testing/selftests/drivers/net/so_txtime.c | 10 ++++++++-- tools/testing/selftests/drivers/net/so_txtime.py | 11 +++++++++-- 2 files changed, 17 insertions(+), 4 deletions(-)
tools/testing/selftests/drivers/net/so_txtime.c +8 -2
@@ -38,6 +38,7 @@static int cfg_clockid =CLOCK_TAI ;static uint16_t cfg_port =8000 ;static int cfg_variance_us =4000 ; +static bool cfg_machine_slow;static uint64_t cfg_start_time_ns;static int cfg_mark;static bool cfg_rx;
@@ -142,7 +143,7 @@ static void do_recv_one(int fdr, struct timed_send *ts)if (llabs (tstop - texpect) > cfg_variance_us) {fprintf (stderr,"exceeds variance (%d us)\n" , cfg_variance_us); -if (!getenv ("KSFT_MACHINE_SLOW" )) +if (!cfg_machine_slow) errors++; } }
@@ -263,7 +264,7 @@ static void start_time_wait(void) now =gettime_ns (CLOCK_REALTIME );if (cfg_start_time_ns < now) {fprintf (stderr,"FAIL: start time already passed\n" ); -if (!getenv ("KSFT_MACHINE_SLOW" )) +if (!cfg_machine_slow) errors++;return ; }
@@ -326,6 +327,9 @@ static int setup_rx(struct sockaddr *addr, socklen_t alen)if (bind (fd, addr, alen))error (1 , errno,"bind" ); +if (cfg_machine_slow) + tv.tv_sec =2 ; +if (setsockopt (fd,SOL_SOCKET ,SO_RCVTIMEO , &tv,sizeof (tv)))error (1 , errno,"setsockopt rcv timeout" );
@@ -512,6 +516,8 @@ static void parse_opts(int argc, char **argv)setup_sockaddr (domain, saddr, &cfg_src_addr); cfg_num_pkt =parse_io (argv[optind], cfg_buf); + + cfg_machine_slow =getenv ("KSFT_MACHINE_SLOW" ); }int main (int argc,char **argv)
tools/testing/selftests/drivers/net/so_txtime.py +9 -2
@@ -6,6 +6,7 @@ Test delivery time in FQ and ETF qdiscs. """ +import os import time from lib.py import ksft_exit, ksft_run, ksft_variants
@@ -15,17 +16,23 @@ from lib.py import NetDrvEpEnv, bkg, cmd, defer, tc def test_so_txtime(cfg, clockid, ipver, args_tx, args_rx, expect_success): """Main function. Run so_txtime as sender and receiver.""" + slow_machine = os.environ.get('KSFT_MACHINE_SLOW') + bin_path = cfg.test_dir / "so_txtime" - tstart = time.time_ns() + 200_000_000 + tstart = time.time_ns() + (2000_000_000 if slow_machine else 200_000_000) cmd_addr = f"-S {cfg.addr_v[ipver]} -D {cfg.remote_addr_v[ipver]}" cmd_base = f"{bin_path} -{ipver} -c {clockid} -t {tstart} {cmd_addr}" cmd_rx = f"{cmd_base} {args_rx} -r" cmd_tx = f"{cmd_base} {args_tx}" + expect_fail = not expect_success + if slow_machine: + expect_success = False + with bkg(cmd_rx, host=cfg.remote, fail=expect_success, - expect_fail=(not expect_success), exit_wait=True): + expect_fail=expect_fail, exit_wait=True): cmd(cmd_tx)
Signature · 1 line
2.54.0.563.g4f69b47b94-goog
This patch was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:
Hello:
This patch was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:
Quoted 10 lines · On Mon, 11 May 2026 18:19:20 -0400 you wrote:
From: Willem de Bruijn <[email protected]>
This test was converted from shell script to drv-net test.
The new version is flaky in dbg builds on the netdev.bots dashboard. The previous shell script had more protections to avoid these. Added in commit
a7ee79b9c455("selftests: net: cope with slow env inso_txtime.shtest").[...]
Here is the summary with links:
- [net-next] selftests: drv-net: cope with slow env in so_txtime.py test
https://git.kernel.org/netdev/net-next/c/543bdc1578cd
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html