From 58b166325c2a3e60b72d557c250e7fc22c459a77 Mon Sep 17 00:00:00 2001 From: Jonas Devlieghere Date: Mon, 29 Apr 2019 21:03:39 +0000 Subject: [PATCH] [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 --- lldb/lit/lit.cfg.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/lldb/lit/lit.cfg.py b/lldb/lit/lit.cfg.py index 8f89a1258704..51d02aabe136 100644 --- a/lldb/lit/lit.cfg.py +++ b/lldb/lit/lit.cfg.py @@ -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.