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-23 16:10:01 +0000
committerTodd Fiala <todd.fiala@gmail.com>2016-09-23 16:10:01 +0000
commit72525622b2f2f558dfd2a5a37577b0f6e3ae16a1 (patch)
tree2d828b6a03291530f145619df86adc7fd90a5b8f /lldb/packages/Python/lldbsuite/test/test_runner/process_control.py
parente9eb0913a92e78ae438dd564729da952284d5972 (diff)
downloadbcm5719-llvm-72525622b2f2f558dfd2a5a37577b0f6e3ae16a1.tar.gz
bcm5719-llvm-72525622b2f2f558dfd2a5a37577b0f6e3ae16a1.zip
add hook for calling platform-dependent pre-kill action on a timed out test
differential review: https://reviews.llvm.org/D24850 reviewers: clayborg, labath llvm-svn: 282258
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.py18
1 files changed, 18 insertions, 0 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 e8bc69b7f62..005500ab6bf 100644
--- a/lldb/packages/Python/lldbsuite/test/test_runner/process_control.py
+++ b/lldb/packages/Python/lldbsuite/test/test_runner/process_control.py
@@ -483,6 +483,19 @@ class ProcessDriver(object):
def on_process_exited(self, command, output, was_timeout, exit_status):
pass
+ def on_timeout_pre_kill(self):
+ """Called after the timeout interval elapses but before killing it.
+
+ This method is added to enable derived classes the ability to do
+ something to the process prior to it being killed. For example,
+ this would be a good spot to run a program that samples the process
+ to see what it was doing (or not doing).
+
+ Do not attempt to reap the process (i.e. use wait()) in this method.
+ That will interfere with the kill mechanism and return code processing.
+ """
+ pass
+
def write(self, content):
# pylint: disable=no-self-use
# Intended - we want derived classes to be able to override
@@ -640,6 +653,11 @@ class ProcessDriver(object):
# Reap the child process here.
self.returncode = self.process.wait()
else:
+
+ # Allow derived classes to do some work after we detected
+ # a timeout but before we touch the timed-out process.
+ self.on_timeout_pre_kill()
+
# Prepare to stop the process
process_terminated = completed_normally
terminate_attempt_count = 0
OpenPOWER on IntegriCloud