Skip to contentSkip to conversation

selftests: net: prevent Python from buffering the output

PATCH Applied Jakub Kicinski 3 participants 3 messages Jul 16, 2025 – Jul 17, 2025

Subsystems (3)
lore
Share & tools
lore

Jakub Kicinski

author maintainer
#0 lore raw

PATCH 1/1 selftests: net: prevent Python from buffering the output

Make sure Python doesn't buffer the output, otherwise for some tests we may see false positive timeouts in NIPA. NIPA thinks that a machine has hung if the test doesn't print anything for 3min. This is also nice to heave for running the tests manually, especially in vng.

---
CC: [email protected]
CC: [email protected]
CC: [email protected]

---
 tools/testing/selftests/net/lib/py/ksft.py | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
tools/testing/selftests/net/lib/py/ksft.py +4 -3
index 61287c203b6e..8e35ed12ed9e 100644
@@ -32,6 +32,7 @@ KSFT_DISRUPTIVE = True
 
 
 def ksft_pr(*objs, **kwargs):
+    kwargs["flush"] = True
     print("#", *objs, **kwargs)
 
 
@@ -139,7 +140,7 @@ KSFT_DISRUPTIVE = True
         res += "." + str(case.__name__)
     if comment:
         res += " # " + comment
-    print(res)
+    print(res, flush=True)
 
 
 def ksft_flush_defer():
@@ -227,8 +228,8 @@ KSFT_DISRUPTIVE = True
 
     totals = {"pass": 0, "fail": 0, "skip": 0, "xfail": 0}
 
-    print("TAP version 13")
-    print("1.." + str(len(cases)))
+    print("TAP version 13", flush=True)
+    print("1.." + str(len(cases)), flush=True)
 
     global KSFT_RESULT
     cnt = 0
Signature · 1 line
2.50.1
Reviewed-by on v1 1/1
#1 lore raw
Quoted 7 lines · Jakub Kicinski

Make sure Python doesn't buffer the output, otherwise for some tests we may see false positive timeouts in NIPA. NIPA thinks that a machine has hung if the test doesn't print anything for 3min. This is also nice to heave for running the tests manually, especially in vng.

The flush keyword was introduced in 3.3, now out of support, so this should be safe.

#2 lore raw
In reply to Jakub Kicinski
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 9 lines · On Wed, 16 Jul 2025 13:57:12 -0700 you wrote:

Make sure Python doesn't buffer the output, otherwise for some tests we may see false positive timeouts in NIPA. NIPA thinks that a machine has hung if the test doesn't print anything for 3min. This is also nice to heave for running the tests manually, especially in vng.

[...]

Here is the summary with links:
- [net-next] selftests: net: prevent Python from buffering the output

    https://git.kernel.org/netdev/net-next/c/797f080c463d

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html