[lit] Implement support of per test timeout in lit.
authorDan Liew <dan@su-root.co.uk>
Sun, 27 Dec 2015 14:03:49 +0000 (14:03 +0000)
committerDan Liew <dan@su-root.co.uk>
Sun, 27 Dec 2015 14:03:49 +0000 (14:03 +0000)
commitd3bcf04e8331314fbfec3f0af41e137b6bd242c7
treeef96b14e291d7f2dd7c23b76294e6762a6a06d0f
parent3f202fdf9eea174a8be886b51074814289a822df
[lit] Implement support of per test timeout in lit.

This should work with ShTest (executed externally or internally) and GTest
test formats.

To set the timeout a new option ``--timeout=`` has
been added which specifies the maximum run time of an individual test
in seconds. By default this 0 which causes no timeout to be enforced.

The timeout can also be set from a lit configuration file by modifying
the ``lit_config.maxIndividualTestTime`` property.

To implement a timeout we now require the psutil Python module if a
 timeout is requested. This dependency is confined to the newly added
 ``lit.util.killProcessAndChildren()``. A note has been added into the
 TODO document describing how we can remove the dependency on the
 ``pustil`` module in the future. It would be nice to remove this
 immediately but that is a lot more work and Daniel Dunbar believes it is
better that we get a working implementation first and then improve it.

To avoid breaking the existing behaviour the psutil module will not be
imported if no timeout is requested.

The included testcases are derived from test cases provided by
 Jonathan Roelofs which were in an previous attempt to add a per test
 timeout to lit (http://reviews.llvm.org/D6584). Thanks Jonathan!

Reviewers: ddunbar, jroelofs, cmatthews, MatzeB

Subscribers: cmatthews, llvm-commits

Differential Revision: http://reviews.llvm.org/D14706

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@256471 91177308-0d34-0410-b5e6-96231b3b80d8
17 files changed:
utils/lit/TODO
utils/lit/lit/LitConfig.py
utils/lit/lit/Test.py
utils/lit/lit/TestRunner.py
utils/lit/lit/formats/googletest.py
utils/lit/lit/main.py
utils/lit/lit/util.py
utils/lit/tests/Inputs/googletest-timeout/DummySubDir/OneTest [new file with mode: 0755]
utils/lit/tests/Inputs/googletest-timeout/lit.cfg [new file with mode: 0644]
utils/lit/tests/Inputs/shtest-timeout/infinite_loop.py [new file with mode: 0644]
utils/lit/tests/Inputs/shtest-timeout/lit.cfg [new file with mode: 0644]
utils/lit/tests/Inputs/shtest-timeout/quick_then_slow.py [new file with mode: 0644]
utils/lit/tests/Inputs/shtest-timeout/short.py [new file with mode: 0644]
utils/lit/tests/Inputs/shtest-timeout/slow.py [new file with mode: 0644]
utils/lit/tests/googletest-timeout.py [new file with mode: 0644]
utils/lit/tests/lit.cfg
utils/lit/tests/shtest-timeout.py [new file with mode: 0644]