diff options
author | Dan Liew <dan@su-root.co.uk> | 2016-01-13 16:43:49 +0000 |
---|---|---|
committer | Dan Liew <dan@su-root.co.uk> | 2016-01-13 16:43:49 +0000 |
commit | 5a009c162a9a075a26d40fb2ab69d5c3b1bf8b34 (patch) | |
tree | d41c1c35fd3f1eb4f8c4e6e554cc2952dea1abba /llvm/utils/lit | |
parent | 50780ce110f4629832a5afbdf36cfbf9af2a36c7 (diff) | |
download | bcm5719-llvm-5a009c162a9a075a26d40fb2ab69d5c3b1bf8b34.tar.gz bcm5719-llvm-5a009c162a9a075a26d40fb2ab69d5c3b1bf8b34.zip |
[lit] Fix handling of per test timeout when the installed psutil version
is < ``2.0``.
Older versions of psutil (e.g. ``1.2.1`` which is the version shipped with
Ubuntu 14.04) use a different API for retrieving the child processes.
To handle this try the new API first and if that fails try the old API.
llvm-svn: 257616
Diffstat (limited to 'llvm/utils/lit')
-rw-r--r-- | llvm/utils/lit/lit/util.py | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/llvm/utils/lit/lit/util.py b/llvm/utils/lit/lit/util.py index a6e8d52c075..40a57716869 100644 --- a/llvm/utils/lit/lit/util.py +++ b/llvm/utils/lit/lit/util.py @@ -267,7 +267,14 @@ def killProcessAndChildren(pid): import psutil try: psutilProc = psutil.Process(pid) - for child in psutilProc.children(recursive=True): + # Handle the different psutil API versions + try: + # psutil >= 2.x + children_iterator = psutilProc.children(recursive=True) + except AttributeError: + # psutil 1.x + children_iterator = psutilProc.get_children(recursive=True) + for child in children_iterator: try: child.kill() except psutil.NoSuchProcess: |