1# REQUIRES: lit-max-individual-test-time
2
3###############################################################################
4# Check tests can hit timeout when set
5###############################################################################
6
7# Check that the per test timeout is enforced when running GTest tests.
8#
9# RUN: not %{lit} -j 1 -v %{inputs}/googletest-timeout \
10# RUN:   --filter=InfiniteLoopSubTest --timeout=1 > %t.cmd.out
11# RUN: FileCheck --check-prefix=CHECK-INF < %t.cmd.out %s
12
13# Check that the per test timeout is enforced when running GTest tests via
14# the configuration file
15#
16# RUN: not %{lit} -j 1 -v %{inputs}/googletest-timeout \
17# RUN:  --filter=InfiniteLoopSubTest  --param set_timeout=1 \
18# RUN:  > %t.cfgset.out
19# RUN: FileCheck --check-prefix=CHECK-INF < %t.cfgset.out %s
20
21# CHECK-INF: -- Testing:
22# CHECK-INF: TIMEOUT: googletest-timeout :: {{[Dd]ummy[Ss]ub[Dd]ir}}/OneTest.py/T.InfiniteLoopSubTest
23# CHECK-INF: Timed Out: 1
24
25###############################################################################
26# Check tests can complete with a timeout set
27#
28# `QuickSubTest` should execute quickly so we shouldn't wait anywhere near the
29# 3600 second timeout.
30###############################################################################
31
32# RUN: %{lit} -j 1 -v %{inputs}/googletest-timeout \
33# RUN:   --filter=QuickSubTest --timeout=3600 > %t.cmd.out
34# RUN: FileCheck --check-prefix=CHECK-QUICK < %t.cmd.out %s
35
36# CHECK-QUICK: PASS: googletest-timeout :: {{[Dd]ummy[Ss]ub[Dd]ir}}/OneTest.py/T.QuickSubTest
37# CHECK-QUICK: Passed : 1
38
39# Test per test timeout via a config file and on the command line.
40# The value set on the command line should override the config file.
41# RUN: %{lit} -j 1 -v %{inputs}/googletest-timeout --filter=QuickSubTest \
42# RUN:   --param set_timeout=1 --timeout=3600 \
43# RUN:   > %t.cmdover.out 2> %t.cmdover.err
44# RUN: FileCheck --check-prefix=CHECK-QUICK < %t.cmdover.out %s
45# RUN: FileCheck --check-prefix=CHECK-CMDLINE-OVERRIDE-ERR < %t.cmdover.err %s
46
47# CHECK-CMDLINE-OVERRIDE-ERR: Forcing timeout to be 3600 seconds
48