use of de.dagere.peass.measurement.utils.RunCommandWriterSlurm 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);
}
use of de.dagere.peass.measurement.utils.RunCommandWriterSlurm 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);
}
}
}
}
Aggregations