Dan Liew | 7574241 | 2015-12-27 14:03:49 +0000 | [diff] [blame] | 1 | # REQUIRES: python-psutil |
Dan Liew | 8ade9e7 | 2018-03-28 13:55:13 +0000 | [diff] [blame] | 2 | |
Stella Stamenova | 4f780ea | 2018-09-10 20:24:05 +0000 | [diff] [blame] | 3 | # llvm.org/PR33944 |
| 4 | # REQUIRES: nowindows |
Stella Stamenova | 4f03fb1 | 2018-08-07 21:21:30 +0000 | [diff] [blame] | 5 | |
Dan Liew | 6dfcc78 | 2018-05-22 15:06:29 +0000 | [diff] [blame] | 6 | # 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 Liew | 7574241 | 2015-12-27 14:03:49 +0000 | [diff] [blame] | 11 | # Test per test timeout using external shell |
| 12 | # RUN: not %{lit} \ |
| 13 | # RUN: %{inputs}/shtest-timeout/infinite_loop.py \ |
Dan Liew | 7574241 | 2015-12-27 14:03:49 +0000 | [diff] [blame] | 14 | # RUN: %{inputs}/shtest-timeout/short.py \ |
Dan Liew | 6dfcc78 | 2018-05-22 15:06:29 +0000 | [diff] [blame] | 15 | # RUN: -j 1 -v --debug --timeout 2 --param external=1 > %t.extsh.out 2> %t.extsh.err |
Dan Liew | 7574241 | 2015-12-27 14:03:49 +0000 | [diff] [blame] | 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 \ |
Dan Liew | 7574241 | 2015-12-27 14:03:49 +0000 | [diff] [blame] | 24 | # RUN: %{inputs}/shtest-timeout/short.py \ |
Dan Liew | 6dfcc78 | 2018-05-22 15:06:29 +0000 | [diff] [blame] | 25 | # RUN: -j 1 -v --debug --timeout 2 --param external=0 > %t.intsh.out 2> %t.intsh.err |
Dan Liew | 7574241 | 2015-12-27 14:03:49 +0000 | [diff] [blame] | 26 | # 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 Liew | 7574241 | 2015-12-27 14:03:49 +0000 | [diff] [blame] | 29 | |
Michal Gorny | 1d62f4a | 2016-10-12 21:40:08 +0000 | [diff] [blame] | 30 | # CHECK-INTSH-OUT: TIMEOUT: per_test_timeout :: infinite_loop.py |
| 31 | # CHECK-INTSH-OUT: command output: |
Michal Gorny | 1d62f4a | 2016-10-12 21:40:08 +0000 | [diff] [blame] | 32 | # CHECK-INTSH-OUT: command reached timeout: True |
Dan Liew | 7574241 | 2015-12-27 14:03:49 +0000 | [diff] [blame] | 33 | |
Dan Liew | 7574241 | 2015-12-27 14:03:49 +0000 | [diff] [blame] | 34 | # 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 Liew | 7574241 | 2015-12-27 14:03:49 +0000 | [diff] [blame] | 39 | # RUN: %{inputs}/shtest-timeout/short.py \ |
Dan Liew | 7574241 | 2015-12-27 14:03:49 +0000 | [diff] [blame] | 40 | # RUN: -j 1 -v --debug --param external=0 \ |
Dan Liew | 6dfcc78 | 2018-05-22 15:06:29 +0000 | [diff] [blame] | 41 | # RUN: --param set_timeout=2 > %t.cfgset.out 2> %t.cfgset.err |
Dan Liew | 7574241 | 2015-12-27 14:03:49 +0000 | [diff] [blame] | 42 | # 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 Liew | 6dfcc78 | 2018-05-22 15:06:29 +0000 | [diff] [blame] | 48 | # CHECK-OUT-COMMON: Timeout: Reached timeout of 2 seconds |
Dan Liew | 7574241 | 2015-12-27 14:03:49 +0000 | [diff] [blame] | 49 | # CHECK-OUT-COMMON: Command {{([0-9]+ )?}}Output |
Dan Liew | 7574241 | 2015-12-27 14:03:49 +0000 | [diff] [blame] | 50 | |
Dan Liew | 7574241 | 2015-12-27 14:03:49 +0000 | [diff] [blame] | 51 | # CHECK-OUT-COMMON: PASS: per_test_timeout :: short.py |
| 52 | |
Dan Liew | 7574241 | 2015-12-27 14:03:49 +0000 | [diff] [blame] | 53 | # CHECK-OUT-COMMON: Expected Passes{{ *}}: 1 |
Dan Liew | 9f77868 | 2018-05-22 15:06:24 +0000 | [diff] [blame] | 54 | # CHECK-OUT-COMMON: Individual Timeouts{{ *}}: 1 |
Dan Liew | 7574241 | 2015-12-27 14:03:49 +0000 | [diff] [blame] | 55 | |
| 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 Liew | 7574241 | 2015-12-27 14:03:49 +0000 | [diff] [blame] | 60 | # RUN: %{inputs}/shtest-timeout/short.py \ |
Dan Liew | 7574241 | 2015-12-27 14:03:49 +0000 | [diff] [blame] | 61 | # 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 Liew | 7574241 | 2015-12-27 14:03:49 +0000 | [diff] [blame] | 71 | |
Dan Liew | 7574241 | 2015-12-27 14:03:49 +0000 | [diff] [blame] | 72 | # CHECK-CMDLINE-OVERRIDE-OUT: PASS: per_test_timeout :: short.py |
| 73 | |
Dan Liew | 7574241 | 2015-12-27 14:03:49 +0000 | [diff] [blame] | 74 | # CHECK-CMDLINE-OVERRIDE-OUT: Expected Passes{{ *}}: 1 |
Dan Liew | 9f77868 | 2018-05-22 15:06:24 +0000 | [diff] [blame] | 75 | # CHECK-CMDLINE-OVERRIDE-OUT: Individual Timeouts{{ *}}: 1 |