Ejemplo n.º 1
0
 def _bisect_integration(self,
                         good_rev,
                         bad_rev,
                         ensure_good_and_bad=False,
                         expand=0):
     LOG.info("Getting %s builds between %s and %s" %
              (self.fetch_config.integration_branch, good_rev, bad_rev))
     handler = IntegrationHandler(find_fix=self.options.find_fix,
                                  ensure_good_and_bad=ensure_good_and_bad)
     result = self._do_bisect(handler, good_rev, bad_rev, expand=expand)
     if result == Bisection.FINISHED:
         LOG.info("No more integration revisions, bisection finished.")
         handler.print_range()
         if handler.good_revision == handler.bad_revision:
             LOG.warning("It seems that you used two changesets that are in"
                         " the same push. Check the pushlog url.")
         elif len(handler.build_range) == 2:
             # range reduced to 2 pushes (at least ones with builds):
             # one good, one bad.
             result = handler.handle_merge()
             if result:
                 branch, good_rev, bad_rev = result
                 self.fetch_config.set_repo(branch)
                 return self._bisect_integration(good_rev,
                                                 bad_rev,
                                                 expand=DEFAULT_EXPAND)
             else:
                 # This code is broken, it prints out the message even when
                 # there are multiple bug numbers or commits in the range.
                 # Somebody should fix it before re-enabling it.
                 return 0
                 # print a bug if:
                 # (1) there really is only one bad push (and we're not
                 # just missing the builds for some intermediate builds)
                 # (2) there is only one bug number in that push
                 jp = JsonPushes(handler.build_range[1].repo_name)
                 num_pushes = len(
                     jp.pushes_within_changes(
                         handler.build_range[0].changeset,
                         handler.build_range[1].changeset))
                 if num_pushes == 2:
                     bugids = find_bugids_in_push(
                         handler.build_range[1].repo_name,
                         handler.build_range[1].changeset)
                     if len(bugids) == 1:
                         word = 'fix' if handler.find_fix else 'regression'
                         LOG.info("Looks like the following bug has the "
                                  " changes which introduced the"
                                  " {}:\n{}".format(word,
                                                    bug_url(bugids[0])))
     elif result == Bisection.USER_EXIT:
         self._print_resume_info(handler)
     else:
         # NO_DATA. With integration branches, this can not happen if changesets
         # are incorrect - so builds are probably too old
         LOG.info(
             'There are no build artifacts for these changesets (they are probably too old).'
         )
         return 1
     return 0
Ejemplo n.º 2
0
class TestIntegrationHandler(unittest.TestCase):
    def setUp(self):
        self.handler = IntegrationHandler()

    @patch("mozregression.bisector.LOG")
    def test_print_progress(self, logger):
        log = []
        logger.info = log.append
        self.handler.set_build_range([
            Mock(short_changeset="12"),
            Mock(short_changeset="123"),
            Mock(short_changeset="1234"),
            Mock(short_changeset="12345"),
        ])
        new_data = [
            Mock(short_changeset="1234"),
            Mock(short_changeset="12345")
        ]

        self.handler._print_progress(new_data)
        self.assertIn("from [12, 12345] (4 builds)", log[0])
        self.assertIn("to [1234, 12345] (2 builds)", log[0])
        self.assertIn("1 steps left", log[0])

    @patch("mozregression.bisector.LOG")
    def test_user_exit(self, logger):
        log = []
        logger.info = log.append
        self.handler.good_revision = "3"
        self.handler.bad_revision = "1"
        self.handler.user_exit(0)
        self.assertEqual("Newest known good integration revision: 3", log[0])
        self.assertEqual("Oldest known bad integration revision: 1", log[1])
Ejemplo n.º 3
0
class TestIntegrationHandler(unittest.TestCase):
    def setUp(self):
        self.handler = IntegrationHandler()

    @patch('mozregression.bisector.LOG')
    def test_print_progress(self, logger):
        log = []
        logger.info = log.append
        self.handler.set_build_range([
            Mock(short_changeset='12'),
            Mock(short_changeset='123'),
            Mock(short_changeset='1234'),
            Mock(short_changeset='12345'),
        ])
        new_data = [
            Mock(short_changeset='1234'),
            Mock(short_changeset='12345')
        ]

        self.handler._print_progress(new_data)
        self.assertIn('from [12, 12345] (4 builds)', log[0])
        self.assertIn('to [1234, 12345] (2 builds)', log[0])
        self.assertIn('1 steps left', log[0])

    @patch('mozregression.bisector.LOG')
    def test_user_exit(self, logger):
        log = []
        logger.info = log.append
        self.handler.good_revision = '3'
        self.handler.bad_revision = '1'
        self.handler.user_exit(0)
        self.assertEqual('Newest known good integration revision: 3', log[0])
        self.assertEqual('Oldest known bad integration revision: 1', log[1])
Ejemplo n.º 4
0
 def bisect_further(self):
     assert self.bisection
     self.started.emit()
     handler = self.bisection.handler
     try:
         nhandler = IntegrationHandler(
             find_fix=self.bisection.handler.find_fix)
         Bisector.bisect(self,
                         nhandler,
                         handler.good_revision,
                         handler.bad_revision,
                         expand=DEFAULT_EXPAND,
                         interrupt=self.should_stop.is_set)
     except MozRegressionError:
         self._finish_on_exception(None)
     except StopIteration:
         self.finished.emit(None, Bisection.USER_EXIT)
Ejemplo n.º 5
0
    def init_worker(self, fetch_config, options):
        AbstractBuildRunner.init_worker(self, fetch_config, options)

        self.worker.test_runner.evaluate_started.connect(self.evaluate)
        self.worker.finished.connect(self.bisection_finished)
        self.worker.handle_merge.connect(self.handle_merge)
        self.worker.choose_next_build.connect(self.choose_next_build)
        good, bad = options.get("good"), options.get("bad")
        if (is_date_or_datetime(good) and is_date_or_datetime(bad)
                and fetch_config.should_use_archive()):
            handler = NightlyHandler(find_fix=options["find_fix"])
        else:
            handler = IntegrationHandler(find_fix=options["find_fix"])

        self.worker._bisect_args = (handler, good, bad)
        self.worker.download_in_background = self.global_prefs[
            "background_downloads"]
        if self.global_prefs["approx_policy"]:
            self.worker.approx_chooser = ApproxPersistChooser(7)
        return self.worker.bisect
Ejemplo n.º 6
0
 def setUp(self):
     self.handler = IntegrationHandler()