Example #1
0
 def _convert_to_bisect_arg(self, value):
     """
     Transform a string value to a date or datetime if it looks like it.
     """
     try:
         value = parse_date(value)
     except DateFormatError:
         try:
             repo = self.options.repo
             if (get_name(repo) == 'mozilla-release' or
                     (not repo and re.match(r'^\d+\.\d\.\d$', value))):
                 new_value = tag_of_release(value)
                 if not repo:
                     self.logger.info("Assuming repo mozilla-release")
                     self.fetch_config.set_repo('mozilla-release')
                 self.logger.info("Using tag %s for release %s"
                                  % (new_value, value))
                 value = new_value
             elif (get_name(repo) == 'mozilla-beta' or
                   (not repo and re.match(r'^\d+\.0b\d+$', value))):
                 new_value = tag_of_beta(value)
                 if not repo:
                     self.logger.info("Assuming repo mozilla-beta")
                     self.fetch_config.set_repo('mozilla-beta')
                 self.logger.info("Using tag %s for release %s"
                                  % (new_value, value))
                 value = new_value
             else:
                 new_value = parse_date(date_of_release(value))
                 self.logger.info("Using date %s for release %s"
                                  % (new_value, value))
                 value = new_value
         except UnavailableRelease:
             self.logger.info("%s is not a release, assuming it's a hash..." % value)
     return value
Example #2
0
 def _convert_to_bisect_arg(self, value):
     """
     Transform a string value to a date or datetime if it looks like it.
     """
     try:
         value = parse_date(value)
     except DateFormatError:
         try:
             repo = self.options.repo
             if (get_name(repo) == 'mozilla-release' or
                     (not repo and re.match(r'^\d+\.\d\.\d$', value))):
                 new_value = tag_of_release(value)
                 if not repo:
                     self.logger.info("Assuming repo mozilla-release")
                     self.fetch_config.set_repo('mozilla-release')
                 self.logger.info("Using tag %s for release %s"
                                  % (new_value, value))
                 value = new_value
             elif (get_name(repo) == 'mozilla-beta' or
                   (not repo and re.match(r'^\d+\.0b\d+$', value))):
                 new_value = tag_of_beta(value)
                 if not repo:
                     self.logger.info("Assuming repo mozilla-beta")
                     self.fetch_config.set_repo('mozilla-beta')
                 self.logger.info("Using tag %s for release %s"
                                  % (new_value, value))
                 value = new_value
             else:
                 new_value = parse_date(date_of_release(value))
                 self.logger.info("Using date %s for release %s"
                                  % (new_value, value))
                 value = new_value
         except UnavailableRelease:
             self.logger.info("%s is not a release, assuming it's a hash..." % value)
     return value
Example #3
0
    def __init__(self, good, bad, platform, warning,
                 warning_limit, warning_re, ignore_lines,
                 required_test):

        init_logger()
        self.use_nightly = True
        try:
            self.good = parse_date(good)
            self.bad = parse_date(bad)
        except DateFormatError:
            # This hopefully a revision range. We can bypass nightly and
            # go directly to InboundHandler. That itself is a bit of a misnomer,
            # it will still bisect m-c builds, but by changeset range, not date
            # range.
            self.use_nightly = False
            self.good = good
            self.bad = bad

        self.ignore_lines = ignore_lines
        self.test_runner = WarningTestRunner(
                warning, platform,
                ignore_lines=ignore_lines,
                warning_re=warning_re,
                warning_limit=warning_limit,
                required_test=required_test)

        # Convert the platform to a mozregression friendly version.
        # Also avoid overwriting the os module by *not* using |os| for a
        # variable name.
        (_os, bits) = re.match(r'([a-zA-Z]+)-?([0-9]+)?', platform).groups()
        if not bits or bits not in (32, 64):
            bits = 32

        # windows7-32
        # windows7-32-vm
        # win32
        # win64
        if '64' in platform:
            bits = 64

        if _os.startswith('win'):
            _os = 'win'

        print "_os = %s bits = %s" % (_os, bits)

        # TODO(ER): We might be able to ditch this.
        self.fetch_config = create_config('firefox', _os, int(bits))
        # Hardcode to m-c for now.
        self.fetch_config.set_repo('mozilla-central')
        self.fetch_config.set_build_type('debug')

        class FakeDownloadManager:
            def focus_download(self, foo):
                pass

        dm = FakeDownloadManager()
        self.bisector = Bisector(self.fetch_config, self.test_runner, dm, False, None)
Example #4
0
    def __init__(self, good, bad, platform, warning, warning_limit, warning_re,
                 ignore_lines, required_test):

        init_logger()
        self.use_nightly = True
        try:
            self.good = parse_date(good)
            self.bad = parse_date(bad)
        except DateFormatError:
            # This hopefully a revision range. We can bypass nightly and
            # go directly to InboundHandler. That itself is a bit of a misnomer,
            # it will still bisect m-c builds, but by changeset range, not date
            # range.
            self.use_nightly = False
            self.good = good
            self.bad = bad

        self.ignore_lines = ignore_lines
        self.test_runner = WarningTestRunner(warning,
                                             platform,
                                             ignore_lines=ignore_lines,
                                             warning_re=warning_re,
                                             warning_limit=warning_limit,
                                             required_test=required_test)

        # Convert the platform to a mozregression friendly version.
        # Also avoid overwriting the os module by *not* using |os| for a
        # variable name.
        (_os, bits) = re.match(r'([a-zA-Z]+)-?([0-9]+)?', platform).groups()
        if not bits or bits not in (32, 64):
            bits = 32

        # windows7-32
        # windows7-32-vm
        # win32
        # win64
        if '64' in platform:
            bits = 64

        if _os.startswith('win'):
            _os = 'win'

        print("_os = %s bits = %s" % (_os, bits))

        # TODO(ER): We might be able to ditch this.
        self.fetch_config = create_config('firefox', _os, int(bits))
        # Hardcode to m-c for now.
        self.fetch_config.set_repo('mozilla-central')
        self.fetch_config.set_build_type('debug')

        class FakeDownloadManager:
            def focus_download(self, foo):
                pass

        dm = FakeDownloadManager()
        self.bisector = Bisector(self.fetch_config, self.test_runner, dm,
                                 False, None)
Example #5
0
 def get_date(self):
     currentw = self.stacked.currentWidget()
     if currentw == self.datew:
         return self.datew.date().toPyDate()
     elif currentw == self.buildidw:
         buildid = unicode(self.buildidw.text())
         try:
             return parse_date(buildid)
         except DateFormatError:
             raise DateFormatError(buildid, "Not a valid build id: `%s`")
     elif currentw == self.releasew:
         return parse_date(
             date_of_release(str(self.releasew.currentText())))
Example #6
0
 def _convert_to_bisect_arg(self, value):
     """
     Transform a string value to a date or datetime if it looks like it.
     """
     try:
         value = parse_date(value)
     except DateFormatError:
         try:
             new_value = parse_date(date_of_release(value))
             self.logger.info("Using date %s for release %s" % (new_value, value))
             value = new_value
         except UnavailableRelease:
             pass
     return value
Example #7
0
 def get_value(self):
     currentw = self.ui.stackedWidget.currentWidget()
     if currentw == self.ui.s_date:
         return self.ui.date.date().toPython()
     elif currentw == self.ui.s_release:
         return parse_date(date_of_release(str(self.ui.release.currentText())))
     elif currentw == self.ui.s_buildid:
         buildid = self.ui.buildid.text().strip()
         try:
             return parse_date(buildid)
         except DateFormatError:
             raise DateFormatError(buildid, "Not a valid build id: `%s`")
     elif currentw == self.ui.s_changeset:
         return self.ui.changeset.text().strip()
Example #8
0
 def _convert_to_bisect_arg(self, value):
     """
     Transform a string value to a date or datetime if it looks like it.
     """
     try:
         value = parse_date(value)
     except DateFormatError:
         try:
             new_value = parse_date(date_of_release(value))
             self.logger.info("Using date %s for release %s"
                              % (new_value, value))
             value = new_value
         except UnavailableRelease:
             pass
     return value
Example #9
0
 def get_value(self):
     currentw = self.ui.stackedWidget.currentWidget()
     if currentw == self.ui.calendar:
         return self.ui.date.selectedDate().toPyDate()
     elif currentw == self.ui.combo:
         return parse_date(
             date_of_release(str(self.ui.release.currentText())))
     elif currentw == self.ui.lineEdit1:
         buildid = unicode(self.ui.buildid.text())
         try:
             return parse_date(buildid)
         except DateFormatError:
             raise DateFormatError(buildid, "Not a valid build id: `%s`")
     elif currentw == self.ui.lineEdit2:
         return unicode(self.ui.changeset.text())
Example #10
0
 def get_value(self):
     currentw = self.stacked.currentWidget()
     if currentw == self.datew:
         return self.datew.date().toPyDate()
     elif currentw == self.buildidw:
         buildid = unicode(self.buildidw.text())
         try:
             return parse_date(buildid)
         except DateFormatError:
             raise DateFormatError(buildid, "Not a valid build id: `%s`")
     elif currentw == self.releasew:
         return parse_date(
             date_of_release(str(self.releasew.currentText())))
     elif currentw == self.revw:
         return unicode(self.revw.text())
Example #11
0
 def get_value(self):
     currentw = self.ui.stackedWidget.currentWidget()
     if currentw == self.ui.calendar:
         return self.ui.date.selectedDate().toPyDate()
     elif currentw == self.ui.combo:
         return parse_date(
             date_of_release(str(self.ui.release.currentText())))
     elif currentw == self.ui.lineEdit1:
         buildid = unicode(self.ui.buildid.text())
         try:
             return parse_date(buildid)
         except DateFormatError:
             raise DateFormatError(buildid, "Not a valid build id: `%s`")
     elif currentw == self.ui.lineEdit2:
         return unicode(self.ui.changeset.text())
Example #12
0
def check_nightlies(options, fetch_config, logger):
    default_bad_date = str(datetime.date.today())
    default_good_date = "2009-01-01"
    if mozinfo.os == 'win' and options.bits == 64:
        # first firefox build date for win64 is 2010-05-28
        default_good_date = "2010-05-28"
    if options.find_fix:
        default_bad_date, default_good_date = \
            default_good_date, default_bad_date
    # TODO: currently every fetch_config is nightly aware. Shoud we test
    # for this to be sure here ?
    fetch_config.set_nightly_repo(options.repo)
    if not options.bad_release and not options.bad_date:
        options.bad_date = default_bad_date
        logger.info("No 'bad' date specified, using %s" % options.bad_date)
    elif options.bad_release and options.bad_date:
        raise MozRegressionError("Options '--bad-release' and '--bad'"
                                 " are incompatible.")
    elif options.bad_release:
        options.bad_date = date_of_release(options.bad_release)
        logger.info("Using 'bad' date %s for release %s"
                    % (options.bad_date, options.bad_release))
    if not options.good_release and not options.good_date:
        options.good_date = default_good_date
        logger.info("No 'good' date specified, using %s"
                    % options.good_date)
    elif options.good_release and options.good_date:
        raise MozRegressionError("Options '--good-release' and '--good'"
                                 " are incompatible.")
    elif options.good_release:
        options.good_date = date_of_release(options.good_release)
        logger.info("Using 'good' date %s for release %s"
                    % (options.good_date, options.good_release))

    options.good_date = good_date = parse_date(options.good_date)
    options.bad_date = bad_date = parse_date(options.bad_date)
    if not options.find_fix and to_datetime(good_date) > to_datetime(bad_date):
        raise MozRegressionError(("Good date %s is later than bad date %s."
                                  " Maybe you wanted to use the --find-fix"
                                  " flag ?") % (good_date, bad_date))
    elif options.find_fix and to_datetime(good_date) < to_datetime(bad_date):
        raise MozRegressionError(("Bad date %s is later than good date %s."
                                  " You should not use the --find-fix flag"
                                  " in this case...") % (bad_date, good_date))
Example #13
0
    def validate(self):
        """
        Validate the options, define the `action` and `fetch_config` that
        should be used to run the application.
        """
        options = self.options

        user_defined_bits = options.bits is not None
        options.bits = parse_bits(options.bits or mozinfo.bits)
        fetch_config = create_config(options.app, mozinfo.os, options.bits)
        try:
            fetch_config.set_build_type(options.build_type)
        except MozRegressionError as msg:
            self.logger.warning(
                "%s (Defaulting to %r)" % (msg, fetch_config.build_type)
            )
        self.fetch_config = fetch_config

        if not user_defined_bits and \
                options.bits == 64 and \
                mozinfo.os == 'win' and \
                32 in fetch_config.available_bits():
            # inform users on windows that we are using 64 bit builds.
            self.logger.info("bits option not specified, using 64-bit builds.")

        if options.bits == 32 and mozinfo.os == 'mac':
            self.logger.info("only 64-bit builds available for mac, using "
                             "64-bit builds")

        if fetch_config.is_inbound():
            # this can be useful for both inbound and nightly, because we
            # can go to inbound from nightly.
            fetch_config.set_inbound_branch(options.inbound_branch)

            if fetch_config.tk_needs_auth():
                # re-read configuration to get taskcluster options
                # TODO: address this to avoid re-reading the conf file
                defaults = get_defaults(DEFAULT_CONF_FNAME)
                client_id = defaults.get('taskcluster-clientid')
                access_token = defaults.get('taskcluster-accesstoken')
                if not (client_id and access_token):
                    raise MozRegressionError(
                        "taskcluster-clientid and taskcluster-accesstoken are"
                        " required in the configuration file (%s) for %s"
                        % (DEFAULT_CONF_FNAME, fetch_config.app_name)
                    )
                fetch_config.set_tk_credentials(client_id, access_token)

        # set action for just use changset or data to bisect
        if options.launch:
            try:
                options.launch = parse_date(options.launch)
                self.action = "launch_nightlies"
            except DateFormatError:
                try:
                    options.launch = parse_date(date_of_release(
                        options.launch))
                    self.action = "launch_nightlies"
                except UnavailableRelease:
                    self.action = "launch_inbound"

        elif fetch_config.is_b2g_device():
            self.action = "bisect_inbounds"
            check_taskcluster(options, fetch_config, self.logger)
        elif options.first_bad_revision or options.last_good_revision:
            # bisect inbound if last good revision or first bad revision are
            # set
            self.action = "bisect_inbounds"
            check_inbounds(options, fetch_config, self.logger)
        else:
            self.action = "bisect_nightlies"
            check_nightlies(options, fetch_config, self.logger)

        options.preferences = preferences(options.prefs_files, options.prefs)
        # convert GiB to bytes.
        options.persist_size_limit = \
            int(abs(float(options.persist_size_limit)) * 1073741824)