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