Skip to content

Commit 24f432d

Browse files
[utils][tests] Adjust timeout-hang.py tolerances (#142089)
The subject test sporadically fails on the AIX builder: https://lab.llvm.org/buildbot/#/builders/64/builds/3921/steps/6/logs/FAIL__lit___timeout-hang_py This appears to be an environment issue potentially connected to high load because the problem is not observed on other AIX machines. This patch separates the "hard" timeout value from the value used to signal a hang. This allows for a more generous "hard" timeout value, which allows observation of cases that take longer to finish despite not hanging.
1 parent 19dcec9 commit 24f432d

File tree

1 file changed

+15
-6
lines changed

1 file changed

+15
-6
lines changed

llvm/utils/lit/tests/timeout-hang.py

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,20 +8,29 @@
88
# throwing an exception. We expect this to fail immediately, rather than
99
# timeout.
1010

11-
# DEFINE: %{timeout}=1
11+
# lit should return immediately once it fails to execute the non-existent file.
12+
# This will take a variable amount of time depending on process scheduling, but
13+
# it should always be significantly less than the hard timeout, which is the
14+
# point where lit would cancel the test.
15+
# DEFINE: %{grace_period}=5
16+
# DEFINE: %{hard_timeout}=15
1217

1318
# RUN: not %{lit} %{inputs}/timeout-hang/run-nonexistent.txt \
14-
# RUN: --timeout=%{timeout} --param external=0 | %{python} %s %{timeout}
19+
# RUN: --timeout=%{hard_timeout} --param external=0 | %{python} %s %{grace_period}
1520

1621
import sys
1722
import re
1823

19-
timeout_time = float(sys.argv[1])
24+
grace_time = float(sys.argv[1])
2025
testing_time = float(re.search(r"Testing Time: (.*)s", sys.stdin.read()).group(1))
2126

22-
if testing_time < timeout_time:
23-
print("Testing took less than timeout")
27+
if testing_time <= grace_time:
28+
print("Testing finished within the grace period")
2429
sys.exit(0)
2530
else:
26-
print("Testing took as long or longer than timeout")
31+
print(
32+
"Testing took {}s, which is beyond the grace period of {}s".format(
33+
testing_time, grace_time
34+
)
35+
)
2736
sys.exit(1)

0 commit comments

Comments
 (0)