Skip to content

Commit 95b73fb

Browse files
committed
GR-27765: add --timeout to test tagger
1 parent b19f9ea commit 95b73fb

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

graalpython/com.oracle.graal.python.test/src/tests/test_tagged_unittests.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -140,11 +140,14 @@ def parse_unittest_output(output):
140140
glob_pattern = os.path.join(os.path.dirname(test.__file__), "test_*.py")
141141
retag = False
142142
maxrepeats = 4
143+
tout = "240"
143144
for arg in sys.argv[1:]:
144145
if arg == "--retag":
145146
retag = True
146147
elif arg.startswith("--maxrepeats="):
147148
maxrepeats = int(arg.partition("=")[2])
149+
elif arg.startswith("--timeout="):
150+
tout = arg.partition("=")[2]
148151
elif arg == "--help":
149152
print(sys.argv[0] + " [--retag] [--maxrepeats=n] [glob]")
150153
else:
@@ -174,7 +177,7 @@ def parse_unittest_output(output):
174177
else:
175178
testfile_stem = os.path.splitext(os.path.basename(testfile))[0]
176179
testmod = "test." + testfile_stem
177-
cmd = [timeout, "-s", "9", "240"] + executable
180+
cmd = [timeout, "-s", "9", tout] + executable
178181
if repeat == 0:
179182
# Allow catching Java exceptions in the first iteration only, so that subsequent iterations
180183
# (there will be one even if everything succeeds) filter out possible false-passes caused by
@@ -220,7 +223,7 @@ def parse_unittest_output(output):
220223
f.write("\n")
221224
if not passing_tests:
222225
os.unlink(tagfile)
223-
print("No successful tests remaining")
226+
print("No successful tests detected (you can try to increase the timeout by using --timeout=NNN)")
224227
break
225228

226229
if p.returncode == 0:

0 commit comments

Comments
 (0)