blob: 9ed8ebe8ddd84cd6e4c6dafdc9900658c3482f7e [file] [log] [blame]
Dan Liew75742412015-12-27 14:03:49 +00001# REQUIRES: python-psutil
Dan Liew8ade9e72018-03-28 13:55:13 +00002
Stella Stamenova4f780ea2018-09-10 20:24:05 +00003# llvm.org/PR33944
4# REQUIRES: nowindows
Stella Stamenova4f03fb12018-08-07 21:21:30 +00005
Dan Liew6dfcc782018-05-22 15:06:29 +00006# FIXME: This test is fragile because it relies on time which can
7# be affected by system performance. In particular we are currently
8# assuming that `short.py` can be successfully executed within 2
9# seconds of wallclock time.
10
Dan Liew75742412015-12-27 14:03:49 +000011# Test per test timeout using external shell
12# RUN: not %{lit} \
13# RUN: %{inputs}/shtest-timeout/infinite_loop.py \
Dan Liew75742412015-12-27 14:03:49 +000014# RUN: %{inputs}/shtest-timeout/short.py \
Dan Liew6dfcc782018-05-22 15:06:29 +000015# RUN: -j 1 -v --debug --timeout 2 --param external=1 > %t.extsh.out 2> %t.extsh.err
Dan Liew75742412015-12-27 14:03:49 +000016# 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 \
Dan Liew75742412015-12-27 14:03:49 +000024# RUN: %{inputs}/shtest-timeout/short.py \
Dan Liew6dfcc782018-05-22 15:06:29 +000025# RUN: -j 1 -v --debug --timeout 2 --param external=0 > %t.intsh.out 2> %t.intsh.err
Dan Liew75742412015-12-27 14:03:49 +000026# RUN: FileCheck --check-prefix=CHECK-OUT-COMMON < %t.intsh.out %s
27# RUN: FileCheck --check-prefix=CHECK-INTSH-OUT < %t.intsh.out %s
28# RUN: FileCheck --check-prefix=CHECK-INTSH-ERR < %t.intsh.err %s
Dan Liew75742412015-12-27 14:03:49 +000029
Michal Gorny1d62f4a2016-10-12 21:40:08 +000030# CHECK-INTSH-OUT: TIMEOUT: per_test_timeout :: infinite_loop.py
31# CHECK-INTSH-OUT: command output:
Michal Gorny1d62f4a2016-10-12 21:40:08 +000032# CHECK-INTSH-OUT: command reached timeout: True
Dan Liew75742412015-12-27 14:03:49 +000033
Dan Liew75742412015-12-27 14:03:49 +000034# CHECK-INTSH-ERR: Using internal shell
35
36# Test per test timeout set via a config file rather than on the command line
37# RUN: not %{lit} \
38# RUN: %{inputs}/shtest-timeout/infinite_loop.py \
Dan Liew75742412015-12-27 14:03:49 +000039# RUN: %{inputs}/shtest-timeout/short.py \
Dan Liew75742412015-12-27 14:03:49 +000040# RUN: -j 1 -v --debug --param external=0 \
Dan Liew6dfcc782018-05-22 15:06:29 +000041# RUN: --param set_timeout=2 > %t.cfgset.out 2> %t.cfgset.err
Dan Liew75742412015-12-27 14:03:49 +000042# RUN: FileCheck --check-prefix=CHECK-OUT-COMMON < %t.cfgset.out %s
43# RUN: FileCheck --check-prefix=CHECK-CFGSET-ERR < %t.cfgset.err %s
44#
45# CHECK-CFGSET-ERR: Using internal shell
46
47# CHECK-OUT-COMMON: TIMEOUT: per_test_timeout :: infinite_loop.py
Dan Liew6dfcc782018-05-22 15:06:29 +000048# CHECK-OUT-COMMON: Timeout: Reached timeout of 2 seconds
Dan Liew75742412015-12-27 14:03:49 +000049# CHECK-OUT-COMMON: Command {{([0-9]+ )?}}Output
Dan Liew75742412015-12-27 14:03:49 +000050
Dan Liew75742412015-12-27 14:03:49 +000051# CHECK-OUT-COMMON: PASS: per_test_timeout :: short.py
52
Dan Liew75742412015-12-27 14:03:49 +000053# CHECK-OUT-COMMON: Expected Passes{{ *}}: 1
Dan Liew9f778682018-05-22 15:06:24 +000054# CHECK-OUT-COMMON: Individual Timeouts{{ *}}: 1
Dan Liew75742412015-12-27 14:03:49 +000055
56# Test per test timeout via a config file and on the command line.
57# The value set on the command line should override the config file.
58# RUN: not %{lit} \
59# RUN: %{inputs}/shtest-timeout/infinite_loop.py \
Dan Liew75742412015-12-27 14:03:49 +000060# RUN: %{inputs}/shtest-timeout/short.py \
Dan Liew75742412015-12-27 14:03:49 +000061# RUN: -j 1 -v --debug --param external=0 \
62# RUN: --param set_timeout=1 --timeout=2 > %t.cmdover.out 2> %t.cmdover.err
63# RUN: FileCheck --check-prefix=CHECK-CMDLINE-OVERRIDE-OUT < %t.cmdover.out %s
64# RUN: FileCheck --check-prefix=CHECK-CMDLINE-OVERRIDE-ERR < %t.cmdover.err %s
65
66# CHECK-CMDLINE-OVERRIDE-ERR: Forcing timeout to be 2 seconds
67
68# CHECK-CMDLINE-OVERRIDE-OUT: TIMEOUT: per_test_timeout :: infinite_loop.py
69# CHECK-CMDLINE-OVERRIDE-OUT: Timeout: Reached timeout of 2 seconds
70# CHECK-CMDLINE-OVERRIDE-OUT: Command {{([0-9]+ )?}}Output
Dan Liew75742412015-12-27 14:03:49 +000071
Dan Liew75742412015-12-27 14:03:49 +000072# CHECK-CMDLINE-OVERRIDE-OUT: PASS: per_test_timeout :: short.py
73
Dan Liew75742412015-12-27 14:03:49 +000074# CHECK-CMDLINE-OVERRIDE-OUT: Expected Passes{{ *}}: 1
Dan Liew9f778682018-05-22 15:06:24 +000075# CHECK-CMDLINE-OVERRIDE-OUT: Individual Timeouts{{ *}}: 1