Debian Codegraph @

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

raw
1 # REQUIRES: lit-max-individual-test-time
2
3 # llvm.org/PR33944
4 # UNSUPPORTED: system-windows
5
6 ###############################################################################
7 # Check tests can hit timeout when set
8 ###############################################################################
9
10 # Test per test timeout using external shell
11 # RUN: not %{lit} \
12 # RUN: %{inputs}/shtest-timeout/infinite_loop.py \
13 # RUN: -j 1 -v --debug --timeout 1 --param external=1 > %t.extsh.out 2> %t.extsh.err
14 # RUN: FileCheck --check-prefix=CHECK-OUT-COMMON < %t.extsh.out %s
15 # RUN: FileCheck --check-prefix=CHECK-EXTSH-ERR < %t.extsh.err %s
16 #
17 # CHECK-EXTSH-ERR: Using external shell
18
19 # Test per test timeout using internal shell
20 # RUN: not %{lit} \
21 # RUN: %{inputs}/shtest-timeout/infinite_loop.py \
22 # RUN: -j 1 -v --debug --timeout 1 --param external=0 > %t.intsh.out 2> %t.intsh.err
23 # RUN: FileCheck --check-prefix=CHECK-OUT-COMMON < %t.intsh.out %s
24 # RUN: FileCheck --check-prefix=CHECK-INTSH-OUT < %t.intsh.out %s
25 # RUN: FileCheck --check-prefix=CHECK-INTSH-ERR < %t.intsh.err %s
26
27 # CHECK-INTSH-OUT: TIMEOUT: per_test_timeout :: infinite_loop.py
28 # CHECK-INTSH-OUT: command reached timeout: True
29
30 # CHECK-INTSH-ERR: Using internal shell
31
32 # Test per test timeout set via a config file rather than on the command line
33 # RUN: not %{lit} \
34 # RUN: %{inputs}/shtest-timeout/infinite_loop.py \
35 # RUN: -j 1 -v --debug --param external=0 \
36 # RUN: --param set_timeout=1 > %t.cfgset.out 2> %t.cfgset.err
37 # RUN: FileCheck --check-prefix=CHECK-OUT-COMMON < %t.cfgset.out %s
38 # RUN: FileCheck --check-prefix=CHECK-CFGSET-ERR < %t.cfgset.err %s
39 #
40 # CHECK-CFGSET-ERR: Using internal shell
41
42 # CHECK-OUT-COMMON: TIMEOUT: per_test_timeout :: infinite_loop.py
43 # CHECK-OUT-COMMON: Timeout: Reached timeout of 1 seconds
44 # CHECK-OUT-COMMON: Timed Out: 1
45
46
47 ###############################################################################
48 # Check tests can complete in with a timeout set
49 #
50 # `short.py` should execute quickly so we shouldn't wait anywhere near the
51 # 3600 second timeout.
52 ###############################################################################
53
54 # Test per test timeout using external shell
55 # RUN: %{lit} \
56 # RUN: %{inputs}/shtest-timeout/short.py \
57 # RUN: -j 1 -v --debug --timeout 3600 --param external=1 > %t.pass.extsh.out 2> %t.pass.extsh.err
58 # RUN: FileCheck --check-prefix=CHECK-OUT-COMMON-SHORT < %t.pass.extsh.out %s
59 # RUN: FileCheck --check-prefix=CHECK-EXTSH-ERR < %t.pass.extsh.err %s
60
61 # Test per test timeout using internal shell
62 # RUN: %{lit} \
63 # RUN: %{inputs}/shtest-timeout/short.py \
64 # RUN: -j 1 -v --debug --timeout 3600 --param external=0 > %t.pass.intsh.out 2> %t.pass.intsh.err
65 # RUN: FileCheck --check-prefix=CHECK-OUT-COMMON-SHORT < %t.pass.intsh.out %s
66 # RUN: FileCheck --check-prefix=CHECK-INTSH-ERR < %t.pass.intsh.err %s
67
68 # CHECK-OUT-COMMON-SHORT: PASS: per_test_timeout :: short.py
69 # CHECK-OUT-COMMON-SHORT: Passed: 1
70
71 # Test per test timeout via a config file and on the command line.
72 # The value set on the command line should override the config file.
73 # RUN: %{lit} \
74 # RUN: %{inputs}/shtest-timeout/short.py \
75 # RUN: -j 1 -v --debug --param external=0 \
76 # RUN: --param set_timeout=1 --timeout=3600 > %t.pass.cmdover.out 2> %t.pass.cmdover.err
77 # RUN: FileCheck --check-prefix=CHECK-OUT-COMMON-SHORT < %t.pass.cmdover.out %s
78 # RUN: FileCheck --check-prefix=CHECK-CMDLINE-OVERRIDE-ERR < %t.pass.cmdover.err %s
79
80 # CHECK-CMDLINE-OVERRIDE-ERR: Forcing timeout to be 3600 seconds