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 :: [[PATH:[Dd]ummy[Ss]ub[Dd]ir/]][[FILE:OneTest\.py]]/[[TEST:T\.InfiniteLoopSubTest]]
23# CHECK-INF-NEXT: ******************** TEST 'googletest-timeout :: [[PATH]][[FILE]]/[[TEST]]' FAILED ********************
24# CHECK-INF-NEXT: Script:
25# CHECK-INF-NEXT: --
26# CHECK-INF-NEXT: [[FILE]] --gtest_filter=[[TEST]]
27# CHECK-INF-NEXT: --
28# CHECK-INF: Timed Out: 1
29
30###############################################################################
31# Check tests can complete with a timeout set
32#
33# `QuickSubTest` should execute quickly so we shouldn't wait anywhere near the
34# 3600 second timeout.
35###############################################################################
36
37# RUN: %{lit} -j 1 -v %{inputs}/googletest-timeout \
38# RUN:   --filter=QuickSubTest --timeout=3600 > %t.cmd.out
39# RUN: FileCheck --check-prefix=CHECK-QUICK < %t.cmd.out %s
40
41# CHECK-QUICK: PASS: googletest-timeout :: {{[Dd]ummy[Ss]ub[Dd]ir}}/OneTest.py/T.QuickSubTest
42# CHECK-QUICK: Passed : 1
43
44# Test per test timeout via a config file and on the command line.
45# The value set on the command line should override the config file.
46# RUN: %{lit} -j 1 -v %{inputs}/googletest-timeout --filter=QuickSubTest \
47# RUN:   --param set_timeout=1 --timeout=3600 \
48# RUN:   > %t.cmdover.out 2> %t.cmdover.err
49# RUN: FileCheck --check-prefix=CHECK-QUICK < %t.cmdover.out %s
50# RUN: FileCheck --check-prefix=CHECK-CMDLINE-OVERRIDE-ERR < %t.cmdover.err %s
51
52# CHECK-CMDLINE-OVERRIDE-ERR: Forcing timeout to be 3600 seconds
53