blob: 87985006590898fd8afa63e9b22215b000839616 [file] [log] [blame]
Dan Liew75742412015-12-27 14:03:49 +00001# REQUIRES: python-psutil
2
Brian Gesiak07872532017-07-26 15:10:50 +00003# PR33944
4# XFAIL: windows
5
Dan Liew75742412015-12-27 14:03:49 +00006# Test per test timeout using external shell
7# RUN: not %{lit} \
8# RUN: %{inputs}/shtest-timeout/infinite_loop.py \
9# RUN: %{inputs}/shtest-timeout/quick_then_slow.py \
10# RUN: %{inputs}/shtest-timeout/short.py \
11# RUN: %{inputs}/shtest-timeout/slow.py \
12# RUN: -j 1 -v --debug --timeout 1 --param external=1 > %t.extsh.out 2> %t.extsh.err
13# RUN: FileCheck --check-prefix=CHECK-OUT-COMMON < %t.extsh.out %s
14# RUN: FileCheck --check-prefix=CHECK-EXTSH-ERR < %t.extsh.err %s
15#
16# CHECK-EXTSH-ERR: Using external shell
17
18# Test per test timeout using internal shell
19# RUN: not %{lit} \
20# RUN: %{inputs}/shtest-timeout/infinite_loop.py \
21# RUN: %{inputs}/shtest-timeout/quick_then_slow.py \
22# RUN: %{inputs}/shtest-timeout/short.py \
23# RUN: %{inputs}/shtest-timeout/slow.py \
24# RUN: -j 1 -v --debug --timeout 1 --param external=0 > %t.intsh.out 2> %t.intsh.err
25# RUN: FileCheck --check-prefix=CHECK-OUT-COMMON < %t.intsh.out %s
26# RUN: FileCheck --check-prefix=CHECK-INTSH-OUT < %t.intsh.out %s
27# RUN: FileCheck --check-prefix=CHECK-INTSH-ERR < %t.intsh.err %s
Dan Liew75742412015-12-27 14:03:49 +000028
Michal Gorny1d62f4a2016-10-12 21:40:08 +000029# CHECK-INTSH-OUT: TIMEOUT: per_test_timeout :: infinite_loop.py
30# CHECK-INTSH-OUT: command output:
31# CHECK-INTSH-OUT-NEXT: Running infinite loop
32# CHECK-INTSH-OUT: command reached timeout: True
Dan Liew75742412015-12-27 14:03:49 +000033
34# CHECK-INTSH-OUT: TIMEOUT: per_test_timeout :: quick_then_slow.py
35# CHECK-INTSH-OUT: Timeout: Reached timeout of 1 seconds
36# CHECK-INTSH-OUT: Command Output
Michal Gorny1d62f4a2016-10-12 21:40:08 +000037# CHECK-INTSH-OUT: command output:
Dan Liew75742412015-12-27 14:03:49 +000038# CHECK-INTSH-OUT-NEXT: Running in quick mode
Michal Gorny1d62f4a2016-10-12 21:40:08 +000039# CHECK-INTSH-OUT: command reached timeout: False
40# CHECK-INTSH-OUT: command output:
Dan Liew75742412015-12-27 14:03:49 +000041# CHECK-INTSH-OUT-NEXT: Running in slow mode
Michal Gorny1d62f4a2016-10-12 21:40:08 +000042# CHECK-INTSH-OUT: command reached timeout: True
Dan Liew75742412015-12-27 14:03:49 +000043
44# CHECK-INTSH-OUT: TIMEOUT: per_test_timeout :: slow.py
Michal Gorny1d62f4a2016-10-12 21:40:08 +000045# CHECK-INTSH-OUT: command output:
Dan Liew75742412015-12-27 14:03:49 +000046# CHECK-INTSH-OUT-NEXT: Running slow program
Michal Gorny1d62f4a2016-10-12 21:40:08 +000047# CHECK-INTSH-OUT: command reached timeout: True
Dan Liew75742412015-12-27 14:03:49 +000048
49# CHECK-INTSH-ERR: Using internal shell
50
51# Test per test timeout set via a config file rather than on the command line
52# RUN: not %{lit} \
53# RUN: %{inputs}/shtest-timeout/infinite_loop.py \
54# RUN: %{inputs}/shtest-timeout/quick_then_slow.py \
55# RUN: %{inputs}/shtest-timeout/short.py \
56# RUN: %{inputs}/shtest-timeout/slow.py \
57# RUN: -j 1 -v --debug --param external=0 \
58# RUN: --param set_timeout=1 > %t.cfgset.out 2> %t.cfgset.err
59# RUN: FileCheck --check-prefix=CHECK-OUT-COMMON < %t.cfgset.out %s
60# RUN: FileCheck --check-prefix=CHECK-CFGSET-ERR < %t.cfgset.err %s
61#
62# CHECK-CFGSET-ERR: Using internal shell
63
64# CHECK-OUT-COMMON: TIMEOUT: per_test_timeout :: infinite_loop.py
65# CHECK-OUT-COMMON: Timeout: Reached timeout of 1 seconds
66# CHECK-OUT-COMMON: Command {{([0-9]+ )?}}Output
67# CHECK-OUT-COMMON: Running infinite loop
68
69# CHECK-OUT-COMMON: TIMEOUT: per_test_timeout :: quick_then_slow.py
70# CHECK-OUT-COMMON: Timeout: Reached timeout of 1 seconds
71# CHECK-OUT-COMMON: Command {{([0-9]+ )?}}Output
72# CHECK-OUT-COMMON: Running in quick mode
73# CHECK-OUT-COMMON: Running in slow mode
74
75# CHECK-OUT-COMMON: PASS: per_test_timeout :: short.py
76
77# CHECK-OUT-COMMON: TIMEOUT: per_test_timeout :: slow.py
78# CHECK-OUT-COMMON: Timeout: Reached timeout of 1 seconds
79# CHECK-OUT-COMMON: Command {{([0-9]+ )?}}Output
80# CHECK-OUT-COMMON: Running slow program
81
82# CHECK-OUT-COMMON: Expected Passes{{ *}}: 1
83# CHECK-OUT-COMMON: Individual Timeouts{{ *}}: 3
84
85# Test per test timeout via a config file and on the command line.
86# The value set on the command line should override the config file.
87# RUN: not %{lit} \
88# RUN: %{inputs}/shtest-timeout/infinite_loop.py \
89# RUN: %{inputs}/shtest-timeout/quick_then_slow.py \
90# RUN: %{inputs}/shtest-timeout/short.py \
91# RUN: %{inputs}/shtest-timeout/slow.py \
92# RUN: -j 1 -v --debug --param external=0 \
93# RUN: --param set_timeout=1 --timeout=2 > %t.cmdover.out 2> %t.cmdover.err
94# RUN: FileCheck --check-prefix=CHECK-CMDLINE-OVERRIDE-OUT < %t.cmdover.out %s
95# RUN: FileCheck --check-prefix=CHECK-CMDLINE-OVERRIDE-ERR < %t.cmdover.err %s
96
97# CHECK-CMDLINE-OVERRIDE-ERR: Forcing timeout to be 2 seconds
98
99# CHECK-CMDLINE-OVERRIDE-OUT: TIMEOUT: per_test_timeout :: infinite_loop.py
100# CHECK-CMDLINE-OVERRIDE-OUT: Timeout: Reached timeout of 2 seconds
101# CHECK-CMDLINE-OVERRIDE-OUT: Command {{([0-9]+ )?}}Output
102# CHECK-CMDLINE-OVERRIDE-OUT: Running infinite loop
103
104# CHECK-CMDLINE-OVERRIDE-OUT: TIMEOUT: per_test_timeout :: quick_then_slow.py
105# CHECK-CMDLINE-OVERRIDE-OUT: Timeout: Reached timeout of 2 seconds
106# CHECK-CMDLINE-OVERRIDE-OUT: Command {{([0-9]+ )?}}Output
107# CHECK-CMDLINE-OVERRIDE-OUT: Running in quick mode
108# CHECK-CMDLINE-OVERRIDE-OUT: Running in slow mode
109
110# CHECK-CMDLINE-OVERRIDE-OUT: PASS: per_test_timeout :: short.py
111
112# CHECK-CMDLINE-OVERRIDE-OUT: TIMEOUT: per_test_timeout :: slow.py
113# CHECK-CMDLINE-OVERRIDE-OUT: Timeout: Reached timeout of 2 seconds
114# CHECK-CMDLINE-OVERRIDE-OUT: Command {{([0-9]+ )?}}Output
115# CHECK-CMDLINE-OVERRIDE-OUT: Running slow program
116
117# CHECK-CMDLINE-OVERRIDE-OUT: Expected Passes{{ *}}: 1
118# CHECK-CMDLINE-OVERRIDE-OUT: Individual Timeouts{{ *}}: 3