[libcxx-commits] [libcxx] r366912 - [AIX][lit] Don't depend on psutil on AIX
David Tenty via libcxx-commits
libcxx-commits at lists.llvm.org
Wed Jul 24 08:04:27 PDT 2019
Author: daltenty
Date: Wed Jul 24 08:04:27 2019
New Revision: 366912
URL: http://llvm.org/viewvc/llvm-project?rev=366912&view=rev
Log:
[AIX][lit] Don't depend on psutil on AIX
Summary:
On AIX psutil can run into problems with permissions to read the process
tree, which causes problems for python timeout tests which need to kill off
a test and it's children.
This patch adds a workaround by invoking shell via subprocess and using a
platform specific option to ps to list all the descendant processes so we can
kill them. We add some checks so lit can tell whether timeout tests are
supported with out exposing whether we are utilizing the psutil
implementation or the alternative.
Reviewers: hubert.reinterpretcast, andusy, davide, delcypher
Reviewed By: delcypher
Subscribers: davide, delcypher, christof, lldb-commits, libcxx-commits, llvm-commits
Tags: #lldb, #libc, #llvm
Differential Revision: https://reviews.llvm.org/D64251
Modified:
libcxx/trunk/utils/libcxx/util.py
Modified: libcxx/trunk/utils/libcxx/util.py
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/utils/libcxx/util.py?rev=366912&r1=366911&r2=366912&view=diff
==============================================================================
--- libcxx/trunk/utils/libcxx/util.py (original)
+++ libcxx/trunk/utils/libcxx/util.py Wed Jul 24 08:04:27 2019
@@ -253,24 +253,27 @@ def killProcessAndChildren(pid):
TODO: Reimplement this without using psutil so we can
remove our dependency on it.
"""
- import psutil
- try:
- psutilProc = psutil.Process(pid)
- # Handle the different psutil API versions
+ if platform.system() == 'AIX':
+ subprocess.call('kill -kill $(ps -o pid= -L{})'.format(pid), shell=True)
+ else:
+ import psutil
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:
+ psutilProc = psutil.Process(pid)
+ # Handle the different psutil API versions
try:
- child.kill()
- except psutil.NoSuchProcess:
- pass
- psutilProc.kill()
- except psutil.NoSuchProcess:
- pass
+ # 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:
+ pass
+ psutilProc.kill()
+ except psutil.NoSuchProcess:
+ pass
def executeCommandVerbose(cmd, *args, **kwargs):
More information about the libcxx-commits
mailing list