Example #1
0
 def test_valid_release_to_date(self):
     date = date_of_release(8)
     self.assertEquals(date, "2011-08-16")
     date = date_of_release(15)
     self.assertEquals(date, "2012-06-05")
     date = date_of_release(34)
     self.assertEquals(date, "2014-09-02")
Example #2
0
 def test_valid_release_to_date(self):
     date = date_of_release(8)
     self.assertEqual(date, "2011-08-16")
     date = date_of_release(15)
     self.assertEqual(date, "2012-06-05")
     date = date_of_release(34)
     self.assertEqual(date, "2014-09-02")
     date = date_of_release('33')
     self.assertEqual(date, "2014-07-21")
Example #3
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 #4
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 #5
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 good_date > bad_date and not options.find_fix:
        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 good_date < bad_date and options.find_fix:
        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 #6
0
 def test_invalid_release_to_date(self):
     with self.assertRaises(errors.UnavailableRelease):
         date_of_release(4)
     with self.assertRaises(errors.UnavailableRelease):
         date_of_release(441)
     with self.assertRaises(errors.UnavailableRelease):
         date_of_release('ew21rtw112')
Example #7
0
 def test_invalid_release_to_date(self):
     with self.assertRaises(errors.UnavailableRelease):
         date_of_release(4)
     with self.assertRaises(errors.UnavailableRelease):
         date_of_release(441)
     with self.assertRaises(errors.UnavailableRelease):
         date_of_release('ew21rtw112')
Example #8
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 #9
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 #10
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 #11
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 #12
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 #13
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 #14
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 #15
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)