def analyze(self) -> actions.StepResult: """This step performs the actual analysis with the correct flags.""" project = self.obj # Define the output directory. vara_result_folder = get_varats_result_folder(project) for binary in project.binaries: # Define empty success file result_file = create_new_success_result_filename( self.__experiment_handle, FAR, project, binary) # Combine the input bitcode file's name bc_target_file = get_cached_bc_file_path(project, binary, self.__bc_file_extensions) opt_params = [ "-vara-PFA", "-S", "-vara-FAR", f"-vara-report-outfile={vara_result_folder}/{result_file}", str(bc_target_file), ] run_cmd = opt[opt_params] run_cmd = wrap_unlimit_stack_size(run_cmd) # Run the command with custom error handler and timeout exec_func_with_pe_error_handler( run_cmd, create_default_analysis_failure_handler( self.__experiment_handle, project, FAR, Path(vara_result_folder)))
def analyze(self) -> actions.StepResult: """Run phasar's IDELinearConstantAnalysis analysis.""" if not self.obj: return actions.StepResult.ERROR 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. varats_result_folder = get_varats_result_folder(project) phasar = local["phasar-llvm"] for binary in project.binaries: bc_file = get_cached_bc_file_path(project, binary) result_file = create_new_success_result_filename( self.__experiment_handle, EmptyReport, project, binary ) phasar_params = ["-m", bc_file, "-C", "CHA", "-D", "ide-lca"] run_cmd = wrap_unlimit_stack_size(phasar[phasar_params]) run_cmd = (run_cmd > f'{varats_result_folder}/{result_file}') exec_func_with_pe_error_handler( run_cmd, create_default_analysis_failure_handler( self.__experiment_handle, project, EmptyReport, Path(varats_result_folder) ) ) return actions.StepResult.OK
def analyze(self) -> actions.StepResult: """Run VaRA-IPP utility pass and extract instrumentation point information.""" project = self.obj vara_result_folder = get_varats_result_folder(project) for binary in project.binaries: result_file = create_new_success_result_filename( self.__experiment_handle, VaraIPPReport, project, binary) # Need the following passes: # - vara-PFTDD to generate feature regions # - vara-IPP (Instrumentation Point Printer) opt_params = [ "--vara-PTFDD", "-vara-IPP", "-o", "/dev/null", get_cached_bc_file_path( project, binary, [BCFileExtensions.DEBUG, BCFileExtensions.FEATURE]) ] # Store the collected information in report. run_cmd = opt[opt_params] > str( vara_result_folder / str(result_file)) exec_func_with_pe_error_handler( run_cmd, create_default_analysis_failure_handler( self.__experiment_handle, project, VaraIPPReport, Path(vara_result_folder))) return actions.StepResult.OK
def analyze(self) -> actions.StepResult: """ This step performs the actual analysis with the correct flags. Flags: -vara-CR: to run a commit flow report -vara-report-outfile=<path>: specify the path to store the results """ if not self.obj: return actions.StepResult.ERROR project = self.obj if self.__interaction_filter_experiment_name is None: interaction_filter_file = Path( self.INTERACTION_FILTER_TEMPLATE.format( experiment="CommitReportExperiment", project=str(project.name))) else: interaction_filter_file = Path( self.INTERACTION_FILTER_TEMPLATE.format( experiment=self.__interaction_filter_experiment_name, project=str(project.name))) if not interaction_filter_file.is_file(): raise Exception("Could not load interaction filter file \"" + str(interaction_filter_file) + "\"") # 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 = get_varats_result_folder(project) for binary in project.binaries: result_file = create_new_success_result_filename( self.__experiment_handle, CR, project, binary) opt_params = [ "-vara-BD", "-vara-CR", "-vara-init-commits", f"-vara-report-outfile={vara_result_folder}/{result_file}" ] if interaction_filter_file.is_file(): opt_params.append(f"-vara-cf-interaction-filter=" f"{str(interaction_filter_file)}") opt_params.append(str(get_cached_bc_file_path(project, binary))) run_cmd = opt[opt_params] timeout_duration = '8h' from benchbuild.utils.cmd import timeout # pylint: disable=C0415 exec_func_with_pe_error_handler( timeout[timeout_duration, run_cmd], create_default_analysis_failure_handler( self.__experiment_handle, project, CR, Path(vara_result_folder), timeout_duration=timeout_duration)) return actions.StepResult.OK
def analyze(self) -> actions.StepResult: """ This step performs the actual analysis with the correct command line flags. Flags used: * -vara-BD: activates Blame Detection * -vara-init-commits: let's the Blame Detection initialize Commits for Repos * -vara-verify-blameMD: activate BlameMDVerifier * -vara-verifier-options=: chooses between multiple print options * Status: prints if the module as a whole passed or failed """ if not self.obj: return actions.StepResult.ERROR 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 = get_varats_result_folder(project) timeout_duration = '8h' for binary in project.binaries: bc_target_file = get_cached_bc_file_path(project, binary, self.bc_file_extensions) # Define empty success file. result_file = create_new_success_result_filename( self.__experiment_handle, self.__experiment_handle.report_spec().main_report, project, binary) # Define output file name of failed runs error_file = create_new_failed_result_filename( self.__experiment_handle, self.__experiment_handle.report_spec().main_report, project, binary) # Put together the path to the bc file and the opt command of vara vara_run_cmd = opt["-vara-BD", "-vara-init-commits", "-vara-verify-blameMD", "-vara-verifier-options=All", str(bc_target_file), "-o", "/dev/null"] exec_func_with_pe_error_handler( timeout[timeout_duration, vara_run_cmd] > f"{vara_result_folder}/{result_file}", PEErrorHandler(vara_result_folder, error_file.filename, timeout_duration)) return actions.StepResult.OK
def analyze(self) -> actions.StepResult: """ This step performs the actual analysis with the correct command line flags. Flags used: * -vara-BR: to run a commit flow report * -yaml-report-outfile=<path>: specify the path to store the results """ if not self.obj: return actions.StepResult.ERROR 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 = get_varats_result_folder(project) for binary in project.binaries: result_file = create_new_success_result_filename( self.__experiment_handle, BR, project, binary ) opt_params = [ "-vara-BD", "-vara-BR", "-vara-init-commits", "-vara-use-phasar", f"-vara-blame-taint-scope={self.__blame_taint_scope.name}", f"-vara-report-outfile={vara_result_folder}/{result_file}", get_cached_bc_file_path( project, binary, [ BCFileExtensions.NO_OPT, BCFileExtensions.TBAA, BCFileExtensions.BLAME ] ) ] run_cmd = opt[opt_params] run_cmd = wrap_unlimit_stack_size(run_cmd) exec_func_with_pe_error_handler( run_cmd, create_default_analysis_failure_handler( self.__experiment_handle, project, BR, Path(vara_result_folder) ) ) return actions.StepResult.OK
def analyze(self) -> actions.StepResult: """This step performs the actual comparision, running the analysis with and without phasars global support.""" if not self.obj: return actions.StepResult.ERROR 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 = get_varats_result_folder(project) for binary in project.binaries: if self.__globals_active: report_type: tp.Union[ tp.Type[GlobalsReportWith], tp.Type[GlobalsReportWithout]] = GlobalsReportWith else: report_type = GlobalsReportWithout result_file = create_new_success_result_filename( self.__experiment_handle, report_type, project, binary ) phasar_params = [ f"--auto-globals={'ON' if self.__globals_active else 'OFF'}", "-m", get_cached_bc_file_path( project, binary, [BCFileExtensions.NO_OPT, BCFileExtensions.TBAA] ), "-o", f"{vara_result_folder}/{result_file}" ] run_cmd = phasar_globals[phasar_params] run_cmd = wrap_unlimit_stack_size(run_cmd) exec_func_with_pe_error_handler( run_cmd, create_default_analysis_failure_handler( self.__experiment_handle, project, report_type, Path(vara_result_folder) ) ) return actions.StepResult.OK
def analyze(self) -> actions.StepResult: """Only create a report file.""" if not self.obj: return actions.StepResult.ERROR project = self.obj vara_result_folder = get_varats_result_folder(project) for binary in project.binaries: result_file = create_new_success_result_filename( self.__experiment_handle, EmptyReport, project, binary) run_cmd = touch[f"{vara_result_folder}/{result_file}"] exec_func_with_pe_error_handler( run_cmd, create_default_analysis_failure_handler( self.__experiment_handle, project, EmptyReport, Path(vara_result_folder))) return actions.StepResult.OK
def run_szz(self) -> actions.StepResult: """Prepare data needed for running SZZUnleashed.""" project: Project = self.obj run_dir = Path(project.source_of_primary).parent szzunleashed_jar = SZZUnleashed.install_location( ) / SZZUnleashed.get_jar_name() varats_result_folder = get_varats_result_folder(project) with local.cwd(run_dir): run_cmd = java["-jar", str(szzunleashed_jar), "-d", "1", "-i", str(run_dir / "issue_list.json"), "-r", project.source_of_primary] exec_func_with_pe_error_handler( run_cmd, create_default_analysis_failure_handler( self.__experiment_handle, project, SZZUnleashedReport, Path(varats_result_folder))) return actions.StepResult.OK