Permalink
Browse files

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

…failure, r=aki
  • Loading branch information...
1 parent 27d2c9b commit 8059364ed1415b0b81009267d03259faae244aa3 @jonallengriffin jonallengriffin committed Nov 17, 2012
Showing with 33 additions and 6 deletions.
  1. +33 −6 scripts/b2g_emulator_unittest.py
@@ -16,11 +16,30 @@
from mozharness.base.errors import BaseErrorList
from mozharness.base.log import ERROR
from mozharness.base.script import BaseScript
+from mozharness.mozilla.buildbot import TBPL_RETRY
from mozharness.mozilla.testing.testbase import TestingMixin, testing_config_options
from mozharness.mozilla.testing.unittest import DesktopUnittestOutputParser, EmulatorMixin
from mozharness.mozilla.tooltool import TooltoolMixin
+class MarionetteUnittestOutputParser(DesktopUnittestOutputParser):
+ """
+ A class that extends DesktopUnittestOutputParser such that it can
+ catch failed gecko installation errors.
+ """
+
+ bad_gecko_install = re.compile(r'Error installing gecko!')
+
+ def __init__(self, **kwargs):
+ self.install_gecko_failed = False
+ super(MarionetteUnittestOutputParser, self).__init__(**kwargs)
+
+ def parse_single_line(self, line):
+ if self.bad_gecko_install.search(line):
+ self.install_gecko_failed = True
+ super(MarionetteUnittestOutputParser, self).parse_single_line(line)
+
+
class B2GEmulatorTest(TestingMixin, TooltoolMixin, EmulatorMixin, BaseScript):
config_options = [
[["--type"],
@@ -264,12 +283,20 @@ def run_tests(self):
suite_name = [x for x in suite_names if x in self.config['test_suite']][0]
suite = '%s-%s' % (suite_name, self.config['this_chunk'])
- parser = DesktopUnittestOutputParser(suite_category=suite_name,
- config=self.config,
- log_obj=self.log_obj,
- error_list=error_list)
- return_code = self.run_command(cmd, cwd=cwd,
- output_parser=parser)
+ for i in range(0, 5):
+ # We retry the run because sometimes installing gecko on the
+ # emulator can cause B2G not to restart properly - Bug 812935.
+ parser = MarionetteUnittestOutputParser(suite_category=suite_name,
+ config=self.config,
+ log_obj=self.log_obj,
+ error_list=error_list)
+ return_code = self.run_command(cmd, cwd=cwd,
+ output_parser=parser)
+ if not parser.install_gecko_failed:
+ break
+ else:
+ self.buildbot_status(TBPL_RETRY)
+ self.fatal("Failed to install gecko 5 times in a row, aborting")
tbpl_status, log_level = parser.evaluate_parser(return_code)
parser.append_tinderboxprint_line(suite_name)

0 comments on commit 8059364

Please sign in to comment.