Home | History | Annotate | Download | only in tests
      1 # REQUIRES: python-psutil
      2 
      3 # Test per test timeout using external shell
      4 # RUN: not %{lit} \
      5 # RUN: %{inputs}/shtest-timeout/infinite_loop.py \
      6 # RUN: %{inputs}/shtest-timeout/quick_then_slow.py \
      7 # RUN: %{inputs}/shtest-timeout/short.py \
      8 # RUN: %{inputs}/shtest-timeout/slow.py \
      9 # RUN: -j 1 -v --debug --timeout 1 --param external=1 > %t.extsh.out 2> %t.extsh.err
     10 # RUN: FileCheck --check-prefix=CHECK-OUT-COMMON < %t.extsh.out %s
     11 # RUN: FileCheck --check-prefix=CHECK-EXTSH-ERR < %t.extsh.err %s
     12 #
     13 # CHECK-EXTSH-ERR: Using external shell
     14 
     15 # Test per test timeout using internal shell
     16 # RUN: not %{lit} \
     17 # RUN: %{inputs}/shtest-timeout/infinite_loop.py \
     18 # RUN: %{inputs}/shtest-timeout/quick_then_slow.py \
     19 # RUN: %{inputs}/shtest-timeout/short.py \
     20 # RUN: %{inputs}/shtest-timeout/slow.py \
     21 # RUN: -j 1 -v --debug --timeout 1 --param external=0 > %t.intsh.out 2> %t.intsh.err
     22 # RUN: FileCheck  --check-prefix=CHECK-OUT-COMMON < %t.intsh.out %s
     23 # RUN: FileCheck --check-prefix=CHECK-INTSH-OUT < %t.intsh.out %s
     24 # RUN: FileCheck --check-prefix=CHECK-INTSH-ERR < %t.intsh.err %s
     25 #
     26 # CHECK-INTSH-OUT: TIMEOUT: per_test_timeout :: infinite_loop.py
     27 # CHECK-INTSH-OUT: Command 0 Reached Timeout: True
     28 # CHECK-INTSH-OUT: Command 0 Output:
     29 # CHECK-INTSH-OUT-NEXT: Running infinite loop
     30 
     31 
     32 # CHECK-INTSH-OUT: TIMEOUT: per_test_timeout :: quick_then_slow.py
     33 # CHECK-INTSH-OUT: Timeout: Reached timeout of 1 seconds
     34 # CHECK-INTSH-OUT: Command Output
     35 # CHECK-INTSH-OUT: Command 0 Reached Timeout: False
     36 # CHECK-INTSH-OUT: Command 0 Output:
     37 # CHECK-INTSH-OUT-NEXT: Running in quick mode
     38 # CHECK-INTSH-OUT: Command 1 Reached Timeout: True
     39 # CHECK-INTSH-OUT: Command 1 Output:
     40 # CHECK-INTSH-OUT-NEXT: Running in slow mode
     41 
     42 # CHECK-INTSH-OUT: TIMEOUT: per_test_timeout :: slow.py
     43 # CHECK-INTSH-OUT: Command 0 Reached Timeout: True
     44 # CHECK-INTSH-OUT: Command 0 Output:
     45 # CHECK-INTSH-OUT-NEXT: Running slow program
     46 
     47 # CHECK-INTSH-ERR: Using internal shell
     48 
     49 # Test per test timeout set via a config file rather than on the command line
     50 # RUN: not %{lit} \
     51 # RUN: %{inputs}/shtest-timeout/infinite_loop.py \
     52 # RUN: %{inputs}/shtest-timeout/quick_then_slow.py \
     53 # RUN: %{inputs}/shtest-timeout/short.py \
     54 # RUN: %{inputs}/shtest-timeout/slow.py \
     55 # RUN: -j 1 -v --debug --param external=0 \
     56 # RUN: --param set_timeout=1 > %t.cfgset.out 2> %t.cfgset.err
     57 # RUN: FileCheck --check-prefix=CHECK-OUT-COMMON  < %t.cfgset.out %s
     58 # RUN: FileCheck --check-prefix=CHECK-CFGSET-ERR < %t.cfgset.err %s
     59 #
     60 # CHECK-CFGSET-ERR: Using internal shell
     61 
     62 # CHECK-OUT-COMMON: TIMEOUT: per_test_timeout :: infinite_loop.py
     63 # CHECK-OUT-COMMON: Timeout: Reached timeout of 1 seconds
     64 # CHECK-OUT-COMMON: Command {{([0-9]+ )?}}Output
     65 # CHECK-OUT-COMMON: Running infinite loop
     66 
     67 # CHECK-OUT-COMMON: TIMEOUT: per_test_timeout :: quick_then_slow.py
     68 # CHECK-OUT-COMMON: Timeout: Reached timeout of 1 seconds
     69 # CHECK-OUT-COMMON: Command {{([0-9]+ )?}}Output
     70 # CHECK-OUT-COMMON: Running in quick mode
     71 # CHECK-OUT-COMMON: Running in slow mode
     72 
     73 # CHECK-OUT-COMMON: PASS: per_test_timeout :: short.py
     74 
     75 # CHECK-OUT-COMMON: TIMEOUT: per_test_timeout :: slow.py
     76 # CHECK-OUT-COMMON: Timeout: Reached timeout of 1 seconds
     77 # CHECK-OUT-COMMON: Command {{([0-9]+ )?}}Output
     78 # CHECK-OUT-COMMON: Running slow program
     79 
     80 # CHECK-OUT-COMMON: Expected Passes{{ *}}: 1
     81 # CHECK-OUT-COMMON: Individual Timeouts{{ *}}: 3
     82 
     83 # Test per test timeout via a config file and on the command line.
     84 # The value set on the command line should override the config file.
     85 # RUN: not %{lit} \
     86 # RUN: %{inputs}/shtest-timeout/infinite_loop.py \
     87 # RUN: %{inputs}/shtest-timeout/quick_then_slow.py \
     88 # RUN: %{inputs}/shtest-timeout/short.py \
     89 # RUN: %{inputs}/shtest-timeout/slow.py \
     90 # RUN: -j 1 -v --debug --param external=0 \
     91 # RUN: --param set_timeout=1 --timeout=2 > %t.cmdover.out 2> %t.cmdover.err
     92 # RUN: FileCheck --check-prefix=CHECK-CMDLINE-OVERRIDE-OUT  < %t.cmdover.out %s
     93 # RUN: FileCheck --check-prefix=CHECK-CMDLINE-OVERRIDE-ERR < %t.cmdover.err %s
     94 
     95 # CHECK-CMDLINE-OVERRIDE-ERR: Forcing timeout to be 2 seconds
     96 
     97 # CHECK-CMDLINE-OVERRIDE-OUT: TIMEOUT: per_test_timeout :: infinite_loop.py
     98 # CHECK-CMDLINE-OVERRIDE-OUT: Timeout: Reached timeout of 2 seconds
     99 # CHECK-CMDLINE-OVERRIDE-OUT: Command {{([0-9]+ )?}}Output
    100 # CHECK-CMDLINE-OVERRIDE-OUT: Running infinite loop
    101 
    102 # CHECK-CMDLINE-OVERRIDE-OUT: TIMEOUT: per_test_timeout :: quick_then_slow.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 in quick mode
    106 # CHECK-CMDLINE-OVERRIDE-OUT: Running in slow mode
    107 
    108 # CHECK-CMDLINE-OVERRIDE-OUT: PASS: per_test_timeout :: short.py
    109 
    110 # CHECK-CMDLINE-OVERRIDE-OUT: TIMEOUT: per_test_timeout :: slow.py
    111 # CHECK-CMDLINE-OVERRIDE-OUT: Timeout: Reached timeout of 2 seconds
    112 # CHECK-CMDLINE-OVERRIDE-OUT: Command {{([0-9]+ )?}}Output
    113 # CHECK-CMDLINE-OVERRIDE-OUT: Running slow program
    114 
    115 # CHECK-CMDLINE-OVERRIDE-OUT: Expected Passes{{ *}}: 1
    116 # CHECK-CMDLINE-OVERRIDE-OUT: Individual Timeouts{{ *}}: 3
    117