def get_build_regex(name, os, bits, psuffix='', with_ext=True): """ Returns a string regexp that can match a build filename. :param name: must be the beginning of the filename to match :param os: the os, as returned by mozinfo.os :param bits: the bits information of the build. Either 32 or 64. :param psuffix: optional suffix before the extension :param with_ext: if True, the build extension will be appended (either .zip, .tar.bz2 or .dmg depending on the os). """ if os == "win": if bits == 64: suffix, ext = r".*win64(-x86_64)?", r"\.zip" else: suffix, ext = r".*win32", r"\.zip" elif os == "linux": if bits == 64: suffix, ext = r".*linux-x86_64", r"\.tar.bz2" else: suffix, ext = r".*linux-i686", r"\.tar.bz2" elif os == "mac": suffix, ext = r".*mac.*", r"\.dmg" else: raise errors.MozRegressionError( "mozregression supports linux, mac and windows but your" " os is reported as '%s'." % os) # New taskcluster builds now just name the binary archive 'target', so # that is added as one possibility in the regex. regex = '(target|%s%s%s)' % (name, suffix, psuffix) if with_ext: return '%s%s' % (regex, ext) else: return regex
def test_handle_mozregression_errors(self): # Any MozRegressionError subclass is handled with a nice error message self.app.bisect_nightlies.side_effect = \ errors.MozRegressionError('my error') exitcode = self.do_cli([]) self.assertNotEqual(exitcode, 0) self.assertIn('my error', self.pop_exit_error_msg())
def _get_nightly_repo(self, date): if date < self.oldest_builds: raise errors.MozRegressionError( "firefox-l10n builds not available before {}".format( self.oldest_builds)) else: return "mozilla-central-l10n"
def set_build_type(self, build_type): """ Define the build type (opt, debug, asan...). :raises: MozRegressionError on error. """ if build_type in self.available_build_types(): fallbacks = self.BUILD_TYPE_FALLBACKS.get(build_type) self.build_types = (build_type, ) + fallbacks if fallbacks else ( build_type, ) return raise errors.MozRegressionError( "Unable to find a suitable build type %r." % str(build_type))
def get_build_regex(name, os, bits, processor, platprefix=r".*", platsuffix="", with_ext=True): """ Returns a string regexp that can match a build filename. :param name: must be the beginning of the filename to match :param os: the os, as returned by mozinfo.os :param bits: the bits information of the build. Either 32 or 64. :param processor: the architecture of the build. Only one that alters results is aarch64. :param platprefix: optional prefix before the platform :param platsuffix: optional suffix after the platform :param with_ext: if True, the build extension will be appended (either .zip, .tar.bz2 or .dmg depending on the os). """ if os == "win": if bits == 64: if processor == "aarch64": platform = r"win64-aarch64" else: platform = r"win64(-x86_64)?" ext = r"\.zip" else: platform, ext = r"win32", r"\.zip" elif os == "linux": if bits == 64: platform, ext = r"linux-x86_64", r"\.tar.bz2" else: platform, ext = r"linux-i686", r"\.tar.bz2" elif os == "mac": platform, ext = r"mac.*", r"\.dmg" else: raise errors.MozRegressionError( "mozregression supports linux, mac and windows but your" " os is reported as '%s'." % os) # New taskcluster builds now just name the binary archive 'target', so # that is added as one possibility in the regex. regex = "(target|%s%s%s%s)" % (name, platprefix, platform, platsuffix) if with_ext: return "%s%s" % (regex, ext) else: return regex
def set_build_type(self, build_type): """ Define the build types (opt, debug, eng, jb, asan...). *build_type* should be a comma separated list of wanted build flavors. Calling this method should store a *build_type* instance attribute suitable for taskcluster. :raises: MozRegressionError on error. """ flavors = set(_extract_build_type(build_type)) for available in self.available_build_types(): if flavors == set(available.split('-')): self.build_type = available return raise errors.MozRegressionError( "Unable to find a suitable build type %r." % str(build_type))
def test_handle_mozregression_errors(self): # Any MozRegressionError subclass is handled with a nice error message self.runner.bisect_nightlies.side_effect = \ errors.MozRegressionError('my error') exitcode = self.do_cli([]) self.assertIn('my error', exitcode)