コード例 #1
0
 def bisect_nightlies(self):
     good_date, bad_date = self.options.good, self.options.bad
     handler = NightlyHandler(
         find_fix=self.options.find_fix,
         ensure_good_and_bad=self.options.mode != 'no-first-check',
     )
     result = self._do_bisect(handler, good_date, bad_date)
     if result == Bisection.FINISHED:
         LOG.info("Got as far as we can go bisecting nightlies...")
         handler.print_range()
         if self.fetch_config.can_go_inbound():
             LOG.info("Switching bisection method to taskcluster")
             self.fetch_config.set_repo(
                 self.fetch_config.get_nightly_repo(handler.bad_date))
             return self._bisect_inbounds(handler.good_revision,
                                          handler.bad_revision,
                                          expand=DEFAULT_EXPAND)
     elif result == Bisection.USER_EXIT:
         self._print_resume_info(handler)
     else:
         # NO_DATA
         LOG.info("Unable to get valid builds within the given"
                  " range. You should try to launch mozregression"
                  " again with a larger date range.")
         return 1
     return 0
コード例 #2
0
ファイル: main.py プロジェクト: KWierso/mozregression
 def bisect_nightlies(self):
     good_date, bad_date = self.options.good_date, self.options.bad_date
     handler = NightlyHandler(find_fix=self.options.find_fix)
     result = self._do_bisect(handler, good_date, bad_date)
     if result == Bisection.FINISHED:
         self._logger.info("Got as far as we can go bisecting nightlies...")
         handler.print_range()
         if self.fetch_config.can_go_inbound():
             good_rev, bad_rev = handler.find_inbound_changesets()
             return self._bisect_inbounds(good_rev, bad_rev)
         else:
             message = ("Can not bisect inbound for application `%s`"
                        % self.fetch_config.app_name)
             if self.fetch_config.is_inbound():
                 # the config is able to bissect inbound but not
                 # for this repo.
                 message += (" because the repo `%s` was specified"
                             % self.options.repo)
             self._logger.info(message + '.')
     elif result == Bisection.USER_EXIT:
         self._print_resume_info(handler)
     else:
         # NO_DATA
         self._logger.info("Unable to get valid builds within the given"
                           " range. You should try to launch mozregression"
                           " again with a larger date range.")
         return 1
     return 0
コード例 #3
0
ファイル: main.py プロジェクト: mozilla/mozregression
 def bisect_nightlies(self):
     good_date, bad_date = self.options.good, self.options.bad
     handler = NightlyHandler(
         find_fix=self.options.find_fix,
         ensure_good_and_bad=self.options.mode != 'no-first-check',
     )
     result = self._do_bisect(handler, good_date, bad_date)
     if result == Bisection.FINISHED:
         LOG.info("Got as far as we can go bisecting nightlies...")
         handler.print_range()
         if self.fetch_config.can_go_inbound():
             LOG.info("Switching bisection method to taskcluster")
             self.fetch_config.set_repo(
                 self.fetch_config.get_nightly_repo(handler.bad_date))
             return self._bisect_inbounds(handler.good_revision,
                                          handler.bad_revision,
                                          expand=DEFAULT_EXPAND)
     elif result == Bisection.USER_EXIT:
         self._print_resume_info(handler)
     else:
         # NO_DATA
         LOG.info("Unable to get valid builds within the given"
                  " range. You should try to launch mozregression"
                  " again with a larger date range.")
         return 1
     return 0
コード例 #4
0
ファイル: bisect.py プロジェクト: EricRahm/log-spam-hell
    def bisect_nightly(self):
        handler = NightlyHandler(ensure_good_and_bad=True)
        result = self.bisector.bisect(handler, self.good, self.bad)
        if result == Bisection.FINISHED:
            print "Got as far as we can go bisecting nightlies..."
            handler.print_range()
            print "Switching bisection method to taskcluster"
            result = self.bisect_inbound(handler.good_revision, handler.bad_revision)
        else:
            # TODO(ER): maybe this should be an exception...
            result = (None, None)

        return result
コード例 #5
0
    def bisect_nightly(self):
        handler = NightlyHandler(ensure_good_and_bad=True)
        result = self.bisector.bisect(handler, self.good, self.bad)
        if result == Bisection.FINISHED:
            print("Got as far as we can go bisecting nightlies...")
            handler.print_range()
            print("Switching bisection method to taskcluster")
            result = self.bisect_inbound(handler.good_revision,
                                         handler.bad_revision)
        else:
            # TODO(ER): maybe this should be an exception...
            result = (None, None)

        return result
コード例 #6
0
    def bisect(self, fetch_config, options):
        self.stop()

        # global preferences
        global_prefs = get_prefs()
        # apply the global prefs now
        apply_prefs(global_prefs)

        self.bisector = GuiBisector(fetch_config,
                                    persist=global_prefs['persist'])
        # create a QThread, and move self.bisector in it. This will
        # allow to the self.bisector slots (connected after the move)
        # to be automatically called in the thread.
        self.thread = QThread()
        self.bisector.moveToThread(self.thread)
        self.bisector.download_manager.download_progress.connect(
            self.show_dl_progress)
        self.bisector.test_runner.evaluate_started.connect(self.evaluate)
        self.bisector.finished.connect(self.bisection_finished)
        self.bisector_created.emit(self.bisector)
        if options['bisect_type'] == 'nightlies':
            handler = NightlyHandler(find_fix=options['find_fix'])
            good = options['good_date']
            bad = options['bad_date']
        else:
            handler = InboundHandler(find_fix=options['find_fix'])
            good = options['good_changeset']
            bad = options['bad_changeset']

        # options for the app launcher
        launcher_kwargs = {}
        for name in ('profile', 'preferences'):
            if name in options:
                value = options[name]
                if value:
                    launcher_kwargs[name] = value
        self.bisector.test_runner.launcher_kwargs = launcher_kwargs

        self.thread.start()
        self.bisector._bisect_args = (handler, good, bad)
        # this will be called in the worker thread.
        QTimer.singleShot(0, self.bisector.bisect)

        self.running_state_changed.emit(True)
コード例 #7
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.pop('good'), options.pop('bad')
        if is_date_or_datetime(good) and is_date_or_datetime(bad) \
                and not fetch_config.should_use_taskcluster():
            handler = NightlyHandler(find_fix=options['find_fix'])
        else:
            handler = InboundHandler(find_fix=options['find_fix'])

        self.worker._bisect_args = (handler, good, bad)
        self.worker.download_in_background = \
            self.global_prefs['background_downloads']
        return self.worker.bisect
コード例 #8
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
コード例 #9
0
ファイル: test_bisector.py プロジェクト: saru95/mozregression
 def setUp(self):
     self.handler = NightlyHandler()
コード例 #10
0
ファイル: test_bisector.py プロジェクト: saru95/mozregression
class TestNightlyHandler(unittest.TestCase):
    def setUp(self):
        self.handler = NightlyHandler()

    @patch('mozregression.bisector.BisectorHandler.initialize')
    def test_initialize(self, initialize):
        def get_associated_data(index):
            return index
        self.handler.build_range = [Mock(build_date=0),
                                    Mock(build_date=1)]
        self.handler.initialize()
        # check that members are set
        self.assertEqual(self.handler.good_date, 0)
        self.assertEqual(self.handler.bad_date, 1)

        initialize.assert_called_with(self.handler)

    @patch('mozregression.bisector.LOG')
    def test_print_progress(self, logger):
        log = []
        logger.info = log.append
        self.handler.good_date = datetime.date(2014, 11, 10)
        self.handler.bad_date = datetime.date(2014, 11, 20)

        new_data = [
            Mock(build_date=datetime.date(2014, 11, 15)),
            Mock(build_date=datetime.date(2014, 11, 20))
        ]

        self.handler._print_progress(new_data)
        self.assertIn('from [2014-11-10, 2014-11-20] (10 days)', log[0])
        self.assertIn('to [2014-11-15, 2014-11-20] (5 days)', log[0])
        self.assertIn('2 steps left', log[0])

    @patch('mozregression.bisector.LOG')
    def test_user_exit(self, logger):
        log = []
        logger.info = log.append
        self.handler.good_date = datetime.date(2014, 11, 10)
        self.handler.bad_date = datetime.date(2014, 11, 20)
        self.handler.user_exit(0)
        self.assertEqual('Newest known good nightly: 2014-11-10', log[0])
        self.assertEqual('Oldest known bad nightly: 2014-11-20', log[1])

    @patch('mozregression.bisector.LOG')
    def test_print_range_without_repo(self, logger):
        log = []
        logger.info = log.append
        logger.error = log.append
        self.handler.good_date = datetime.date(2014, 11, 10)
        self.handler.bad_date = datetime.date(2014, 11, 20)
        self.handler.print_range()
        self.assertIn("no pushlog url available", log[0])
        self.assertEqual('Newest known good nightly: 2014-11-10', log[1])
        self.assertEqual('Oldest known bad nightly: 2014-11-20', log[2])

    @patch('mozregression.bisector.LOG')
    def test_print_range_rev_availables(self, logger):
        self.handler.found_repo = 'https://hg.mozilla.repo'
        self.handler.good_revision = '2'
        self.handler.bad_revision = '6'
        self.handler.good_date = datetime.date(2015, 1, 1)
        self.handler.bad_date = datetime.date(2015, 1, 2)
        log = []
        logger.info = log.append

        self.handler.print_range()
        self.assertEqual(log[0], "Last good revision: 2 (2015-01-01)")
        self.assertEqual(log[1], "First bad revision: 6 (2015-01-02)")
        self.assertIn(self.handler.get_pushlog_url(), log[2])

    @patch('mozregression.bisector.LOG')
    def test_print_range_no_rev_availables(self, logger):
        self.handler.found_repo = 'https://hg.mozilla.repo'
        self.handler.good_date = datetime.date(2014, 11, 10)
        self.handler.bad_date = datetime.date(2014, 11, 20)
        log = []
        logger.info = log.append

        self.handler.print_range()
        self.assertEqual('Newest known good nightly: 2014-11-10', log[0])
        self.assertEqual('Oldest known bad nightly: 2014-11-20', log[1])
        self.assertIn("pushloghtml?startdate=2014-11-10&enddate=2014-11-20",
                      log[2])
コード例 #11
0
 def setUp(self):
     self.handler = NightlyHandler()
コード例 #12
0
class TestNightlyHandler(unittest.TestCase):
    def setUp(self):
        self.handler = NightlyHandler()

    def test_build_infos(self):
        def get_associated_data(index):
            return index
        new_data = MagicMock(get_associated_data=get_associated_data)
        self.handler.set_build_data(new_data)
        result = self.handler.build_infos(1)
        self.assertEqual(result, {
            'build_type': 'nightly',
            'build_date': 1,
        })

    @patch('mozregression.bisector.BisectorHandler.initialize')
    def test_initialize(self, initialize):
        def get_associated_data(index):
            return index
        self.handler.build_data = Mock(get_associated_data=get_associated_data)
        self.handler.initialize()
        # check that members are set
        self.assertEqual(self.handler.good_date, 0)
        self.assertEqual(self.handler.bad_date, -1)

        initialize.assert_called_with(self.handler)

    def test_print_progress(self):
        log = []
        self.handler._logger = Mock(info=log.append)
        self.handler.good_date = datetime.date(2014, 11, 10)
        self.handler.bad_date = datetime.date(2014, 11, 20)

        def get_associated_data(index):
            if index == 0:
                return datetime.date(2014, 11, 15)
            elif index == -1:
                return datetime.date(2014, 11, 20)
        new_data = Mock(get_associated_data=get_associated_data)

        self.handler._print_progress(new_data)
        self.assertIn('from [2014-11-10, 2014-11-20] (10 days)', log[0])
        self.assertIn('to [2014-11-15, 2014-11-20] (5 days)', log[0])
        self.assertIn('2 steps left', log[0])

    def test_user_exit(self):
        log = []
        self.handler._logger = Mock(info=log.append)
        self.handler.good_date = datetime.date(2014, 11, 10)
        self.handler.bad_date = datetime.date(2014, 11, 20)
        self.handler.user_exit(0)
        self.assertEqual('Newest known good nightly: 2014-11-10', log[0])
        self.assertEqual('Oldest known bad nightly: 2014-11-20', log[1])

    def test_print_range_without_repo(self):
        log = []
        self.handler._logger = Mock(info=log.append, error=log.append)
        self.handler.good_date = datetime.date(2014, 11, 10)
        self.handler.bad_date = datetime.date(2014, 11, 20)
        self.handler.print_range()
        self.assertIn("no pushlog url available", log[0])
        self.assertEqual('Newest known good nightly: 2014-11-10', log[1])
        self.assertEqual('Oldest known bad nightly: 2014-11-20', log[2])

    def test_print_range_rev_availables(self):
        self.handler.found_repo = 'https://hg.mozilla.repo'
        self.handler.good_revision = '2'
        self.handler.bad_revision = '6'
        log = []
        self.handler._logger = Mock(info=log.append)

        self.handler.print_range()
        self.assertEqual(log[0], "Last good revision: 2")
        self.assertEqual(log[1], "First bad revision: 6")
        self.assertIn(self.handler.get_pushlog_url(), log[2])

    def test_print_range_no_rev_availables(self):
        self.handler.found_repo = 'https://hg.mozilla.repo'
        self.handler.good_date = datetime.date(2014, 11, 10)
        self.handler.bad_date = datetime.date(2014, 11, 20)
        log = []
        self.handler._logger = Mock(info=log.append)

        self.handler.print_range()
        self.assertEqual('Newest known good nightly: 2014-11-10', log[0])
        self.assertEqual('Oldest known bad nightly: 2014-11-20', log[1])
        self.assertIn("pushloghtml?startdate=2014-11-10&enddate=2014-11-20",
                      log[2])
コード例 #13
0
class TestNightlyHandler(unittest.TestCase):
    def setUp(self):
        self.handler = NightlyHandler()

    def test_build_infos(self):
        fetch_config = create_config('fennec-2.3', 'linux', 64)
        fetch_config.set_nightly_repo('my-repo')

        def get_associated_data(index):
            return index
        new_data = MagicMock(get_associated_data=get_associated_data)
        self.handler.set_build_data(new_data)
        result = self.handler.build_infos(1, fetch_config)
        self.assertEqual(result, {
            'build_type': 'nightly',
            'build_date': 1,
            'app_name': 'fennec',
            'repo': 'my-repo'
        })

    @patch('mozregression.bisector.BisectorHandler.initialize')
    def test_initialize(self, initialize):
        def get_associated_data(index):
            return index
        self.handler.build_data = Mock(get_associated_data=get_associated_data)
        self.handler.initialize()
        # check that members are set
        self.assertEqual(self.handler.good_date, 0)
        self.assertEqual(self.handler.bad_date, -1)

        initialize.assert_called_with(self.handler)

    def test_print_progress(self):
        log = []
        self.handler._logger = Mock(info=log.append)
        self.handler.good_date = datetime.date(2014, 11, 10)
        self.handler.bad_date = datetime.date(2014, 11, 20)

        def get_associated_data(index):
            if index == 0:
                return datetime.date(2014, 11, 15)
            elif index == -1:
                return datetime.date(2014, 11, 20)
        new_data = Mock(get_associated_data=get_associated_data)

        self.handler._print_progress(new_data)
        self.assertIn('from [2014-11-10, 2014-11-20] (10 days)', log[0])
        self.assertIn('to [2014-11-15, 2014-11-20] (5 days)', log[0])
        self.assertIn('2 steps left', log[0])

    def test_user_exit(self):
        log = []
        self.handler._logger = Mock(info=log.append)
        self.handler.good_date = datetime.date(2014, 11, 10)
        self.handler.bad_date = datetime.date(2014, 11, 20)
        self.handler.user_exit(0)
        self.assertEqual('Newest known good nightly: 2014-11-10', log[0])
        self.assertEqual('Oldest known bad nightly: 2014-11-20', log[1])

    def test_print_range_without_repo(self):
        log = []
        self.handler._logger = Mock(info=log.append, error=log.append)
        self.handler.good_date = datetime.date(2014, 11, 10)
        self.handler.bad_date = datetime.date(2014, 11, 20)
        self.handler.print_range()
        self.assertIn("no pushlog url available", log[0])
        self.assertEqual('Newest known good nightly: 2014-11-10', log[1])
        self.assertEqual('Oldest known bad nightly: 2014-11-20', log[2])

    def test_print_range_rev_availables(self):
        self.handler.found_repo = 'https://hg.mozilla.repo'
        self.handler.good_revision = '2'
        self.handler.bad_revision = '6'
        log = []
        self.handler._logger = Mock(info=log.append)

        self.handler.print_range()
        self.assertEqual(log[0], "Last good revision: 2")
        self.assertEqual(log[1], "First bad revision: 6")
        self.assertIn(self.handler.get_pushlog_url(), log[2])

    def test_print_range_no_rev_availables(self):
        self.handler.found_repo = 'https://hg.mozilla.repo'
        self.handler.good_date = datetime.date(2014, 11, 10)
        self.handler.bad_date = datetime.date(2014, 11, 20)
        log = []
        self.handler._logger = Mock(info=log.append)

        self.handler.print_range()
        self.assertEqual('Newest known good nightly: 2014-11-10', log[0])
        self.assertEqual('Oldest known bad nightly: 2014-11-20', log[1])
        self.assertIn("pushloghtml?startdate=2014-11-10&enddate=2014-11-20",
                      log[2])
コード例 #14
0
class TestNightlyHandler(unittest.TestCase):
    def setUp(self):
        self.handler = NightlyHandler()

    @patch('mozregression.bisector.BisectorHandler.initialize')
    def test_initialize(self, initialize):
        def get_associated_data(index):
            return index

        self.handler.build_range = [Mock(build_date=0), Mock(build_date=1)]
        self.handler.initialize()
        # check that members are set
        self.assertEqual(self.handler.good_date, 0)
        self.assertEqual(self.handler.bad_date, 1)

        initialize.assert_called_with(self.handler)

    @patch('mozregression.bisector.LOG')
    def test_print_progress(self, logger):
        log = []
        logger.info = log.append
        self.handler.good_date = datetime.date(2014, 11, 10)
        self.handler.bad_date = datetime.date(2014, 11, 20)

        new_data = [
            Mock(build_date=datetime.date(2014, 11, 15)),
            Mock(build_date=datetime.date(2014, 11, 20))
        ]

        self.handler._print_progress(new_data)
        self.assertIn('from [2014-11-10, 2014-11-20] (10 days)', log[0])
        self.assertIn('to [2014-11-15, 2014-11-20] (5 days)', log[0])
        self.assertIn('2 steps left', log[0])

    @patch('mozregression.bisector.LOG')
    def test_user_exit(self, logger):
        log = []
        logger.info = log.append
        self.handler.good_date = datetime.date(2014, 11, 10)
        self.handler.bad_date = datetime.date(2014, 11, 20)
        self.handler.user_exit(0)
        self.assertEqual('Newest known good nightly: 2014-11-10', log[0])
        self.assertEqual('Oldest known bad nightly: 2014-11-20', log[1])

    @patch('mozregression.bisector.LOG')
    def test_print_range_without_repo(self, logger):
        log = []
        logger.info = log.append
        logger.error = log.append
        self.handler.good_date = datetime.date(2014, 11, 10)
        self.handler.bad_date = datetime.date(2014, 11, 20)
        self.handler.print_range()
        self.assertIn("no pushlog url available", log[0])
        self.assertEqual('Newest known good nightly: 2014-11-10', log[1])
        self.assertEqual('Oldest known bad nightly: 2014-11-20', log[2])

    @patch('mozregression.bisector.LOG')
    def test_print_range_rev_availables(self, logger):
        self.handler.found_repo = 'https://hg.mozilla.repo'
        self.handler.good_revision = '2'
        self.handler.bad_revision = '6'
        self.handler.good_date = datetime.date(2015, 1, 1)
        self.handler.bad_date = datetime.date(2015, 1, 2)
        log = []
        logger.info = log.append

        self.handler.print_range()
        self.assertEqual(log[0], "Last good revision: 2 (2015-01-01)")
        self.assertEqual(log[1], "First bad revision: 6 (2015-01-02)")
        self.assertIn(self.handler.get_pushlog_url(), log[2])

    @patch('mozregression.bisector.LOG')
    def test_print_range_no_rev_availables(self, logger):
        self.handler.found_repo = 'https://hg.mozilla.repo'
        self.handler.good_date = datetime.date(2014, 11, 10)
        self.handler.bad_date = datetime.date(2014, 11, 20)
        log = []
        logger.info = log.append

        self.handler.print_range()
        self.assertEqual('Newest known good nightly: 2014-11-10', log[0])
        self.assertEqual('Oldest known bad nightly: 2014-11-20', log[1])
        self.assertIn("pushloghtml?startdate=2014-11-10&enddate=2014-11-20",
                      log[2])