Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Bug 812395 - Let emulator unit tests get retried after install_gecko …

…failure, r=aki
  • Loading branch information...
commit 8059364ed1415b0b81009267d03259faae244aa3 1 parent 27d2c9b
Jonathan Griffin authored November 16, 2012

Showing 1 changed file with 33 additions and 6 deletions. Show diff stats Hide diff stats

  1. 39  scripts/b2g_emulator_unittest.py
39  scripts/b2g_emulator_unittest.py
@@ -16,11 +16,30 @@
16 16
 from mozharness.base.errors import BaseErrorList
17 17
 from mozharness.base.log import ERROR
18 18
 from mozharness.base.script import BaseScript
  19
+from mozharness.mozilla.buildbot import TBPL_RETRY
19 20
 from mozharness.mozilla.testing.testbase import TestingMixin, testing_config_options
20 21
 from mozharness.mozilla.testing.unittest import DesktopUnittestOutputParser, EmulatorMixin
21 22
 from mozharness.mozilla.tooltool import TooltoolMixin
22 23
 
23 24
 
  25
+class MarionetteUnittestOutputParser(DesktopUnittestOutputParser):
  26
+    """
  27
+    A class that extends DesktopUnittestOutputParser such that it can
  28
+    catch failed gecko installation errors.
  29
+    """
  30
+
  31
+    bad_gecko_install = re.compile(r'Error installing gecko!')
  32
+
  33
+    def __init__(self, **kwargs):
  34
+        self.install_gecko_failed = False
  35
+        super(MarionetteUnittestOutputParser, self).__init__(**kwargs)
  36
+
  37
+    def parse_single_line(self, line):
  38
+        if self.bad_gecko_install.search(line):
  39
+            self.install_gecko_failed = True
  40
+        super(MarionetteUnittestOutputParser, self).parse_single_line(line)
  41
+
  42
+
24 43
 class B2GEmulatorTest(TestingMixin, TooltoolMixin, EmulatorMixin, BaseScript):
25 44
     config_options = [
26 45
         [["--type"],
@@ -264,12 +283,20 @@ def run_tests(self):
264 283
         suite_name = [x for x in suite_names if x in self.config['test_suite']][0]
265 284
         suite = '%s-%s' % (suite_name, self.config['this_chunk'])
266 285
 
267  
-        parser = DesktopUnittestOutputParser(suite_category=suite_name,
268  
-                                             config=self.config,
269  
-                                             log_obj=self.log_obj,
270  
-                                             error_list=error_list)
271  
-        return_code = self.run_command(cmd, cwd=cwd,
272  
-                                       output_parser=parser)
  286
+        for i in range(0, 5):
  287
+            # We retry the run because sometimes installing gecko on the
  288
+            # emulator can cause B2G not to restart properly - Bug 812935.
  289
+            parser = MarionetteUnittestOutputParser(suite_category=suite_name,
  290
+                                                    config=self.config,
  291
+                                                    log_obj=self.log_obj,
  292
+                                                    error_list=error_list)
  293
+            return_code = self.run_command(cmd, cwd=cwd,
  294
+                                           output_parser=parser)
  295
+            if not parser.install_gecko_failed:
  296
+                break
  297
+        else:
  298
+            self.buildbot_status(TBPL_RETRY)
  299
+            self.fatal("Failed to install gecko 5 times in a row, aborting")
273 300
 
274 301
         tbpl_status, log_level = parser.evaluate_parser(return_code)
275 302
         parser.append_tinderboxprint_line(suite_name)

0 notes on commit 8059364

Please sign in to comment.
Something went wrong with that request. Please try again.