[Lldb-commits] [lldb] r255138 - Fix new summary to include exceptional exit count in determining exit value

Todd Fiala via lldb-commits lldb-commits at lists.llvm.org
Wed Dec 9 11:05:45 PST 2015


Author: tfiala
Date: Wed Dec  9 13:05:44 2015
New Revision: 255138

URL: http://llvm.org/viewvc/llvm-project?rev=255138&view=rev
Log:
Fix new summary to include exceptional exit count in determining exit value

The main dotest.py should exit with a system return code of 1 on any
issue.  This change fixes a place where I omitted counting the
exceptional exit value to determine if we should return 1 when using the
new summary results.

This change also puts a banner around the Issue Details section that comes
before the Test Result Summary.

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

Modified: lldb/trunk/packages/Python/lldbsuite/test/basic_results_formatter.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/basic_results_formatter.py?rev=255138&r1=255137&r2=255138&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/basic_results_formatter.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/basic_results_formatter.py Wed Dec  9 13:05:44 2015
@@ -113,6 +113,15 @@ class BasicResultsFormatter(result_forma
 
     @classmethod
     def _event_sort_key(cls, event):
+        """Returns the sort key to be used for a test event.
+
+        This method papers over the differences in a test method result vs. a
+        job (i.e. inferior process) result.
+
+        @param event a test result or job result event.
+        @return a key useful for sorting events by name (test name preferably,
+        then by test filename).
+        """
         if "test_name" in event:
             return event["test_name"]
         else:
@@ -142,8 +151,23 @@ class BasicResultsFormatter(result_forma
                 key=lambda x: self._event_sort_key(x[1]))
         return partitioned_events
 
+    def _print_banner(self, banner_text):
+        """Prints an ASCII banner around given text.
+
+        Output goes to the out file for the results formatter.
+
+        @param banner_text the text to display, with a banner
+        of '=' around the line above and line below.
+        """
+        banner_separator = "".ljust(len(banner_text), "=")
+
+        self.out_file.write("\n{}\n{}\n{}\n".format(
+            banner_separator,
+            banner_text,
+            banner_separator))
+
     def _print_summary_counts(
-        self, categories, result_events_by_status, extra_rows):
+            self, categories, result_events_by_status, extra_rows):
         """Prints summary counts for all categories.
 
         @param categories the list of categories on which to partition.
@@ -167,13 +191,7 @@ class BasicResultsFormatter(result_forma
                 if name_length > max_category_name_length:
                     max_category_name_length = name_length
 
-        banner_text = "Test Result Summary"
-        banner_separator = "".ljust(len(banner_text), "=")
-
-        self.out_file.write("\n{}\n{}\n{}\n".format(
-            banner_separator,
-            banner_text,
-            banner_separator))
+        self._print_banner("Test Result Summary")
 
         # Prepend extra rows
         if extra_rows is not None:
@@ -248,10 +266,11 @@ class BasicResultsFormatter(result_forma
                 if event["event"] == EventBuilder.TYPE_JOB_RESULT:
                     # Jobs status that couldn't be mapped to a test method
                     # doesn't have as much detail.
-                    self.out_file.write("{}: {}{} (no test method running)\n".format(
-                        detail_label,
-                        extra_info,
-                        event["test_filename"]))
+                    self.out_file.write(
+                        "{}: {}{} (no test method running)\n".format(
+                            detail_label,
+                            extra_info,
+                            event["test_filename"]))
                 else:
                     # Test-method events have richer detail, use that here.
                     test_relative_path = os.path.relpath(
@@ -298,7 +317,7 @@ class BasicResultsFormatter(result_forma
         have_details = self._has_printable_details(
             categories, result_events_by_status)
         if have_details:
-            self.out_file.write("\nDetails:\n")
+            self._print_banner("Issue Details")
             for category in categories:
                 self._report_category_details(
                     category, result_events_by_status)

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=255138&r1=255137&r2=255138&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/dosep.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/dosep.py Wed Dec  9 13:05:44 2015
@@ -1557,7 +1557,9 @@ def main(print_details_on_success, num_t
             results_formatter.counts_by_test_result_status(
                 EventBuilder.STATUS_FAILURE) +
             results_formatter.counts_by_test_result_status(
-                EventBuilder.STATUS_TIMEOUT)
+                EventBuilder.STATUS_TIMEOUT) +
+            results_formatter.counts_by_test_result_status(
+                EventBuilder.STATUS_EXCEPTIONAL_EXIT)
             )
 
         # Return with appropriate result code




More information about the lldb-commits mailing list