Пример #1
0
    def create_launcher(self, build_info):
        """
        Create and returns a :class:`mozregression.launchers.Launcher`.
        """
        if build_info["build_type"] == "nightly":
            self.logger.info("Running nightly for %s" % build_info["build_date"])
        else:
            self.logger.info(
                "Testing inbound build with timestamp %s,"
                " revision %s" % (build_info["timestamp"], build_info["revision"])
            )

        return create_launcher(build_info["app_name"], build_info["build_path"])
Пример #2
0
    def create_launcher(self, build_info):
        """
        Create and returns a :class:`mozregression.launchers.Launcher`.
        """
        if build_info.build_type == 'nightly':
            self.logger.info("Running nightly for %s"
                             % build_info.build_date)
        else:
            self.logger.info("Testing inbound build built on %s,"
                             " revision %s"
                             % (build_info.build_date,
                                build_info.short_changeset))

        return create_launcher(build_info)
Пример #3
0
    def create_launcher(self, build_info):
        """
        Create and returns a :class:`mozregression.launchers.Launcher`.
        """
        if build_info['build_type'] == 'nightly':
            self.logger.info("Running nightly for %s" %
                             build_info["build_date"])
        else:
            self.logger.info("Testing inbound build with timestamp %s,"
                             " revision %s" %
                             (build_info['timestamp'], build_info['revision']))

        return create_launcher(build_info['app_name'],
                               build_info['build_path'])
Пример #4
0
    def create_launcher(self, build_info):
        """
        Create and returns a :class:`mozregression.launchers.Launcher`.
        """
        if build_info.build_type == 'nightly':
            if isinstance(build_info.build_date, datetime.datetime):
                desc = ("for buildid %s" %
                        build_info.build_date.strftime("%Y%m%d%H%M%S"))
            else:
                desc = "for %s" % build_info.build_date
        else:
            desc = ("built on %s, revision %s" %
                    (build_info.build_date, build_info.short_changeset))
        LOG.info("Running %s build %s" % (build_info.repo_name, desc))

        return create_launcher(build_info)
Пример #5
0
    def create_launcher(self, build_info):
        """
        Create and returns a :class:`mozregression.launchers.Launcher`.
        """
        if build_info.build_type == 'nightly':
            if isinstance(build_info.build_date, datetime.datetime):
                desc = ("for buildid %s"
                        % build_info.build_date.strftime("%Y%m%d%H%M%S"))
            else:
                desc = "for %s" % build_info.build_date
        else:
            desc = ("built on %s, revision %s"
                    % (build_info.build_date,
                       build_info.short_changeset))
        LOG.info("Running %s build %s" % (build_info.repo_name, desc))

        return create_launcher(build_info)
Пример #6
0
 def create_launcher(self, build_info):
     """
     Create and returns a :class:`mozregression.launchers.Launcher`.
     """
     if build_info['build_type'] == 'nightly':
         date = build_info['build_date']
         nightly_repo = self.fetch_config.get_nightly_repo(date)
         persist_prefix = '%s--%s--' % (date, nightly_repo)
         self.logger.info("Running nightly for %s" % date)
     else:
         persist_prefix = '%s--%s--' % (build_info['timestamp'],
                                        self.fetch_config.inbound_branch)
         self.logger.info("Testing inbound build with timestamp %s,"
                          " revision %s"
                          % (build_info['timestamp'],
                             build_info['revision']))
     build_url = build_info['build_url']
     return create_launcher(self.fetch_config.app_name,
                            build_url,
                            persist=self.persist,
                            persist_prefix=persist_prefix)
Пример #7
0
    def bisect_nightlies(self):
        mid = self.nightly_data.mid_point()

        if len(self.nightly_data) == 0:
            sys.exit("Unable to get valid builds within the given"
                     " range. You should try to launch mozregression"
                     " again with a larger date range.")

        good_date = self.nightly_data.get_date_for_index(0)
        bad_date = self.nightly_data.get_date_for_index(-1)
        mid_date = self.nightly_data.get_date_for_index(mid)

        if mid_date == bad_date or mid_date == good_date:
            self._logger.info("Got as far as we can go bisecting nightlies...")
            self._ensure_metadata()
            self.print_range(good_date, bad_date)
            if self.fetch_config.can_go_inbound():
                self._logger.info("... attempting to bisect inbound builds"
                                  " (starting from previous week, to make"
                                  " sure no inbound revision is missed)")
                infos = {}
                days = 6
                while not 'changeset' in infos:
                    days += 1
                    prev_date = good_date - datetime.timedelta(days=days)
                    infos = self.nightly_data.get_build_infos_for_date(prev_date)
                if days > 7:
                    self._logger.info("At least one build folder was"
                                      " invalid, we have to start from"
                                      " %d days ago." % days)
                self.last_good_revision = infos['changeset']
                self.bisect_inbound()
                return
            else:
                message = ("Can not bissect 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 + '.')
                sys.exit()

        build_url = self.nightly_data[mid]['build_url']
        persist_prefix = ('%s-%s-'
                          % (mid_date,
                             self.fetch_config.get_nightly_repo(mid_date)))
        self._logger.info("Running nightly for %s" % mid_date)
        launcher = create_launcher(self.fetch_config.app_name,
                                   build_url,
                                   persist=self.options.persist,
                                   persist_prefix=persist_prefix)
        launcher.start(**self.launcher_kwargs)
        info = launcher.get_app_info()
        self.found_repo = info['application_repository']

        self.prev_date = self.curr_date
        self.curr_date = mid_date

        verdict = self._get_verdict('nightly')
        launcher.stop()
        if verdict == 'g':
            self.last_good_revision = info['application_changeset']
            self.print_nightly_regression_progress(good_date, bad_date,
                                                   mid_date, bad_date)
            self.nightly_data = self.nightly_data[mid:]
        elif verdict == 'b':
            self.first_bad_revision = info['application_changeset']
            self.print_nightly_regression_progress(good_date, bad_date,
                                                   good_date, mid_date)
            self.nightly_data = self.nightly_data[:mid]
        elif verdict == 's':
            del self.nightly_data[mid]
        elif verdict == 'e':
            good_date_string = '%04d-%02d-%02d' % (good_date.year,
                                                   good_date.month,
                                                   good_date.day)
            bad_date_string = '%04d-%02d-%02d' % (bad_date.year,
                                                  bad_date.month,
                                                  bad_date.day)
            self._logger.info('Newest known good nightly: %s'
                              % good_date_string)
            self._logger.info('Oldest known bad nightly: %s' % bad_date_string)
            self._logger.info('To resume, run:')
            self.print_nightly_resume_info(good_date_string,
                                           bad_date_string)
            return
        self.bisect_nightlies()
Пример #8
0
    def bisect_inbound(self, inbound_revisions=None):
        self.found_repo = get_repo_url(inbound_branch=self.fetch_config.inbound_branch)

        if inbound_revisions is None:
            self._logger.info("Getting inbound builds between %s and %s"
                              % (self.last_good_revision,
                                 self.first_bad_revision))
            # anything within twelve hours is potentially within the range
            # (should be a tighter but some older builds have wrong timestamps,
            # see https://bugzilla.mozilla.org/show_bug.cgi?id=1018907 ...
            # we can change this at some point in the future, after those builds
            # expire)
            build_finder = BuildsFinder(self.fetch_config)
            inbound_revisions = build_finder.get_build_infos(self.last_good_revision,
                                                             self.first_bad_revision,
                                                             range=60*60*12)

        mid = inbound_revisions.mid_point()
        if mid == 0:
            self._logger.info("Oh noes, no (more) inbound revisions :(")
            self.print_range()
            self.offer_build(self.last_good_revision,
                             self.first_bad_revision)
            return
        # hardcode repo to mozilla-central (if we use inbound, we may be
        # missing some revisions that went into the nightlies which we may
        # also be comparing against...)

        self._logger.info("Testing inbound build with timestamp %s,"
                          " revision %s"
                          % (inbound_revisions[mid]['timestamp'],
                             inbound_revisions[mid]['revision']))
        build_url = inbound_revisions[mid]['build_url']
        persist_prefix='%s-%s-' % (inbound_revisions[mid]['timestamp'],
                                   self.fetch_config.inbound_branch)
        launcher = create_launcher(self.fetch_config.app_name,
                                   build_url,
                                   persist=self.options.persist,
                                   persist_prefix=persist_prefix)
        launcher.start()

        verdict = self._get_verdict('inbound', offer_skip=False)
        info = launcher.get_app_info()
        launcher.stop()
        if verdict == 'g':
            self.last_good_revision = info['application_changeset']
        elif verdict == 'b':
            self.first_bad_revision = info['application_changeset']
        elif verdict == 'r':
            # do the same thing over again
            self.bisect_inbound(inbound_revisions=inbound_revisions)
            return
        elif verdict == 'e':
            self._logger.info('Newest known good inbound revision: %s'
                              % self.last_good_revision)
            self._logger.info('Oldest known bad inbound revision: %s'
                              % self.first_bad_revision)

            self._logger.info('To resume, run:')
            self.print_inbound_resume_info(self.last_good_revision,
                                           self.first_bad_revision)
            return

        if len(inbound_revisions) > 1 and verdict in ('g', 'b'):
            if verdict == 'g':
                revisions_left = inbound_revisions[mid:]
            else:
                revisions_left = inbound_revisions[:mid]
            revisions_left.ensure_limits()
            if len(revisions_left) > 0:
                self.print_inbound_regression_progress(inbound_revisions,
                                                       revisions_left)
            self.bisect_inbound(revisions_left)
        else:
            # no more inbounds to be bisect, we must build
            self._logger.info("No more inbounds to bisect")
            self.print_range()
            self.offer_build(self.last_good_revision, self.first_bad_revision)
Пример #9
0
    def bisect_nightlies(self):
        mid = self.nightly_data.mid_point()

        if len(self.nightly_data) == 0:
            sys.exit("Unable to get valid builds within the given"
                     " range. You should try to launch mozregression"
                     " again with a larger date range.")

        good_date = self.nightly_data.get_date_for_index(0)
        bad_date = self.nightly_data.get_date_for_index(-1)
        mid_date = self.nightly_data.get_date_for_index(mid)

        if mid_date == bad_date or mid_date == good_date:
            self._logger.info("Got as far as we can go bisecting nightlies...")
            self._ensure_metadata()
            self.print_range(good_date, bad_date)
            if self.fetch_config.can_go_inbound():
                self._logger.info("... attempting to bisect inbound builds"
                                  " (starting from previous week, to make"
                                  " sure no inbound revision is missed)")
                infos = {}
                days = 6
                while not 'changeset' in infos:
                    days += 1
                    prev_date = good_date - datetime.timedelta(days=days)
                    infos = self.nightly_data.get_build_infos_for_date(
                        prev_date)
                if days > 7:
                    self._logger.info("At least one build folder was"
                                      " invalid, we have to start from"
                                      " %d days ago." % days)
                self.last_good_revision = infos['changeset']
                self.bisect_inbound()
                return
            else:
                message = ("Can not bissect 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 + '.')
                sys.exit()

        build_url = self.nightly_data[mid]['build_url']
        persist_prefix = (
            '%s-%s-' %
            (mid_date, self.fetch_config.get_nightly_repo(mid_date)))
        self._logger.info("Running nightly for %s" % mid_date)
        launcher = create_launcher(self.fetch_config.app_name,
                                   build_url,
                                   persist=self.options.persist,
                                   persist_prefix=persist_prefix)
        launcher.start(**self.launcher_kwargs)
        info = launcher.get_app_info()
        self.found_repo = info['application_repository']

        self.prev_date = self.curr_date
        self.curr_date = mid_date

        verdict = self._get_verdict('nightly')
        launcher.stop()
        if verdict == 'g':
            self.last_good_revision = info['application_changeset']
            self.print_nightly_regression_progress(good_date, bad_date,
                                                   mid_date, bad_date)
            self.nightly_data = self.nightly_data[mid:]
        elif verdict == 'b':
            self.first_bad_revision = info['application_changeset']
            self.print_nightly_regression_progress(good_date, bad_date,
                                                   good_date, mid_date)
            self.nightly_data = self.nightly_data[:mid]
        elif verdict == 's':
            del self.nightly_data[mid]
        elif verdict == 'e':
            good_date_string = '%04d-%02d-%02d' % (
                good_date.year, good_date.month, good_date.day)
            bad_date_string = '%04d-%02d-%02d' % (bad_date.year,
                                                  bad_date.month, bad_date.day)
            self._logger.info('Newest known good nightly: %s' %
                              good_date_string)
            self._logger.info('Oldest known bad nightly: %s' % bad_date_string)
            self._logger.info('To resume, run:')
            self.print_nightly_resume_info(good_date_string, bad_date_string)
            return
        self.bisect_nightlies()
Пример #10
0
    def bisect_inbound(self, inbound_revisions=None):
        self.found_repo = get_repo_url(
            inbound_branch=self.fetch_config.inbound_branch)

        if inbound_revisions is None:
            self._logger.info(
                "Getting inbound builds between %s and %s" %
                (self.last_good_revision, self.first_bad_revision))
            # anything within twelve hours is potentially within the range
            # (should be a tighter but some older builds have wrong timestamps,
            # see https://bugzilla.mozilla.org/show_bug.cgi?id=1018907 ...
            # we can change this at some point in the future, after those builds
            # expire)
            build_finder = BuildsFinder(self.fetch_config)
            inbound_revisions = build_finder.get_build_infos(
                self.last_good_revision,
                self.first_bad_revision,
                range=60 * 60 * 12)

        mid = inbound_revisions.mid_point()
        if mid == 0:
            self._logger.info("Oh noes, no (more) inbound revisions :(")
            self.print_range()
            self.offer_build(self.last_good_revision, self.first_bad_revision)
            return
        # hardcode repo to mozilla-central (if we use inbound, we may be
        # missing some revisions that went into the nightlies which we may
        # also be comparing against...)

        self._logger.info("Testing inbound build with timestamp %s,"
                          " revision %s" %
                          (inbound_revisions[mid]['timestamp'],
                           inbound_revisions[mid]['revision']))
        build_url = inbound_revisions[mid]['build_url']
        persist_prefix = '%s-%s-' % (inbound_revisions[mid]['timestamp'],
                                     self.fetch_config.inbound_branch)
        launcher = create_launcher(self.fetch_config.app_name,
                                   build_url,
                                   persist=self.options.persist,
                                   persist_prefix=persist_prefix)
        launcher.start()

        verdict = self._get_verdict('inbound', offer_skip=False)
        info = launcher.get_app_info()
        launcher.stop()
        if verdict == 'g':
            self.last_good_revision = info['application_changeset']
        elif verdict == 'b':
            self.first_bad_revision = info['application_changeset']
        elif verdict == 'r':
            # do the same thing over again
            self.bisect_inbound(inbound_revisions=inbound_revisions)
            return
        elif verdict == 'e':
            self._logger.info('Newest known good inbound revision: %s' %
                              self.last_good_revision)
            self._logger.info('Oldest known bad inbound revision: %s' %
                              self.first_bad_revision)

            self._logger.info('To resume, run:')
            self.print_inbound_resume_info(self.last_good_revision,
                                           self.first_bad_revision)
            return

        if len(inbound_revisions) > 1 and verdict in ('g', 'b'):
            if verdict == 'g':
                revisions_left = inbound_revisions[mid:]
            else:
                revisions_left = inbound_revisions[:mid]
            revisions_left.ensure_limits()
            if len(revisions_left) > 0:
                self.print_inbound_regression_progress(inbound_revisions,
                                                       revisions_left)
            self.bisect_inbound(revisions_left)
        else:
            # no more inbounds to be bisect, we must build
            self._logger.info("No more inbounds to bisect")
            self.print_range()
            self.offer_build(self.last_good_revision, self.first_bad_revision)