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) if options.arch is not None: if options.app != "gve": self.logger.warning("--arch ignored for non-GVE app.") options.arch = None fetch_config = create_config(options.app, mozinfo.os, options.bits, mozinfo.processor, options.arch) if options.lang: if options.app != "firefox-l10n": raise MozRegressionError( "--lang is only valid with --app=firefox-l10n") fetch_config.set_lang(options.lang) elif options.app == "firefox-l10n": raise MozRegressionError( "app 'firefox-l10n' requires a --lang argument") if options.build_type: 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 fetch_config.set_repo(options.repo) fetch_config.set_base_url(options.archive_base_url) 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_integration() and fetch_config.tk_needs_auth(): creds = tc_authenticate(self.logger) fetch_config.set_tk_credentials(creds) # set action for just use changset or data to bisect if options.launch: options.launch = self._convert_to_bisect_arg(options.launch) self.action = "launch_integration" if is_date_or_datetime( options.launch) and fetch_config.should_use_archive(): self.action = "launch_nightlies" else: # define good/bad default values if required default_good_date, default_bad_date = get_default_date_range( fetch_config) if options.find_fix: default_bad_date, default_good_date = ( default_good_date, default_bad_date, ) if not options.bad: options.bad = default_bad_date self.logger.info("No 'bad' option specified, using %s" % options.bad) else: options.bad = self._convert_to_bisect_arg(options.bad) if not options.good: options.good = default_good_date self.logger.info("No 'good' option specified, using %s" % options.good) else: options.good = self._convert_to_bisect_arg(options.good) self.action = "bisect_integration" if is_date_or_datetime(options.good) and is_date_or_datetime( options.bad): if not options.find_fix and to_datetime( options.good) > to_datetime(options.bad): raise MozRegressionError( ("Good date %s is later than bad date %s." " Maybe you wanted to use the --find-fix" " flag?") % (options.good, options.bad)) elif options.find_fix and to_datetime( options.good) < to_datetime(options.bad): raise MozRegressionError( ("Bad date %s is later than good date %s." " You should not use the --find-fix flag" " in this case...") % (options.bad, options.good)) if fetch_config.should_use_archive(): self.action = "bisect_nightlies" if (self.action in ("launch_integration", "bisect_integration") and not fetch_config.is_integration()): raise MozRegressionError("Unable to bisect integration for `%s`" % fetch_config.app_name) options.preferences = preferences(options.prefs_files, options.prefs, self.logger) # convert GiB to bytes. options.persist_size_limit = int( abs(float(options.persist_size_limit)) * 1073741824)
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 fetch_config.set_repo(options.repo) if fetch_config.is_nightly(): fetch_config.set_base_url(options.archive_base_url) 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() and fetch_config.tk_needs_auth(): creds = tc_authenticate(self.logger) fetch_config.set_tk_credentials(creds) # set action for just use changset or data to bisect if options.launch: options.launch = self._convert_to_bisect_arg(options.launch) self.action = "launch_inbound" if is_date_or_datetime(options.launch) and \ not fetch_config.should_use_taskcluster(): self.action = "launch_nightlies" else: # define good/bad default values if required default_good_date, default_bad_date = \ get_default_date_range(fetch_config) if options.find_fix: default_bad_date, default_good_date = \ default_good_date, default_bad_date if not options.bad: options.bad = default_bad_date self.logger.info("No 'bad' option specified, using %s" % options.bad) else: options.bad = self._convert_to_bisect_arg(options.bad) if not options.good: options.good = default_good_date self.logger.info("No 'good' option specified, using %s" % options.good) else: options.good = self._convert_to_bisect_arg(options.good) self.action = "bisect_inbounds" if is_date_or_datetime(options.good) and \ is_date_or_datetime(options.bad): if not options.find_fix and \ to_datetime(options.good) > to_datetime(options.bad): raise MozRegressionError( ("Good date %s is later than bad date %s." " Maybe you wanted to use the --find-fix" " flag?") % (options.good, options.bad)) elif options.find_fix and \ to_datetime(options.good) < to_datetime(options.bad): raise MozRegressionError( ("Bad date %s is later than good date %s." " You should not use the --find-fix flag" " in this case...") % (options.bad, options.good)) if not fetch_config.should_use_taskcluster(): self.action = "bisect_nightlies" if self.action in ('launch_inbound', 'bisect_inbounds')\ and not fetch_config.is_inbound(): raise MozRegressionError('Unable to bisect inbound for `%s`' % fetch_config.app_name) options.preferences = preferences(options.prefs_files, options.prefs) # convert GiB to bytes. options.persist_size_limit = \ int(abs(float(options.persist_size_limit)) * 1073741824)
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, mozinfo.processor) if options.build_type: 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 fetch_config.set_repo(options.repo) if fetch_config.is_nightly(): fetch_config.set_base_url(options.archive_base_url) 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() and fetch_config.tk_needs_auth(): creds = tc_authenticate(self.logger) fetch_config.set_tk_credentials(creds) # set action for just use changset or data to bisect if options.launch: options.launch = self._convert_to_bisect_arg(options.launch) self.action = "launch_inbound" if is_date_or_datetime(options.launch) and \ not fetch_config.should_use_taskcluster(): self.action = "launch_nightlies" else: # define good/bad default values if required default_good_date, default_bad_date = \ get_default_date_range(fetch_config) if options.find_fix: default_bad_date, default_good_date = \ default_good_date, default_bad_date if not options.bad: options.bad = default_bad_date self.logger.info("No 'bad' option specified, using %s" % options.bad) else: options.bad = self._convert_to_bisect_arg(options.bad) if not options.good: options.good = default_good_date self.logger.info("No 'good' option specified, using %s" % options.good) else: options.good = self._convert_to_bisect_arg(options.good) self.action = "bisect_inbounds" if is_date_or_datetime(options.good) and \ is_date_or_datetime(options.bad): if not options.find_fix and \ to_datetime(options.good) > to_datetime(options.bad): raise MozRegressionError( ("Good date %s is later than bad date %s." " Maybe you wanted to use the --find-fix" " flag?") % (options.good, options.bad)) elif options.find_fix and \ to_datetime(options.good) < to_datetime(options.bad): raise MozRegressionError( ("Bad date %s is later than good date %s." " You should not use the --find-fix flag" " in this case...") % (options.bad, options.good)) if not fetch_config.should_use_taskcluster(): self.action = "bisect_nightlies" if self.action in ('launch_inbound', 'bisect_inbounds')\ and not fetch_config.is_inbound(): raise MozRegressionError('Unable to bisect inbound for `%s`' % fetch_config.app_name) options.preferences = preferences(options.prefs_files, options.prefs, self.logger) # convert GiB to bytes. options.persist_size_limit = \ int(abs(float(options.persist_size_limit)) * 1073741824)