[lit] Check for the psutil module when setting a timeout

Apparently setting the per-test-timeout and not having the psutil
package constitutes to a fatal error. So only set the timeout when the
module is available.

llvm-svn: 359503
This commit is contained in:
Jonas Devlieghere 2019-04-29 21:03:39 +00:00
parent e9bc35fe06
commit 58b166325c

View File

@ -74,8 +74,14 @@ for i in ['module-cache-clang', 'module-cache-lldb']:
print("Deleting module cache at %s."%cachedir)
shutil.rmtree(cachedir)
# Set a default timeout of 10 minutes.
lit_config.maxIndividualTestTime = 600
# Set a default per-test timeout of 10 minutes. Setting a timeout per test
# requires the psutil module and lit complains if the value is set but the
# module can't be found.
try:
import psutil # noqa: F401
lit_config.maxIndividualTestTime = 600
except ImportError:
pass
# If running tests natively, check for CPU features needed for some tests.