diff options
author | Todd Fiala <todd.fiala@gmail.com> | 2015-12-09 06:45:43 +0000 |
---|---|---|
committer | Todd Fiala <todd.fiala@gmail.com> | 2015-12-09 06:45:43 +0000 |
commit | 5183147e2d5b18447131299bb700058c9b26081f (patch) | |
tree | 55579830e87287ebe7c274a0b396c62051bf9816 /lldb/packages/Python/lldbsuite/test/test_runner | |
parent | 0876d2d5cf8af2ae79ba3105a7691a6000289859 (diff) | |
download | bcm5719-llvm-5183147e2d5b18447131299bb700058c9b26081f.tar.gz bcm5719-llvm-5183147e2d5b18447131299bb700058c9b26081f.zip |
wire timeouts and exceptional inferior process exits through the test event system
The results formatter system is now fed timeouts and exceptional process
exits (i.e. inferior dotest.py process that exited by signal on POSIX
systems).
If a timeout or exceptional exit happens while a test method is running
on the worker queue, the timeout or exceptional exit is charged and
reported against that test method. Otherwise, if no test method was
running at the time of the timeout or exceptional exit, only the test
filename will be reported as the TIMEOUT or ERROR.
Implements:
https://llvm.org/bugs/show_bug.cgi?id=24830
https://llvm.org/bugs/show_bug.cgi?id=25703
In support of:
https://llvm.org/bugs/show_bug.cgi?id=25450
llvm-svn: 255097
Diffstat (limited to 'lldb/packages/Python/lldbsuite/test/test_runner')
-rw-r--r-- | lldb/packages/Python/lldbsuite/test/test_runner/lib/process_control.py | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/lldb/packages/Python/lldbsuite/test/test_runner/lib/process_control.py b/lldb/packages/Python/lldbsuite/test/test_runner/lib/process_control.py index 4e8f554e37f..a7e639e4b8b 100644 --- a/lldb/packages/Python/lldbsuite/test/test_runner/lib/process_control.py +++ b/lldb/packages/Python/lldbsuite/test/test_runner/lib/process_control.py @@ -243,6 +243,37 @@ class ProcessHelper(object): """ return None + def is_exceptional_exit(self, popen_status): + """Returns whether the program exit status is exceptional. + + Returns whether the return code from a Popen process is exceptional + (e.g. signals on POSIX systems). + + Derived classes should override this if they can detect exceptional + program exit. + + @return True if the given popen_status represents an exceptional + program exit; False otherwise. + """ + return False + + def exceptional_exit_details(self, popen_status): + """Returns the normalized exceptional exit code and a description. + + Given an exceptional exit code, returns the integral value of the + exception (e.g. signal number for POSIX) and a description (e.g. + signal name on POSIX) for the result. + + Derived classes should override this if they can detect exceptional + program exit. + + It is fine to not implement this so long as is_exceptional_exit() + always returns False. + + @return (normalized exception code, symbolic exception description) + """ + raise Exception("exception_exit_details() called on unsupported class") + class UnixProcessHelper(ProcessHelper): """Provides a ProcessHelper for Unix-like operating systems. @@ -366,6 +397,20 @@ class UnixProcessHelper(ProcessHelper): def soft_terminate_signals(self): return [signal.SIGQUIT, signal.SIGTERM] + def is_exceptional_exit(self, popen_status): + return popen_status < 0 + + @classmethod + def _signal_names_by_number(cls): + return dict( + (k, v) for v, k in reversed(sorted(signal.__dict__.items())) + if v.startswith('SIG') and not v.startswith('SIG_')) + + def exceptional_exit_details(self, popen_status): + signo = -popen_status + signal_names_by_number = self._signal_names_by_number() + signal_name = signal_names_by_number.get(signo, "") + return (signo, signal_name) class WindowsProcessHelper(ProcessHelper): """Provides a Windows implementation of the ProcessHelper class.""" |