def autotry(self, **kwargs): """Autotry is in beta, please file bugs blocking 1149670. Push the current tree to try, with the specified syntax. Build options, platforms and regression tests may be selected using the usual try options (-b, -p and -u respectively). In addition, tests in a given directory may be automatically selected by passing that directory as a positional argument to the command. For example: mach try -b d -p linux64 dom testing/web-platform/tests/dom would schedule a try run for linux64 debug consisting of all tests under dom/ and testing/web-platform/tests/dom. Test selection using positional arguments is available for mochitests, reftests, xpcshell tests and web-platform-tests. Tests may be also filtered by passing --tag to the command, which will run only tests marked as having the specified tags e.g. mach try -b d -p win64 --tag media would run all tests tagged 'media' on Windows 64. If both positional arguments or tags and -u are supplied, the suites in -u will be run in full. Where tests are selected by positional argument they will be run in a single chunk. If no build option is selected, both debug and opt will be scheduled. If no platform is selected a default is taken from the AUTOTRY_PLATFORM_HINT environment variable, if set. The command requires either its own mercurial extension ("push-to-try", installable from mach mercurial-setup) or a git repo using git-cinnabar (available at https://github.com/glandium/git-cinnabar). """ from mozbuild.testing import TestResolver from autotry import AutoTry resolver_func = lambda: self._spawn(TestResolver) at = AutoTry(self.topsrcdir, resolver_func, self._mach_context) if kwargs["list"]: at.list_presets() sys.exit() if kwargs["load"] is not None: defaults = at.load_config(kwargs["load"]) if defaults is None: print("No saved configuration called %s found in autotry.ini" % kwargs["load"], file=sys.stderr) for key, value in kwargs.iteritems(): if value in (None, []) and key in defaults: kwargs[key] = defaults[key] if kwargs["push"] and at.find_uncommited_changes(): print('ERROR please commit changes before continuing') sys.exit(1) if not any(kwargs[item] for item in ("paths", "tests", "tags")): kwargs["paths"], kwargs["tags"] = at.find_paths_and_tags(kwargs["verbose"]) builds, platforms, tests, talos, paths, tags, extra = self.validate_args(**kwargs) if paths or tags: paths = [os.path.relpath(os.path.normpath(os.path.abspath(item)), self.topsrcdir) for item in paths] paths_by_flavor = at.paths_by_flavor(paths=paths, tags=tags) if not paths_by_flavor and not tests: print("No tests were found when attempting to resolve paths:\n\n\t%s" % paths) sys.exit(1) if not kwargs["intersection"]: paths_by_flavor = at.remove_duplicates(paths_by_flavor, tests) else: paths_by_flavor = {} try: msg = at.calc_try_syntax(platforms, tests, talos, builds, paths_by_flavor, tags, extra, kwargs["intersection"]) except ValueError as e: print(e.message) sys.exit(1) if kwargs["verbose"] and paths_by_flavor: print('The following tests will be selected: ') for flavor, paths in paths_by_flavor.iteritems(): print("%s: %s" % (flavor, ",".join(paths))) if kwargs["verbose"] or not kwargs["push"]: print('The following try syntax was calculated:\n%s' % msg) if kwargs["push"]: at.push_to_try(msg, kwargs["verbose"]) if kwargs["save"] is not None: at.save_config(kwargs["save"], msg)
def autotry(self, builds=None, platforms=None, paths=None, verbose=None, extra_tests=None, push=None, tags=None, tests=None): """mach try is under development, please file bugs blocking 1149670. Pushes the specified tests to try. The simplest way to specify tests is by using the -u argument, which will behave as usual for try syntax. This command also provides a mechanism to select test jobs and tests within a job by path based on tests present in the tree under that path. Mochitests, xpcshell tests, and reftests are eligible for selection by this mechanism. Selected tests will be run in a single chunk of the relevant suite, at this time in chunk 1. Specifying platforms is still required with the -p argument (a default is taken from the AUTOTRY_PLATFORM_HINT environment variable if set). Tests may be further filtered by passing one or more --tag to the command. If one or more --tag is specified with out paths or -u, tests with the given tags will be run in a single chunk of applicable suites. To run suites in addition to those determined from the tree, they can be passed to the --extra arguent. The command requires either its own mercurial extension ("push-to-try", installable from mach mercurial-setup) or a git repo using git-cinnabar (available at https://github.com/glandium/git-cinnabar). """ from mozbuild.testing import TestResolver from mozbuild.controller.building import BuildDriver from autotry import AutoTry import pprint print("mach try is under development, please file bugs blocking 1149670.") builds, platforms = self.validate_args(paths, tests, tags, builds, platforms) resolver = self._spawn(TestResolver) at = AutoTry(self.topsrcdir, resolver, self._mach_context) if at.find_uncommited_changes(): print('ERROR please commit changes before continuing') sys.exit(1) if paths or tags: driver = self._spawn(BuildDriver) driver.install_tests(remove=False) manifests_by_flavor = at.resolve_manifests(paths=paths, tags=tags) if not manifests_by_flavor and not tests: print("No tests were found when attempting to resolve paths:\n\n\t%s" % paths) sys.exit(1) all_manifests = set() for m in manifests_by_flavor.values(): all_manifests |= m all_manifests = list(all_manifests) msg = at.calc_try_syntax(platforms, manifests_by_flavor.keys(), tests, extra_tests, builds, all_manifests, tags) if verbose and manifests_by_flavor: print('Tests from the following manifests will be selected: ') pprint.pprint(manifests_by_flavor) if verbose: print('The following try syntax was calculated:\n\n\t%s\n' % msg) if push: at.push_to_try(msg, verbose) return
def autotry(self, builds=None, platforms=None, paths=None, verbose=None, extra_tests=None, push=None, tags=None, tests=None): """Autotry is in beta, please file bugs blocking 1149670. Pushes the specified tests to try. The simplest way to specify tests is by using the -u argument, which will behave as usual for try syntax. This command also provides a mechanism to select test jobs and tests within a job by path based on tests present in the tree under that path. Mochitests, xpcshell tests, and reftests are eligible for selection by this mechanism. Selected tests will be run in a single chunk of the relevant suite, at this time in chunk 1. Specifying platforms is still required with the -p argument (a default is taken from the AUTOTRY_PLATFORM_HINT environment variable if set). Tests may be further filtered by passing one or more --tag to the command. To run suites in addition to those determined from the tree, they can be passed to the --extra arguent. The command requires either its own mercurial extension ("push-to-try", installable from mach mercurial-setup) or a git repo using git-cinnabar (available at https://github.com/glandium/git-cinnabar). """ from mozbuild.testing import TestResolver from mozbuild.controller.building import BuildDriver from autotry import AutoTry import pprint print("mach try is under development, please file bugs blocking 1149670.") builds, platforms = self.validate_args(paths, tests, builds, platforms) resolver = self._spawn(TestResolver) at = AutoTry(self.topsrcdir, resolver, self._mach_context) if at.find_uncommited_changes(): print('ERROR please commit changes before continuing') sys.exit(1) driver = self._spawn(BuildDriver) driver.install_tests(remove=False) manifests_by_flavor = at.manifests_by_flavor(paths) if not manifests_by_flavor and not tests: print("No tests were found when attempting to resolve paths:\n\n\t%s" % paths) sys.exit(1) all_manifests = set() for m in manifests_by_flavor.values(): all_manifests |= m all_manifests = list(all_manifests) msg = at.calc_try_syntax(platforms, manifests_by_flavor.keys(), tests, extra_tests, builds, all_manifests, tags) if verbose and manifests_by_flavor: print('Tests from the following manifests will be selected: ') pprint.pprint(manifests_by_flavor) if verbose: print('The following try syntax was calculated:\n\n\t%s\n' % msg) if push: at.push_to_try(msg, verbose) return