[Lldb-commits] [PATCH] D24850: add hook for calling platform-dependent pre-kill action on a timed out test

Todd Fiala via lldb-commits lldb-commits at lists.llvm.org
Thu Sep 22 16:21:24 PDT 2016


tfiala created this revision.
tfiala added reviewers: clayborg, labath.
tfiala added a subscriber: lldb-commits.

This change introduces the concept of a platform-specific, pre-kill-hook mechanism.  If a platform defines the hook, then the hook gets called right after a timeout is detected in a test run, but before the process is killed.

The pre-kill-hook mechanism works as follows:

* When a timeout is detected in the process_control.ProcessDriver class that runs the per-test lldb process, a new overridable on_timeout_pre_kill() method is called on the ProcessDriver instance.

* The concurrent test driver's derived ProcessDriver overrides this method.  It looks to see if a module called "lldbsuite.pre_kill_hook/{platform-system-name}" module exists, where platform-system-name is replaced with platform.system().lower():

  * If that module doesn't exist, no further process of the pre-killed process occurs.

  * If that module does exist, it is loaded, and the method "do_pre_kill(process_id, output_stream)" is called.  If that method throws an exception, we log it and we ignore further processing of the pre-killed process.

  * The process_id arg of the do_pre_kill function is the process id as returned by the ProcessDriver.pid property.

  * The output_stream arg of the do_pre_kill function takes a file-like object.  Output to be collected from doing an processing on the process-to-be-killed should be written into the object.  The current impl uses a six.StringIO and then writes this output to {TestFilename}-{pid}.sample in the session directory.

Platforms where platform.system() is "Darwin" will get a pre-kill action that runs the 'sample' program on the lldb that has timed out.  That data will be collected on CI and analyzed to determine what is happening during timeouts.  (This has an advantage over a core in that it is much smaller and that it clearly demonstrates any liveness of the process, if there is any).

I will also hunt around on Linux to see if there might be something akin to 'sample' that might be available.  If so, it would be nice to hook something up for that.

https://reviews.llvm.org/D24850

Files:
  packages/Python/lldbsuite/pre_kill_hook/__init__.py
  packages/Python/lldbsuite/pre_kill_hook/darwin.py
  packages/Python/lldbsuite/pre_kill_hook/tests/__init__.py
  packages/Python/lldbsuite/pre_kill_hook/tests/test_darwin.py
  packages/Python/lldbsuite/test/dosep.py
  packages/Python/lldbsuite/test/test_runner/process_control.py

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D24850.72222.patch
Type: text/x-patch
Size: 17548 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20160922/07974a4f/attachment.bin>


More information about the lldb-commits mailing list