Bug 1632242 - Mention results for groups in errorsummary even when the group passed or was skipped. r=ahal
authorMarco Castelluccio <mcastelluccio@mozilla.com>
Tue, 19 May 2020 20:51:10 +0000
changeset 530897 fa7b0d6cd464d2b4106178b6e8e5d8e2b0abae28
parent 530895 b80e2f6885743e68d3045f768ccc6668eba2f9d2
child 530898 01bf5f7b070ae18840f3e579c3208af40add2aa4
push id37434
push userabutkovits@mozilla.com
push dateWed, 20 May 2020 10:05:10 +0000
treeherdermozilla-central@005ef1c25992 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersahal
bugs1632242
milestone78.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 1632242 - Mention results for groups in errorsummary even when the group passed or was skipped. r=ahal Differential Revision: https://phabricator.services.mozilla.com/D74131
testing/mozbase/mozlog/mozlog/formatters/errorsummary.py
--- a/testing/mozbase/mozlog/mozlog/formatters/errorsummary.py
+++ b/testing/mozbase/mozlog/mozlog/formatters/errorsummary.py
@@ -9,16 +9,17 @@ import json
 
 from .base import BaseFormatter
 
 
 class ErrorSummaryFormatter(BaseFormatter):
 
     def __init__(self):
         self.groups = {}
+        self.group_results = {}
         self.line_count = 0
 
     def __call__(self, data):
         rv = BaseFormatter.__call__(self, data)
         self.line_count += 1
         return rv
 
     def _output(self, data_type, data):
@@ -31,26 +32,48 @@ class ErrorSummaryFormatter(BaseFormatte
                 "subtest": subtest,
                 "group": self.groups.get(test, ''),
                 "status": item["status"],
                 "expected": item["expected"],
                 "message": item.get("message"),
                 "stack": item.get("stack")}
         return self._output("test_result", data)
 
+    def _update_results(self, item):
+        group = self.groups.get(item["test"], None)
+        if group is None:
+            return
+
+        if item["status"] == "SKIP":
+            if group not in self.group_results:
+                self.group_results[group] = "SKIP"
+        elif "expected" not in item or item["status"] == item["expected"]:
+            if group not in self.group_results or self.group_results[group] == "SKIP":
+                self.group_results[group] = "OK"
+        else:
+            self.group_results[group] = "ERROR"
+
     def suite_start(self, item):
         self.groups = {v: k for k in item["tests"] for v in item["tests"][k]}
         return self._output("test_groups", {"groups": list(item["tests"].keys())})
 
+    def suite_end(self, data):
+        return "".join(
+            self._output("group_result", {"group": group, "status": status})
+            for group, status in self.group_results.items()
+        )
+
     def test_status(self, item):
+        self._update_results(item)
         if "expected" not in item:
             return
         return self._output_test(item["test"], item["subtest"], item)
 
     def test_end(self, item):
+        self._update_results(item)
         if "expected" not in item:
             return
         return self._output_test(item["test"], None, item)
 
     def log(self, item):
         if item["level"] not in ("ERROR", "CRITICAL"):
             return