Bug 1465527 - Print stacks from parent tests in mach formatter. r=jgraham
authorAndreas Tolfsen <ato@sny.no>
Wed, 30 May 2018 18:29:35 +0100
changeset 420865 72eb0c354c3112e91e920da5a0df2255d247a0a1
parent 420864 4aa587fee045670fb0be28bb74d88d1db982a8c6
child 420866 2492931ce122e95206ce2653f8adf107c99019f5
push id64744
push useratolfsen@mozilla.com
push dateFri, 01 Jun 2018 14:01:54 +0000
treeherderautoland@8fd817cc95a7 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjgraham
bugs1465527
milestone62.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1465527 - Print stacks from parent tests in mach formatter. r=jgraham Parent tests may also have stacktraces and this patch prints and formats them the same way we do for subtests' stacks. MozReview-Commit-ID: 64gfPWuQnHd
testing/mozbase/mozlog/mozlog/formatters/machformatter.py
--- a/testing/mozbase/mozlog/mozlog/formatters/machformatter.py
+++ b/testing/mozbase/mozlog/mozlog/formatters/machformatter.py
@@ -94,22 +94,24 @@ class MachFormatter(base.BaseFormatter):
             if status in ("PASS", "OK"):
                 status = "UNEXPECTED-%s" % status
         return color(status)
 
     def _format_status(self, test, data):
         name = data.get("subtest", test)
         rv = "%s %s" % (self._format_expected(
             data["status"], data.get("expected", data["status"])), name)
-        if 'message' in data:
-            rv += " - %s" % data['message']
+        if "message" in data:
+            rv += " - %s" % data["message"]
+        if "stack" in data:
+            rv += self._format_stack(data["stack"])
+        return rv
 
-        if 'stack' in data:
-            rv += "\n%s\n" % self.term.dim(data['stack'].strip('\n'))
-        return rv
+    def _format_stack(self, stack):
+        return "\n%s\n" % self.term.dim(stack.strip("\n"))
 
     def _format_suite_summary(self, suite, summary):
         count = summary['counts']
         logs = summary['unexpected_logs']
 
         rv = ["", self.term.yellow(suite), self.term.yellow("~" * len(suite))]
 
         # Format check counts
@@ -193,16 +195,18 @@ class MachFormatter(base.BaseFormatter):
             rv = "%s%s" % (data["status"], expected_str)
 
         unexpected = self.summary.current["unexpected_logs"].get(data["test"])
         if unexpected:
             if len(unexpected) == 1 and parent_unexpected:
                 message = unexpected[0].get("message", "")
                 if message:
                     rv += " - %s" % message
+                if "stack" in data:
+                    rv += self._format_stack(data["stack"])
             elif not self.verbose:
                 rv += "\n"
                 for d in unexpected:
                     rv += self._format_status(data['test'], d)
 
         if "expected" not in data and not bool(subtests['unexpected']):
             color = self.term.green
         else: