Exemple #1
0
    def test_report(
        self,
        components,
        flavor,
        subsuite,
        paths,
        show_manifests,
        show_tests,
        show_summary,
        show_annotations,
        show_activedata,
        filter_values,
        filter_keys,
        show_components,
        output_file,
        branches,
        days,
        verbose,
    ):
        import testinfo
        from mozbuild.build_commands import Build

        try:
            self.config_environment
        except BuildEnvironmentNotFoundException:
            print("Looks like configure has not run yet, running it now...")
            builder = Build(self._mach_context, None)
            builder.configure()

        ti = testinfo.TestInfoReport(verbose)
        ti.report(
            components,
            flavor,
            subsuite,
            paths,
            show_manifests,
            show_tests,
            show_summary,
            show_annotations,
            show_activedata,
            filter_values,
            filter_keys,
            show_components,
            output_file,
            branches,
            days,
        )
Exemple #2
0
    def run(self, ide, args):
        if ide == "eclipse":
            backend = "CppEclipse"
        elif ide == "visualstudio":
            backend = "VisualStudio"
        elif ide == "vscode":
            backend = "Clangd"

        if ide == "eclipse" and not which("eclipse"):
            self.log(
                logging.ERROR,
                "ide",
                {},
                "Eclipse CDT 8.4 or later must be installed in your PATH.",
            )
            self.log(
                logging.ERROR,
                "ide",
                {},
                "Download: http://www.eclipse.org/cdt/downloads.php",
            )
            return 1

        if ide == "vscode":
            # Verify if platform has VSCode installed
            if not self.found_vscode_path():
                self.log(logging.ERROR, "ide", {},
                         "VSCode cannot be found, abording!")
                return 1

            # Create the Build environment to configure the tree
            builder = Build(self._mach_context, None)

            rc = builder.configure()
            if rc != 0:
                return rc

            # First install what we can through install manifests.
            rc = builder._run_make(directory=self.topobjdir,
                                   target="pre-export",
                                   line_handler=None)
            if rc != 0:
                return rc

            # Then build the rest of the build dependencies by running the full
            # export target, because we can't do anything better.
            for target in ("export", "pre-compile"):
                rc = builder._run_make(directory=self.topobjdir,
                                       target=target,
                                       line_handler=None)
                if rc != 0:
                    return rc
        else:
            # Here we refresh the whole build. 'build export' is sufficient here and is
            # probably more correct but it's also nice having a single target to get a fully
            # built and indexed project (gives a easy target to use before go out to lunch).
            res = self._mach_context.commands.dispatch("build",
                                                       self._mach_context)
            if res != 0:
                return 1

        # Generate or refresh the IDE backend.
        python = self.virtualenv_manager.python_path
        config_status = os.path.join(self.topobjdir, "config.status")
        args = [python, config_status, "--backend=%s" % backend]
        res = self._run_command_in_objdir(args=args,
                                          pass_thru=True,
                                          ensure_exit_code=False)
        if res != 0:
            return 1

        if ide == "eclipse":
            eclipse_workspace_dir = self.get_eclipse_workspace_path()
            subprocess.check_call(["eclipse", "-data", eclipse_workspace_dir])
        elif ide == "visualstudio":
            visual_studio_workspace_dir = self.get_visualstudio_workspace_path(
            )
            subprocess.check_call(
                ["explorer.exe", visual_studio_workspace_dir])
        elif ide == "vscode":
            return self.setup_vscode()