Search in sources :

Example 1 with RunCommandWriter

use of de.dagere.peass.measurement.utils.RunCommandWriter in project peass by DaGeRe.

the class ExperimentSelector method selectForProject.

private void selectForProject(final File currentPropertyFile, final File currentChangeFile) throws IOException, JsonParseException, JsonMappingException, FileNotFoundException {
    final RepoFolders repoFolders = new RepoFolders();
    final VersionChangeProperties properties = Constants.OBJECTMAPPER.readValue(currentPropertyFile, VersionChangeProperties.class);
    final ProjectChanges changes;
    if (currentChangeFile != null && currentChangeFile.exists()) {
        changes = Constants.OBJECTMAPPER.readValue(currentChangeFile, ProjectChanges.class);
    } else {
        changes = null;
    }
    final String projectName = currentChangeFile != null ? currentChangeFile.getName().replace(".json", "") : currentPropertyFile.getParentFile().getName();
    final File fileSlurm = new File(repoFolders.getRCAScriptFolder(), "rca-slurm-" + projectName + ".sh");
    final File fileJava = new File(repoFolders.getRCAScriptFolder(), "rca-java-" + projectName + ".sh");
    final ExecutionData executionData = repoFolders.getExecutionData(projectName);
    final RunCommandWriter writerSlurm = new RunCommandWriterSlurm(new PrintStream(fileSlurm), "cause1", executionData, RunCommandWriterSlurm.EXECUTE_RCA);
    final RunCommandWriter writer = new RunCommandWriterRCA(new PrintStream(fileJava), "cause1", executionData);
    properties.executeProcessor((version, testcase, change, changeProperties) -> {
        all++;
    });
    if (changes != null) {
        changes.executeProcessor((version, testcase, change) -> {
            measurementAll++;
        });
    } else {
        printOnlyChanged = false;
    }
    writeExecutions(properties, changes, writerSlurm, writer);
    System.out.println("All: " + executionData.getAllExecutions());
    System.out.println("All: " + all + " No testchange: " + noTestchange + " Measurement change: " + measurementChange + " All: " + measurementAll);
}
Also used : PrintStream(java.io.PrintStream) ProjectChanges(de.dagere.peass.analysis.changes.ProjectChanges) RunCommandWriterSlurm(de.dagere.peass.measurement.utils.RunCommandWriterSlurm) RunCommandWriterRCA(de.dagere.peass.measurement.utils.RunCommandWriterRCA) VersionChangeProperties(de.dagere.peass.analysis.properties.VersionChangeProperties) RunCommandWriter(de.dagere.peass.measurement.utils.RunCommandWriter) File(java.io.File) RepoFolders(de.dagere.peass.analysis.all.RepoFolders) ExecutionData(de.dagere.peass.dependency.persistence.ExecutionData)

Example 2 with RunCommandWriter

use of de.dagere.peass.measurement.utils.RunCommandWriter in project peass by DaGeRe.

the class FindWrong method main.

public static void main(final String[] args) throws JsonParseException, JsonMappingException, IOException {
    final File executeCommands = new File("execute-wrong.sh");
    final PrintStream goal = new PrintStream(new FileOutputStream(executeCommands));
    final File folder = new File("/home/reichelt/daten3/diss/repos/properties/classification");
    int index = 0;
    for (final File project : folder.listFiles()) {
        if (project.getName().endsWith(".json")) {
            final String projectName = project.getName().substring(0, project.getName().indexOf('.'));
            final String url = Constants.defaultUrls.get(projectName);
            RunCommandWriter writer = new RunCommandWriterSlurm(goal, "wrong_rerun", projectName, url);
            if (url != null) {
                final Classification data = Constants.OBJECTMAPPER.readValue(project, Classification.class);
                for (final Map.Entry<String, VersionClass> version : data.getVersions().entrySet()) {
                    for (final Map.Entry<ChangedEntity, TestcaseClass> method : version.getValue().getTestcases().entrySet()) {
                        if (method.getValue().getTypes().contains("WRONG") || method.getValue().getTypes().contains("WRONGTEST")) {
                            // System.out.println(version.getKey() + " " + method.getKey());
                            writer.createSingleMethodCommand(index, version.getKey(), method.getKey().toString());
                            index++;
                        }
                    }
                }
            } else {
                System.err.println("Missing url: " + projectName);
            }
        }
    }
}
Also used : PrintStream(java.io.PrintStream) VersionClass(de.dagere.peass.analysis.groups.VersionClass) RunCommandWriterSlurm(de.dagere.peass.measurement.utils.RunCommandWriterSlurm) ChangedEntity(de.dagere.peass.dependency.analysis.data.ChangedEntity) FileOutputStream(java.io.FileOutputStream) Classification(de.dagere.peass.analysis.groups.Classification) RunCommandWriter(de.dagere.peass.measurement.utils.RunCommandWriter) File(java.io.File) Map(java.util.Map) TestcaseClass(de.dagere.peass.analysis.groups.TestcaseClass)

Example 3 with RunCommandWriter

use of de.dagere.peass.measurement.utils.RunCommandWriter in project peass by DaGeRe.

the class FindChangeExecutions method findProjectExecutions.

public static void findProjectExecutions(final File reexecuteFolder, final String project, final File projectChangeFile, final File executionFile) throws FileNotFoundException, JAXBException, IOException, JsonParseException, JsonMappingException {
    System.out.println("Reading: " + project);
    final File reexecuteProject = new File(reexecuteFolder, "reexecute-change-" + project + ".sh");
    final PrintStream goal = new PrintStream(new FileOutputStream(reexecuteProject));
    final ExecutionData executions = Constants.OBJECTMAPPER.readValue(executionFile, ExecutionData.class);
    // RunCommandWriter writer = new RunCommandWriterSlurm(goal, NAME, dependencies);
    final RunCommandWriter writer = new RunCommandWriterRCA(goal, NAME, executions);
    writer.setNice(1000);
    writeExecutions(projectChangeFile, executions, writer);
}
Also used : PrintStream(java.io.PrintStream) FileOutputStream(java.io.FileOutputStream) RunCommandWriterRCA(de.dagere.peass.measurement.utils.RunCommandWriterRCA) RunCommandWriter(de.dagere.peass.measurement.utils.RunCommandWriter) File(java.io.File) ExecutionData(de.dagere.peass.dependency.persistence.ExecutionData)

Aggregations

RunCommandWriter (de.dagere.peass.measurement.utils.RunCommandWriter)3 File (java.io.File)3 PrintStream (java.io.PrintStream)3 ExecutionData (de.dagere.peass.dependency.persistence.ExecutionData)2 RunCommandWriterRCA (de.dagere.peass.measurement.utils.RunCommandWriterRCA)2 RunCommandWriterSlurm (de.dagere.peass.measurement.utils.RunCommandWriterSlurm)2 FileOutputStream (java.io.FileOutputStream)2 RepoFolders (de.dagere.peass.analysis.all.RepoFolders)1 ProjectChanges (de.dagere.peass.analysis.changes.ProjectChanges)1 Classification (de.dagere.peass.analysis.groups.Classification)1 TestcaseClass (de.dagere.peass.analysis.groups.TestcaseClass)1 VersionClass (de.dagere.peass.analysis.groups.VersionClass)1 VersionChangeProperties (de.dagere.peass.analysis.properties.VersionChangeProperties)1 ChangedEntity (de.dagere.peass.dependency.analysis.data.ChangedEntity)1 Map (java.util.Map)1