Exemplo n.º 1
0
    def __init__(self, *args, **kwargs):
        MozbuildObject.__init__(self, *args, **kwargs)

        # If installing tests is going to result in re-generating the build
        # backend, we need to do this here, so that the updated contents of
        # all-tests.pkl make it to the set of tests to run.
        if self.backend_out_of_date(mozpath.join(self.topobjdir,
                                                 'backend.TestManifestBackend'
                                                 )):
            print("Test configuration changed. Regenerating backend.")
            from mozbuild.gen_test_backend import gen_test_backend
            gen_test_backend()

        self._tests = TestMetadata(os.path.join(self.topobjdir,
                                                'all-tests.pkl'),
                                   self.topsrcdir,
                                   test_defaults=os.path.join(self.topobjdir,
                                                              'test-defaults.pkl'))

        self._test_rewrites = {
            'a11y': os.path.join(self.topobjdir, '_tests', 'testing',
                                 'mochitest', 'a11y'),
            'browser-chrome': os.path.join(self.topobjdir, '_tests', 'testing',
                                           'mochitest', 'browser'),
            'chrome': os.path.join(self.topobjdir, '_tests', 'testing',
                                   'mochitest', 'chrome'),
            'mochitest': os.path.join(self.topobjdir, '_tests', 'testing',
                                      'mochitest', 'tests'),
            'xpcshell': os.path.join(self.topobjdir, '_tests', 'xpcshell'),
        }
        self._vcs = None
        self.verbose = False
Exemplo n.º 2
0
    def __call__(self):
        """Loads the test metadata generated by the TestManifest build backend.

        The data is stored in two files:

            - <objdir>/all-tests.pkl
            - <objdir>/test-defaults.pkl

        The 'all-tests.pkl' file is a mapping of source path to test objects. The
        'test-defaults.pkl' file maps manifests to their DEFAULT configuration.
        These manifest defaults will be merged into the test configuration of the
        contained tests.
        """
        # If installing tests is going to result in re-generating the build
        # backend, we need to do this here, so that the updated contents of
        # all-tests.pkl make it to the set of tests to run.
        if self.backend_out_of_date(
                mozpath.join(self.topobjdir, "backend.TestManifestBackend")):
            print("Test configuration changed. Regenerating backend.")
            from mozbuild.gen_test_backend import gen_test_backend

            gen_test_backend()

        all_tests = os.path.join(self.topobjdir, "all-tests.pkl")
        test_defaults = os.path.join(self.topobjdir, "test-defaults.pkl")

        with open(all_tests, "rb") as fh:
            test_data = pickle.load(fh)

        with open(test_defaults, "rb") as fh:
            defaults = pickle.load(fh)

        # The keys in defaults use platform-specific path separators.
        # self.topsrcdir was normalized to use /, revert back to \ if needed.
        topsrcdir = os.path.normpath(self.topsrcdir)

        for path, tests in six.iteritems(test_data):
            for metadata in tests:
                defaults_manifests = [metadata["manifest"]]

                ancestor_manifest = metadata.get("ancestor_manifest")
                if ancestor_manifest:
                    # The (ancestor manifest, included manifest) tuple
                    # contains the defaults of the included manifest, so
                    # use it instead of [metadata['manifest']].
                    ancestor_manifest = os.path.join(topsrcdir,
                                                     ancestor_manifest)
                    defaults_manifests[0] = (ancestor_manifest,
                                             metadata["manifest"])
                    defaults_manifests.append(ancestor_manifest)

                for manifest in defaults_manifests:
                    manifest_defaults = defaults.get(manifest)
                    if manifest_defaults:
                        metadata = combine_fields(manifest_defaults, metadata)

                yield metadata
Exemplo n.º 3
0
    def __call__(self):
        """Loads the test metadata generated by the TestManifest build backend.

        The data is stored in two files:

            - <objdir>/all-tests.pkl
            - <objdir>/test-defaults.pkl

        The 'all-tests.pkl' file is a mapping of source path to test objects. The
        'test-defaults.pkl' file maps manifests to their DEFAULT configuration.
        These manifest defaults will be merged into the test configuration of the
        contained tests.
        """
        # If installing tests is going to result in re-generating the build
        # backend, we need to do this here, so that the updated contents of
        # all-tests.pkl make it to the set of tests to run.
        if self.backend_out_of_date(
                mozpath.join(self.topobjdir, 'backend.TestManifestBackend')):
            print("Test configuration changed. Regenerating backend.")
            from mozbuild.gen_test_backend import gen_test_backend
            gen_test_backend()

        all_tests = os.path.join(self.topobjdir, 'all-tests.pkl')
        test_defaults = os.path.join(self.topobjdir, 'test-defaults.pkl')

        with open(all_tests, 'rb') as fh:
            test_data = pickle.load(fh)

        with open(test_defaults, 'rb') as fh:
            defaults = pickle.load(fh)

        for path, tests in test_data.items():
            for metadata in tests:
                defaults_manifests = [metadata['manifest']]

                ancestor_manifest = metadata.get('ancestor-manifest')
                if ancestor_manifest:
                    # The (ancestor manifest, included manifest) tuple
                    # contains the defaults of the included manifest, so
                    # use it instead of [metadata['manifest']].
                    defaults_manifests[0] = (ancestor_manifest,
                                             metadata['manifest'])
                    defaults_manifests.append(ancestor_manifest)

                for manifest in defaults_manifests:
                    manifest_defaults = defaults.get(manifest)
                    if manifest_defaults:
                        metadata = manifestparser.combine_fields(
                            manifest_defaults, metadata)

                yield metadata