Experiment: JustCompile


# Please take care when changing this file, see docs experiments/just_compile
class EmptyAnalysis(actions.Step):  # type: ignore
    """Empty analysis step for testing."""

    NAME = "EmptyAnslysis"
    DESCRIPTION = "Analyses nothing."

    RESULT_FOLDER_TEMPLATE = "{result_dir}/{project_dir}"

    def __init__(self, project: Project):
        super().__init__(obj=project, action_fn=self.analyze)

    def analyze(self) -> actions.StepResult:
        """Only create a report file."""
        if not self.obj:
            return
        project = self.obj

        # Add to the user-defined path for saving the results of the
        # analysis also the name and the unique id of the project of every
        # run.
        vara_result_folder = self.RESULT_FOLDER_TEMPLATE.format(
            result_dir=str(bb_cfg()["varats"]["outfile"]),
            project_dir=str(project.name)
        )

        mkdir("-p", vara_result_folder)

        for binary in project.binaries:
            result_file = EmptyReport.get_file_name(
                project_name=str(project.name),
                binary_name=binary.name,
                project_version=project.version_of_primary,
                project_uuid=str(project.run_uuid),
                extension_type=FSE.Success
            )

            run_cmd = touch["{res_folder}/{res_file}".format(
                res_folder=vara_result_folder, res_file=result_file
            )]

            exec_func_with_pe_error_handler(
                run_cmd,
                create_default_analysis_failure_handler(
                    project, EmptyReport, Path(vara_result_folder)
                )
            )


# Please take care when changing this file, see docs experiments/just_compile
class JustCompileReport(VersionExperiment):
    """Generates empty report file."""
    NAME = "JustCompile"

    REPORT_TYPE = EmptyReport

    def actions_for_project(self, project: Project) -> tp.List[actions.Step]:
        """Returns the specified steps to run the project(s) specified in the
        call in a fixed order."""

        # Add the required runtime extensions to the project(s).
        project.runtime_extension = run.RuntimeExtension(project, self) \
            << time.RunWithTime()

        # Add the required compiler extensions to the project(s).
        project.compiler_extension = compiler.RunCompiler(project, self) \
            << RunWLLVM() \
            << run.WithTimeout()

        project.compile = get_default_compile_error_wrapped(
            project, EmptyReport, EmptyAnalysis.RESULT_FOLDER_TEMPLATE
        )

        analysis_actions = []
        analysis_actions.append(actions.Compile(project))
        analysis_actions.append(EmptyAnalysis(project))
        analysis_actions.append(actions.Clean(project))

        return analysis_actions

Module: JustCompile

Implements an empty experiment that just compiles the project.

class varats.experiments.base.just_compile.EmptyAnalysis(project)[source]

Bases: benchbuild.utils.actions.Step

Empty analysis step for testing.

NAME: ClassVar[str] = 'EmptyAnslysis'
DESCRIPTION: ClassVar[str] = 'Analyses nothing.'
RESULT_FOLDER_TEMPLATE = '{result_dir}/{project_dir}'
analyze()[source]

Only create a report file.

Return type

StepResult

class varats.experiments.base.just_compile.JustCompileReport(name=NOTHING, projects=NOTHING, id=NOTHING, schema=NOTHING, container=NOTHING)[source]

Bases: varats.experiment.experiment_util.VersionExperiment

Generates empty report file.

NAME: ClassVar[str] = 'JustCompile'
REPORT_TYPE

alias of varats.data.reports.empty_report.EmptyReport

actions_for_project(project)[source]

Returns the specified steps to run the project(s) specified in the call in a fixed order.

Return type

List[Step]

name: str
projects: List[Type[benchbuild.project.Project]]
container: benchbuild.environments.domain.declarative.ContainerImage