Skip to content
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 11 additions & 6 deletions llvm/utils/lit/tests/timeout-hang.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,20 +8,25 @@
# throwing an exception. We expect this to fail immediately, rather than
# timeout.

# DEFINE: %{timeout}=1
# DEFINE: %{grace_period}=5
# DEFINE: %{hard_timeout}=15

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

import sys
import re

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

if testing_time < timeout_time:
print("Testing took less than timeout")
if testing_time <= grace_time:
print("Testing finished within the grace period")
sys.exit(0)
else:
print("Testing took as long or longer than timeout")
print(
"Testing took {}s, which is beyond the grace period of {}s".format(
testing_time, grace_time
)
)
sys.exit(1)
Loading