Skip to content

Commit 5ba45a0

Browse files
committed
up
2 parents 2240802 + 29b952e commit 5ba45a0

33 files changed

+427
-263
lines changed

pom.xml

+6-22
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
<project xmlns="http://maven.apache.org/POM/4.0.0"
2-
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3-
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
1+
<project xmlns="https://maven.apache.org/POM/4.0.0"
2+
xmlns:xsi="https://www.w3.org/2001/XMLSchema-instance"
3+
xsi:schemaLocation="https://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
44
<modelVersion>4.0.0</modelVersion>
55
<groupId>org.inria.sacha.automaticRepair</groupId>
66
<artifactId>astor</artifactId>
@@ -48,7 +48,7 @@
4848
<dependency>
4949
<groupId>com.github.spoonlabs</groupId>
5050
<artifactId>flacoco</artifactId>
51-
<version>1.0.5</version>
51+
<version>1.0.6</version>
5252
</dependency>
5353

5454
<dependency>
@@ -166,26 +166,16 @@
166166
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
167167
<snapshots />
168168
</repository>
169-
<repository>
170-
<id>inria</id>
171-
<url>http://spoon.gforge.inria.fr/repositories/releases/</url>
172-
</repository>
173-
<repository>
174-
<id>spoon-snapshot</id>
175-
<name>maven repository for spoon snapshots</name>
176-
<url>https://repository.ow2.org/nexus/content/repositories/snapshots/</url>
177-
<snapshots />
178-
</repository>
179169
<repository>
180170
<id>EvoSuite</id>
181171
<name>EvoSuite Repository</name>
182-
<url>http://www.evosuite.org/m2</url>
172+
<url>https://www.evosuite.org/m2</url>
183173
</repository>
184174

185175
<repository>
186176
<id>sachaproject.gforge.inria.fr-release</id>
187177
<name>Maven Repository for Spoon Release</name>
188-
<url>http://sachaproject.gforge.inria.fr/repositories/releases/</url>
178+
<url>https://sachaproject.gforge.inria.fr/repositories/releases/</url>
189179
<snapshots />
190180
</repository>
191181

@@ -195,12 +185,6 @@
195185
<url>https://tdurieux.github.io/maven-repository/snapshots/</url>
196186
</repository>
197187

198-
<repository>
199-
<id>maven.inria.fr-snapshot</id>
200-
<name>Maven Repository for Spoon Artifac Snapshot</name>
201-
<url>http://maven.inria.fr/artifactory/spoon-public-snapshot/</url>
202-
<snapshots />
203-
</repository>
204188
</repositories>
205189

206190
<build>

src/main/java/fr/inria/astor/approaches/extensions/minimpact/validator/ProcessEvoSuiteValidator.java

+17-11
Original file line numberDiff line numberDiff line change
@@ -98,9 +98,12 @@ public TestCaseVariantValidationResult runTestFromEvoSuite(ProgramVariant curren
9898
// Set up dirs
9999
String classpathForCompile = "";
100100
classpathForCompile = projectFacade.getProperties().getDependenciesString() + File.pathSeparator
101-
+ projectFacade.getOutDirWithPrefix(currentVariant.currentMutatorIdentifier()) + File.pathSeparator//
101+
+ new File(projectFacade.getOutDirWithPrefix(currentVariant.currentMutatorIdentifier()))
102+
.getAbsolutePath()
103+
+ File.pathSeparator//
102104
+ new File(ConfigurationProperties.getProperty("evosuitejar")).getAbsolutePath() + File.pathSeparator
103-
+ projectFacade.getOutDirWithPrefix(currentVariant.DEFAULT_ORIGINAL_VARIANT);
105+
+ new File(projectFacade.getOutDirWithPrefix(currentVariant.DEFAULT_ORIGINAL_VARIANT))
106+
.getAbsolutePath();
104107

105108
String outPutTest = projectFacade.getOutDirWithPrefix("/evosuite/evosuite-tests/" + sufix);
106109

@@ -129,8 +132,8 @@ public TestCaseVariantValidationResult runTestFromEvoSuite(ProgramVariant curren
129132
List<String> pathTestGenerated = new ArrayList<String>();
130133

131134
log.debug("Generating test for the first time");
132-
boolean executed = fev.runEvosuite(currentVariant, classesToGenerateTests, projectFacade, testEScodepath,
133-
runOverOriginal);
135+
boolean executed = fev.runEvosuite(currentVariant, classesToGenerateTests, projectFacade,
136+
esPath.getAbsolutePath(), runOverOriginal);
134137

135138
// we collect the files generated
136139

@@ -145,7 +148,7 @@ public TestCaseVariantValidationResult runTestFromEvoSuite(ProgramVariant curren
145148
// Collect test generated from files generated by ES
146149
for (String f : pathTestGenerated) {
147150
String qualifiedTestName = f.replace(".java", "").replace(esPath.toString(), "")
148-
.replace("/evosuite-tests/", "").replace(File.separator, ".");
151+
.replace(File.separator,".").replace(".evosuite-tests.", "");
149152
if (!qualifiedTestName.endsWith(EvoSuiteFacade.EVOSUITE_scaffolding_SUFFIX) && classesToGenerateTests
150153
.contains(qualifiedTestName.replace(EvoSuiteFacade.EVOSUITE_SUFFIX, ""))) {
151154
testGenerated.add(qualifiedTestName);
@@ -165,18 +168,21 @@ public TestCaseVariantValidationResult runTestFromEvoSuite(ProgramVariant curren
165168

166169
// WE COMPILE EVO TEST
167170
log.info("Classpath " + classpathForCompile);
168-
171+
String envOS = System.getProperty("os.name");
169172
String javaPath = ConfigurationProperties.getProperty("jvm4evosuitetestexecution");
170173
List<String> command = new ArrayList<String>();
171-
command.add(javaPath + File.separator + "javac");
174+
if (!envOS.contains("Windows"))
175+
command.add(javaPath + File.separator + "javac");
176+
else
177+
command.add("\"" + javaPath + File.separator + "javac" + "\"");
172178
command.add("-classpath");
173179
command.add(classpathForCompile);
174180
command.add("-d");
175181

176182
//// Save compiled
177183
File fout = new File(outPutTest);
178184
fout.mkdirs();
179-
command.add(outPutTest);
185+
command.add(fout.getAbsolutePath());
180186

181187
// Adding the files
182188
for (String testPath : pathTestGenerated) {
@@ -189,8 +195,8 @@ public TestCaseVariantValidationResult runTestFromEvoSuite(ProgramVariant curren
189195
log.debug("Any test to generate, all test cases were generated before: " + testAlreadyGenerated);
190196
}
191197

192-
String classpathForRunTest = classpathForCompile + (File.pathSeparator) + outPutTest + File.pathSeparator
193-
+ System.getProperty("java.class.path");
198+
String classpathForRunTest = classpathForCompile + (File.pathSeparator) + new File(outPutTest).getAbsolutePath()
199+
+ File.pathSeparator + System.getProperty("java.class.path");
194200
log.info("Process classpath " + classpathForRunTest);
195201

196202
ProcessEvoSuiteValidator evoProcess = new ProcessEvoSuiteValidator();
@@ -231,4 +237,4 @@ public TestCasesProgramValidationResult executeRegressionTesting(URL[] processCl
231237
}
232238
}
233239

234-
}
240+
}

src/main/java/fr/inria/astor/core/setup/ProjectRepairFacade.java

+18-6
Original file line numberDiff line numberDiff line change
@@ -80,24 +80,36 @@ public void copyOriginalSourceCode(String pathOriginalCode, String currentMutato
8080
*/
8181
public void cleanMutationResultDirectories(String currentMutatorIdentifier) throws IOException {
8282

83-
removeDir(getProperties().getWorkingDirForSource() + File.separator + currentMutatorIdentifier);
84-
removeDir(getProperties().getWorkingDirForBytecode() + File.separator + currentMutatorIdentifier);
83+
removeDir(getProperties().getWorkingDirForSource() + File.separator + currentMutatorIdentifier, false);
84+
removeDir(getProperties().getWorkingDirForBytecode() + File.separator + currentMutatorIdentifier, false);
85+
}
86+
87+
/**
88+
* Remove source dir for a given mutation
89+
*
90+
* @throws IOException
91+
*/
92+
public void cleanMutationResultSourceDirectory(String currentMutatorIdentifier) throws IOException {
93+
94+
removeDir(getProperties().getWorkingDirForSource() + File.separator + currentMutatorIdentifier, false);
8595
}
8696

8797
public void cleanMutationResultDirectories() throws IOException {
8898

89-
removeDir(getProperties().getWorkingDirForSource());
90-
removeDir(getProperties().getWorkingDirForBytecode());
99+
removeDir(getProperties().getWorkingDirForSource(), true);
100+
removeDir(getProperties().getWorkingDirForBytecode(), true);
91101
}
92102

93-
private void removeDir(String dir) throws IOException {
103+
private void removeDir(String dir, boolean isFolderToBeRecreated) throws IOException {
94104
File dirin = new File(dir);
95105
try {
96106
FileUtils.deleteDirectory(dirin);
97107
} catch (Exception ex) {
98108
logger.error("ex: " + ex.getMessage());
99109
}
100-
dirin.mkdir();
110+
if (isFolderToBeRecreated) {
111+
dirin.mkdir();
112+
}
101113
}
102114

103115
public boolean copyOriginalBin(List<String> inDirs, String mutatorIdentifier) throws IOException {

src/main/java/fr/inria/astor/core/solutionsearch/AstorCoreEngine.java

+7
Original file line numberDiff line numberDiff line change
@@ -251,6 +251,10 @@ public ExecutionResult atEnd() {
251251
fw.close();
252252
}
253253
}
254+
if (!ConfigurationProperties.getPropertyBool("saveall")) {
255+
projectFacade.cleanMutationResultDirectories(ProgramVariant.DEFAULT_ORIGINAL_VARIANT);
256+
projectFacade.cleanMutationResultDirectories(ProgramVariant.DEFAULT_ORIGINAL_VARIANT + PatchDiffCalculator.DIFF_SUFFIX);
257+
}
254258
} catch (Exception e1) {
255259
e1.printStackTrace();
256260
}
@@ -563,6 +567,9 @@ public boolean processCreatedVariant(ProgramVariant programVariant, int generati
563567
saveVariant(programVariant);
564568

565569
return true;
570+
} else if (!ConfigurationProperties.getPropertyBool("saveall")) {
571+
projectFacade.cleanMutationResultDirectories(
572+
ConfigurationProperties.getProperty("pvariantfoldername") + programVariant.getId());
566573
}
567574
} else {
568575
log.debug("-The child does NOT compile: " + programVariant.getId() + ", errors: "

0 commit comments

Comments
 (0)