Bug 1474469 - Make sure nightly-l10n failures are properly reported. r=tomprince
authorJustin Wood <Callek@gmail.com>
Tue, 07 Aug 2018 20:58:32 +0000
changeset 430546 a86f1df2608ce18a5381a3d49d988feda78de6af
parent 430545 f5873bdd1241fc05a1839e78ac1b24774eb7c58a
child 430547 ff3a0784588f2cb5aaa84e8d6a2a3677a5e52930
push id34409
push usertoros@mozilla.com
push dateThu, 09 Aug 2018 10:00:05 +0000
treeherdermozilla-central@eb9ff7de69ef [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerstomprince
bugs1474469
milestone63.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 1474469 - Make sure nightly-l10n failures are properly reported. r=tomprince Differential Revision: https://phabricator.services.mozilla.com/D2040
testing/mozharness/mozharness/base/script.py
testing/mozharness/mozharness/mozilla/automation.py
testing/mozharness/scripts/desktop_l10n.py
testing/mozharness/scripts/mobile_l10n.py
--- a/testing/mozharness/mozharness/base/script.py
+++ b/testing/mozharness/mozharness/base/script.py
@@ -2206,27 +2206,16 @@ class BaseScript(ScriptMixin, LogMixin, 
                     print "### Log is closed! (%s)" % item['message']
 
     def add_summary(self, message, level=INFO):
         self.summary_list.append({'message': message, 'level': level})
         # TODO write to a summary-only log?
         # Summaries need a lot more love.
         self.log(message, level=level)
 
-    def add_failure(self, key, message="%(key)s failed.", level=ERROR,
-                    increment_return_code=True):
-        if key not in self.failures:
-            self.failures.append(key)
-            self.add_summary(message % {'key': key}, level=level)
-            if increment_return_code:
-                self.return_code += 1
-
-    def query_failure(self, key):
-        return key in self.failures
-
     def summarize_success_count(self, success_count, total_count,
                                 message="%d of %d successful.",
                                 level=None):
         if level is None:
             level = INFO
             if success_count < total_count:
                 level = ERROR
         self.add_summary(message % (success_count, total_count),
--- a/testing/mozharness/mozharness/mozilla/automation.py
+++ b/testing/mozharness/mozharness/mozilla/automation.py
@@ -59,16 +59,25 @@ class AutomationMixin(object):
                                                  TBPL_WORST_LEVEL_TUPLE)
             if self.worst_status != tbpl_status:
                 self.info("Current worst status %s is worse; keeping it." %
                           self.worst_status)
             self.add_summary("# TBPL %s #" % self.worst_status, level=level)
             if set_return_code:
                 self.return_code = EXIT_STATUS_DICT[self.worst_status]
 
+    def add_failure(self, key, message="%(key)s failed.", level=ERROR):
+        if key not in self.failures:
+            self.failures.append(key)
+            self.add_summary(message % {'key': key}, level=level)
+            self.record_status(TBPL_FAILURE)
+
+    def query_failure(self, key):
+        return key in self.failures
+
     def set_property(self, prop_name, prop_value):
         self.info("Setting property %s to %s" % (prop_name, prop_value))
         self.properties[prop_name] = prop_value
         return self.properties[prop_name]
 
     def query_property(self, prop_name):
         return self.properties.get(prop_name)
 
--- a/testing/mozharness/scripts/desktop_l10n.py
+++ b/testing/mozharness/scripts/desktop_l10n.py
@@ -355,18 +355,17 @@ class DesktopSingleLocale(LocalesMixin, 
         self.locales_property[locale] = FAILURE_STR
         prop_key = "%s_failure" % locale
         prop_value = self.query_property(prop_key)
         if prop_value:
             prop_value = "%s  %s" % (prop_value, message)
         else:
             prop_value = message
         self.set_property(prop_key, prop_value)
-        BaseScript.add_failure(self, locale, message=message,
-                               increment_return_code=False, **kwargs)
+        AutomationMixin.add_failure(self, locale, message=message, **kwargs)
 
     def query_failed_locales(self):
         return [l for l, res in self.locales_property.items() if
                 res == FAILURE_STR]
 
     def summary(self):
         """generates a summary"""
         BaseScript.summary(self)
--- a/testing/mozharness/scripts/mobile_l10n.py
+++ b/testing/mozharness/scripts/mobile_l10n.py
@@ -212,17 +212,17 @@ class MobileSingleLocale(LocalesMixin, T
         self.locales_property[locale] = "Failed"
         prop_key = "%s_failure" % locale
         prop_value = self.query_property(prop_key)
         if prop_value:
             prop_value = "%s  %s" % (prop_value, message)
         else:
             prop_value = message
         self.set_property(prop_key, prop_value)
-        MercurialScript.add_failure(self, locale, message=message, **kwargs)
+        AutomationMixin.add_failure(self, locale, message=message, **kwargs)
 
     def summary(self):
         MercurialScript.summary(self)
         # TODO we probably want to make this configurable on/off
         locales = self.query_locales()
         for locale in locales:
             self.locales_property.setdefault(locale, "Success")
         self.set_property("locales", json.dumps(self.locales_property))