diff options
| author | Dan Liew <dan@su-root.co.uk> | 2018-05-22 15:06:29 +0000 | 
|---|---|---|
| committer | Dan Liew <dan@su-root.co.uk> | 2018-05-22 15:06:29 +0000 | 
| commit | 6dfcc78364fa3e8104d6e6634733863eb0bf4be8 (patch) | |
| tree | 56ad60ebc213963d3f0c92be50c8470129cd8b75 /llvm/utils/lit | |
| parent | 9f7786855cad66b5fa2280fc5dc4e8833a6b0747 (diff) | |
| download | bcm5719-llvm-6dfcc78364fa3e8104d6e6634733863eb0bf4be8.tar.gz bcm5719-llvm-6dfcc78364fa3e8104d6e6634733863eb0bf4be8.zip | |
[lit] Try to make `shtest-timeout.py` test more reliable by using a
larger timeout value. This really isn't very good because it will
still be susceptible to machine performance.
While we are here also fix a bug in validation of
`maxIndividualTestTime` where previously it wasn't checked if the
type was an int.
rdar://problem/40221572
llvm-svn: 332987
Diffstat (limited to 'llvm/utils/lit')
| -rw-r--r-- | llvm/utils/lit/lit/LitConfig.py | 2 | ||||
| -rw-r--r-- | llvm/utils/lit/tests/Inputs/shtest-timeout/lit.cfg | 4 | ||||
| -rw-r--r-- | llvm/utils/lit/tests/shtest-timeout.py | 13 | 
3 files changed, 13 insertions, 6 deletions
| diff --git a/llvm/utils/lit/lit/LitConfig.py b/llvm/utils/lit/lit/LitConfig.py index 389e5652e9b..e8fb1533a86 100644 --- a/llvm/utils/lit/lit/LitConfig.py +++ b/llvm/utils/lit/lit/LitConfig.py @@ -83,6 +83,8 @@ class LitConfig(object):              Interface for setting maximum time to spend executing              a single test          """ +        if not isinstance(value, int): +            self.fatal('maxIndividualTestTime must set to a value of type int.')          self._maxIndividualTestTime = value          if self.maxIndividualTestTime > 0:              # The current implementation needs psutil to set diff --git a/llvm/utils/lit/tests/Inputs/shtest-timeout/lit.cfg b/llvm/utils/lit/tests/Inputs/shtest-timeout/lit.cfg index 81b4a12120d..c3a1c3b96ad 100644 --- a/llvm/utils/lit/tests/Inputs/shtest-timeout/lit.cfg +++ b/llvm/utils/lit/tests/Inputs/shtest-timeout/lit.cfg @@ -17,9 +17,9 @@ else:  configSetTimeout = lit_config.params.get('set_timeout', '0') -if configSetTimeout == '1': +if configSetTimeout != '0':      # Try setting the max individual test time in the configuration -    lit_config.maxIndividualTestTime = 1 +    lit_config.maxIndividualTestTime = int(configSetTimeout)  config.test_format = lit.formats.ShTest(execute_external=externalShell)  config.suffixes = ['.py'] diff --git a/llvm/utils/lit/tests/shtest-timeout.py b/llvm/utils/lit/tests/shtest-timeout.py index 81fe798349c..2f1fc3d17c0 100644 --- a/llvm/utils/lit/tests/shtest-timeout.py +++ b/llvm/utils/lit/tests/shtest-timeout.py @@ -3,11 +3,16 @@  # PR33944  # XFAIL: windows +# FIXME: This test is fragile because it relies on time which can +# be affected by system performance. In particular we are currently +# assuming that `short.py` can be successfully executed within 2 +# seconds of wallclock time. +  # Test per test timeout using external shell  # RUN: not %{lit} \  # RUN: %{inputs}/shtest-timeout/infinite_loop.py \  # RUN: %{inputs}/shtest-timeout/short.py \ -# RUN: -j 1 -v --debug --timeout 1 --param external=1 > %t.extsh.out 2> %t.extsh.err +# RUN: -j 1 -v --debug --timeout 2 --param external=1 > %t.extsh.out 2> %t.extsh.err  # RUN: FileCheck --check-prefix=CHECK-OUT-COMMON < %t.extsh.out %s  # RUN: FileCheck --check-prefix=CHECK-EXTSH-ERR < %t.extsh.err %s  # @@ -17,7 +22,7 @@  # RUN: not %{lit} \  # RUN: %{inputs}/shtest-timeout/infinite_loop.py \  # RUN: %{inputs}/shtest-timeout/short.py \ -# RUN: -j 1 -v --debug --timeout 1 --param external=0 > %t.intsh.out 2> %t.intsh.err +# RUN: -j 1 -v --debug --timeout 2 --param external=0 > %t.intsh.out 2> %t.intsh.err  # RUN: FileCheck  --check-prefix=CHECK-OUT-COMMON < %t.intsh.out %s  # RUN: FileCheck --check-prefix=CHECK-INTSH-OUT < %t.intsh.out %s  # RUN: FileCheck --check-prefix=CHECK-INTSH-ERR < %t.intsh.err %s @@ -33,14 +38,14 @@  # RUN: %{inputs}/shtest-timeout/infinite_loop.py \  # RUN: %{inputs}/shtest-timeout/short.py \  # RUN: -j 1 -v --debug --param external=0 \ -# RUN: --param set_timeout=1 > %t.cfgset.out 2> %t.cfgset.err +# RUN: --param set_timeout=2 > %t.cfgset.out 2> %t.cfgset.err  # RUN: FileCheck --check-prefix=CHECK-OUT-COMMON  < %t.cfgset.out %s  # RUN: FileCheck --check-prefix=CHECK-CFGSET-ERR < %t.cfgset.err %s  #  # CHECK-CFGSET-ERR: Using internal shell  # CHECK-OUT-COMMON: TIMEOUT: per_test_timeout :: infinite_loop.py -# CHECK-OUT-COMMON: Timeout: Reached timeout of 1 seconds +# CHECK-OUT-COMMON: Timeout: Reached timeout of 2 seconds  # CHECK-OUT-COMMON: Command {{([0-9]+ )?}}Output  # CHECK-OUT-COMMON: PASS: per_test_timeout :: short.py | 

