Skip to content

Commit 797f080

Browse files
committed
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. Reviewed-by: Petr Machata <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
1 parent 25bf7d7 commit 797f080

File tree

1 file changed

+4
-3
lines changed
  • tools/testing/selftests/net/lib/py

1 file changed

+4
-3
lines changed

tools/testing/selftests/net/lib/py/ksft.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ class KsftTerminate(KeyboardInterrupt):
3232

3333

3434
def ksft_pr(*objs, **kwargs):
35+
kwargs["flush"] = True
3536
print("#", *objs, **kwargs)
3637

3738

@@ -139,7 +140,7 @@ def ktap_result(ok, cnt=1, case="", comment=""):
139140
res += "." + str(case.__name__)
140141
if comment:
141142
res += " # " + comment
142-
print(res)
143+
print(res, flush=True)
143144

144145

145146
def ksft_flush_defer():
@@ -227,8 +228,8 @@ def ksft_run(cases=None, globs=None, case_pfx=None, args=()):
227228

228229
totals = {"pass": 0, "fail": 0, "skip": 0, "xfail": 0}
229230

230-
print("TAP version 13")
231-
print("1.." + str(len(cases)))
231+
print("TAP version 13", flush=True)
232+
print("1.." + str(len(cases)), flush=True)
232233

233234
global KSFT_RESULT
234235
cnt = 0

0 commit comments

Comments
 (0)