[Lldb-commits] [lldb] r275782 - [test] Report error when inferior test processes exit with a non-zero code

Pavel Labath via lldb-commits lldb-commits at lists.llvm.org
Mon Jul 18 04:27:20 PDT 2016


Author: labath
Date: Mon Jul 18 06:27:19 2016
New Revision: 275782

URL: http://llvm.org/viewvc/llvm-project?rev=275782&view=rev
Log:
[test] Report error when inferior test processes exit with a non-zero code

Summary:
We've run into this problem when the test errored out so early (because it could not connect to
the remote device), that the code in D20193 did not catch the error. This resulted in the test
suite reporting success with 0 tests being run.

This patch makes sure that any non-zero exit code from the inferior process gets reported as an
error. Basically I expand the concept of "exceptional exits", which was previously being used for
signals to cover these cases as well.

Reviewers: tfiala, zturner

Subscribers: lldb-commits

Differential Revision: https://reviews.llvm.org/D22404

Modified:
    lldb/trunk/packages/Python/lldbsuite/test/dosep.py
    lldb/trunk/packages/Python/lldbsuite/test/test_runner/process_control.py

Modified: lldb/trunk/packages/Python/lldbsuite/test/dosep.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/dosep.py?rev=275782&r1=275781&r2=275782&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/dosep.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/dosep.py Mon Jul 18 06:27:19 2016
@@ -109,13 +109,14 @@ def report_test_failure(name, command, o
     with output_lock:
         if not (RESULTS_FORMATTER and RESULTS_FORMATTER.is_using_terminal()):
             print(file=sys.stderr)
-            print(output, file=sys.stderr)
             if timeout:
                 timeout_str = " (TIMEOUT)"
             else:
                 timeout_str = ""
             print("[%s FAILED]%s" % (name, timeout_str), file=sys.stderr)
             print("Command invoked: %s" % ' '.join(command), file=sys.stderr)
+            print("Command stderr:\n", output[1], file=sys.stderr)
+            print("Command stdout:\n", output[0], file=sys.stderr)
         update_progress(name)
 
 
@@ -210,7 +211,7 @@ class DoTestProcessDriver(process_contro
             # only stderr does.
             report_test_pass(self.file_name, output[1])
         else:
-            report_test_failure(self.file_name, command, output[1], was_timeout)
+            report_test_failure(self.file_name, command, output, was_timeout)
 
         # Save off the results for the caller.
         self.results = (

Modified: lldb/trunk/packages/Python/lldbsuite/test/test_runner/process_control.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/test_runner/process_control.py?rev=275782&r1=275781&r2=275782&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/test_runner/process_control.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/test_runner/process_control.py Mon Jul 18 06:27:19 2016
@@ -246,33 +246,25 @@ class ProcessHelper(object):
     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.
+        Returns whether the return code from a Popen process is exceptional.
 
         @return True if the given popen_status represents an exceptional
         program exit; False otherwise.
         """
-        return False
+        return popen_status != 0
 
     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.
+        exception and a description for the result.
 
-        It is fine to not implement this so long as is_exceptional_exit()
-        always returns False.
+        Derived classes can override this if they want to want custom
+        exceptional exit code handling.
 
         @return (normalized exception code, symbolic exception description)
         """
-        raise Exception("exception_exit_details() called on unsupported class")
+        return (popen_status, "exit")
 
 
 class UnixProcessHelper(ProcessHelper):
@@ -397,9 +389,6 @@ 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(
@@ -407,6 +396,8 @@ class UnixProcessHelper(ProcessHelper):
             if v.startswith('SIG') and not v.startswith('SIG_'))
 
     def exceptional_exit_details(self, popen_status):
+        if popen_status >= 0:
+            return (popen_status, "exit")
         signo = -popen_status
         signal_names_by_number = self._signal_names_by_number()
         signal_name = signal_names_by_number.get(signo, "")




More information about the lldb-commits mailing list