Skip to contentSkip to conversation

selftests: net: fix timeout passed as positional argument to communicate()

PATCH In review Gal Pressman 2 participants 2 messages Feb 15

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 selftests: net: fix timeout passed as positional argument to communicate()

The cited commit refactored the hardcoded timeout=5 into a parameter, but dropped the keyword from the communicate() call.
Since Popen.communicate()'s first positional argument is 'input' (not 'timeout'), the timeout value is silently treated as stdin input and the call never enforces a timeout.

Pass timeout as a keyword argument to restore the intended behavior.

Fixes 1cf270424218 ("net: selftest: add test for netdev netlink queue-get API")
---
 tools/testing/selftests/net/lib/py/utils.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tools/testing/selftests/net/lib/py/utils.py +1 -1
index 106ee1f2df86..73b1b0460436 100644
@@ -86,7 +86,7 @@ class cmd:
             os.write(self.ksft_term_fd, b"1")
         if terminate:
             self.proc.terminate()
-        stdout, stderr = self.proc.communicate(timeout)
+        stdout, stderr = self.proc.communicate(timeout=timeout)
         self.stdout = stdout.decode("utf-8")
         self.stderr = stderr.decode("utf-8")
         self.proc.stdout.close()
Signature · 1 line
2.52.0
maintainer
#1 lore raw
Quoted 7 lines · On Sun, 15 Feb 2026 14:51:49 +0200 Gal Pressman wrote:

The cited commit refactored the hardcoded timeout=5 into a parameter, but dropped the keyword from the communicate() call.
Since Popen.communicate()'s first positional argument is 'input' (not 'timeout'), the timeout value is silently treated as stdin input and the call never enforces a timeout.

Pass timeout as a keyword argument to restore the intended behavior.

Makes sense, but looks like tools/testing/selftests/drivers/net/netpoll_basic.py fails now:

https://netdev-ctrl.bots.linux.dev/logs/vmksft/net-drv/results/519460/3-netpoll-basic-py/stdout

I think bpftrace() needs to pass the timeout to cmd(). Probably something like the timeout param that it's passed + 5 sec?

Signature · 1 line
pw-bot: cr