summaryrefslogtreecommitdiffstats
path: root/lldb/packages/Python/lldbsuite/test/test_runner/process_control.py
diff options
context:
space:
mode:
authorTodd Fiala <todd.fiala@gmail.com>2016-09-26 20:25:47 +0000
committerTodd Fiala <todd.fiala@gmail.com>2016-09-26 20:25:47 +0000
commit2cd84c905df4fe9a6005320a45e98cd4b8ade045 (patch)
tree4165388cdc668b91a41117d96078e15e6671dce0 /lldb/packages/Python/lldbsuite/test/test_runner/process_control.py
parent9eddaeb5340035f1ed36940f7478999616a898f0 (diff)
downloadbcm5719-llvm-2cd84c905df4fe9a6005320a45e98cd4b8ade045.tar.gz
bcm5719-llvm-2cd84c905df4fe9a6005320a45e98cd4b8ade045.zip
added Linux support for test timeout sampling
This is the Linux counterpart to the sampling support I added on the macOS side. This change also introduces zip-file compression if the size of the sample output is greater than 10 KB. The Linux side can be quite large and the textual content is averaging over a 10x compression factor on tests that I force to time out. When compression takes place, the filename becomes: {session_dir}/{TestFilename.py}-{pid}.sample.zip This support relies on the linux 'perf' tool. If it isn't present, the behavior is to ignore pre-kill processing of the timed out test process. Note calling the perf tool under the timeout command appears to nuke the profiled process. This was causing the timeout kill logic to fail due to the process having disappeared. I modified the kill logic to catch the case of the process not existing, and I have it ignore the kill request in that case. Any other exception is still raised. Reviewers: labath Subscribers: lldb-commits Differential Revision: https://reviews.llvm.org/D24890 llvm-svn: 282436
Diffstat (limited to 'lldb/packages/Python/lldbsuite/test/test_runner/process_control.py')
-rw-r--r--lldb/packages/Python/lldbsuite/test/test_runner/process_control.py34
1 files changed, 22 insertions, 12 deletions
diff --git a/lldb/packages/Python/lldbsuite/test/test_runner/process_control.py b/lldb/packages/Python/lldbsuite/test/test_runner/process_control.py
index 005500ab6bf..720f5112a4c 100644
--- a/lldb/packages/Python/lldbsuite/test/test_runner/process_control.py
+++ b/lldb/packages/Python/lldbsuite/test/test_runner/process_control.py
@@ -360,18 +360,28 @@ class UnixProcessHelper(ProcessHelper):
# Choose kill mechanism based on whether we're targeting
# a process group or just a process.
- if popen_process.using_process_groups:
- # if log_file:
- # log_file.write(
- # "sending signum {} to process group {} now\n".format(
- # signum, popen_process.pid))
- os.killpg(popen_process.pid, signum)
- else:
- # if log_file:
- # log_file.write(
- # "sending signum {} to process {} now\n".format(
- # signum, popen_process.pid))
- os.kill(popen_process.pid, signum)
+ try:
+ if popen_process.using_process_groups:
+ # if log_file:
+ # log_file.write(
+ # "sending signum {} to process group {} now\n".format(
+ # signum, popen_process.pid))
+ os.killpg(popen_process.pid, signum)
+ else:
+ # if log_file:
+ # log_file.write(
+ # "sending signum {} to process {} now\n".format(
+ # signum, popen_process.pid))
+ os.kill(popen_process.pid, signum)
+ except OSError as error:
+ import errno
+ if error.errno == errno.ESRCH:
+ # This is okay - failed to find the process. It may be that
+ # that the timeout pre-kill hook eliminated the process. We'll
+ # ignore.
+ pass
+ else:
+ raise
def soft_terminate(self, popen_process, log_file=None, want_core=True):
# Choose signal based on desire for core file.
OpenPOWER on IntegriCloud