mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-24 11:42:57 +01:00
a50a440b7c
The tests previously relied on the `short.py` and `FirstTest.subTestA` script being executed on a machine within a short time window (1 or 2 seconds). While this "seems to work" it can fail on resource constrained machines. We could bump the timeout a little bit (bumping it too much would mean the test would take a long time to execute) but it wouldn't really solve the problem of the test being prone to failures. This patch tries to remove this flakeyness by separating testing into two separate parts: 1. Testing if a test can hit a timeout. 2. Testing if a test can run to completion in the presence of a timeout. This way we can give (1.) a really short timeout (to make the test run as fast as possible) and (2.) a really long timeout. This means for (2.) we are no longer trying to rely on the "short" test executing within some short time window. Instead the window is now 3600 seconds which should be long enough even for a heavily resource constrained machine to execute the "short" test. Thanks to Julian Lettner for suggesting this approach. This superseeds my original approach in https://reviews.llvm.org/D88807. This patch also changes the command line override test to run the quick test rather than the slow one to make the test run faster. Differential Revision: https://reviews.llvm.org/D89020
48 lines
2.0 KiB
Python
48 lines
2.0 KiB
Python
# REQUIRES: lit-max-individual-test-time
|
|
|
|
###############################################################################
|
|
# Check tests can hit timeout when set
|
|
###############################################################################
|
|
|
|
# Check that the per test timeout is enforced when running GTest tests.
|
|
#
|
|
# RUN: not %{lit} -j 1 -v %{inputs}/googletest-timeout \
|
|
# RUN: --filter=InfiniteLoopSubTest --timeout=1 > %t.cmd.out
|
|
# RUN: FileCheck --check-prefix=CHECK-INF < %t.cmd.out %s
|
|
|
|
# Check that the per test timeout is enforced when running GTest tests via
|
|
# the configuration file
|
|
#
|
|
# RUN: not %{lit} -j 1 -v %{inputs}/googletest-timeout \
|
|
# RUN: --filter=InfiniteLoopSubTest --param set_timeout=1 \
|
|
# RUN: > %t.cfgset.out
|
|
# RUN: FileCheck --check-prefix=CHECK-INF < %t.cfgset.out %s
|
|
|
|
# CHECK-INF: -- Testing:
|
|
# CHECK-INF: TIMEOUT: googletest-timeout :: {{[Dd]ummy[Ss]ub[Dd]ir}}/OneTest.py/T.InfiniteLoopSubTest
|
|
# CHECK-INF: Timed Out: 1
|
|
|
|
###############################################################################
|
|
# Check tests can complete with a timeout set
|
|
#
|
|
# `QuickSubTest` should execute quickly so we shouldn't wait anywhere near the
|
|
# 3600 second timeout.
|
|
###############################################################################
|
|
|
|
# RUN: %{lit} -j 1 -v %{inputs}/googletest-timeout \
|
|
# RUN: --filter=QuickSubTest --timeout=3600 > %t.cmd.out
|
|
# RUN: FileCheck --check-prefix=CHECK-QUICK < %t.cmd.out %s
|
|
|
|
# CHECK-QUICK: PASS: googletest-timeout :: {{[Dd]ummy[Ss]ub[Dd]ir}}/OneTest.py/T.QuickSubTest
|
|
# CHECK-QUICK: Passed : 1
|
|
|
|
# Test per test timeout via a config file and on the command line.
|
|
# The value set on the command line should override the config file.
|
|
# RUN: %{lit} -j 1 -v %{inputs}/googletest-timeout --filter=QuickSubTest \
|
|
# RUN: --param set_timeout=1 --timeout=3600 \
|
|
# RUN: > %t.cmdover.out 2> %t.cmdover.err
|
|
# RUN: FileCheck --check-prefix=CHECK-QUICK < %t.cmdover.out %s
|
|
# RUN: FileCheck --check-prefix=CHECK-CMDLINE-OVERRIDE-ERR < %t.cmdover.err %s
|
|
|
|
# CHECK-CMDLINE-OVERRIDE-ERR: Forcing timeout to be 3600 seconds
|