Skip to content

Commit d36f353

Browse files
authored
add Chart3 in CI (SpoonLabs#176)
1 parent cefd2d3 commit d36f353

File tree

4 files changed

+53
-17
lines changed

4 files changed

+53
-17
lines changed

.travis_defects4j.sh

-11
This file was deleted.

.travis_defects4j_1.sh

+1-2
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ mvn -q versions:set -DnewVersion=TRAVIS
55
# creating target/nopol-TRAVIS-jar-with-dependencies.jar
66
mvn -q clean package -DskipTests
77

8-
env NOPOL_EVAL_DEFECTS4J=1 mvn -q test -Dtest="Defects4jEvaluationTest"
9-
8+
env NOPOL_EVAL_DEFECTS4J=1 mvn -q test -Dtest="fr.inria.lille.repair.nopol.Defects4jEvaluationTest"
109

1110

nopol/src/test/java/fr/inria/lille/repair/nopol/Defects4jEvaluationTest.java

+14-1
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,20 @@ public void test_Lang58() throws Exception {
6161
NopolResult result = new NoPol(nopolContext).build();
6262
assertEquals(1, result.getPatches().size());
6363
}
64-
64+
65+
@Test(timeout = FIVE_MINUTES_TIMEOUT)
66+
public void test_Chart3() throws Exception {
67+
if (!testShouldBeRun()) { return; }
68+
NopolContext nopolContext = nopolConfigFor("Chart3", "");
69+
nopolContext.setLocalizer(NopolContext.NopolLocalizer.COCOSPOON);
70+
71+
// we take only the failing test case
72+
nopolContext.setProjectTests(new String[]{"org.jfree.data.time.junit.TimeSeriesTests#testCreateCopy3"});
73+
74+
NopolResult result = new NoPol(nopolContext).build();
75+
assertEquals(1, result.getPatches().size());
76+
}
77+
6578
}
6679

6780

nopol/src/test/java/fr/inria/lille/repair/nopol/Defects4jUtils.java

+38-3
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,27 @@ public static NopolContext nopolConfigFor(String bug_id) throws Exception {
3636
}
3737
public static NopolContext nopolConfigFor(String bug_id, String mvn_option) throws Exception {
3838
String folder = "unknown";
39-
if (!new File(bug_id).exists()) {
39+
40+
// for Chart, we use ant
41+
if (bug_id.startsWith("Chart") && !new File(bug_id).exists()) {
42+
// here we use maven to compile
43+
String command = "mkdir " + bug_id +";\n cd " + bug_id + ";\n git init;\n git fetch https://github.com/Spirals-Team/defects4j-repair " + bug_id + ":" + bug_id + ";\n git checkout "+bug_id+";\n"
44+
+"sed -i -e '/delete dir/ d' ant/build.xml;\n"
45+
+"ant -f ant/build.xml compile compile-tests;\n"
46+
+"echo -n `pwd`/lib/iText-2.1.4.jar:`pwd`/lib/junit.jar:`pwd`/lib/servlet.jar > cp.txt;\n"
47+
48+
49+
;
50+
System.out.println(command);
51+
Process p = Runtime.getRuntime().exec(new String[]{"sh", "-c", command});
52+
p.waitFor();
53+
String output = IOUtils.toString(p.getInputStream());
54+
String errorOutput = IOUtils.toString(p.getErrorStream());
55+
System.out.println(output);
56+
System.err.println(errorOutput);
57+
58+
} else if (!new File(bug_id).exists()) {
59+
// for the rest we use Maven
4060
String command = "mkdir " + bug_id +";\n cd " + bug_id + ";\n git init;\n git fetch https://github.com/Spirals-Team/defects4j-repair " + bug_id + ":" + bug_id + ";\n git checkout "+bug_id+";\n mvn -q test -DskipTests "+mvn_option+";\n mvn -q dependency:build-classpath -Dmdep.outputFile=cp.txt";
4161
System.out.println(command);
4262
Process p = Runtime.getRuntime().exec(new String[]{"sh", "-c", command});
@@ -60,8 +80,23 @@ public static NopolContext nopolConfigFor(String bug_id, String mvn_option) thro
6080
for (String entry : FileUtils.readFileToString(new File(bug_id+"/cp.txt")).split(new String(new char[]{File.pathSeparatorChar}))) {
6181
cp.add(new File(entry).toURL());
6282
}
63-
cp.add(new File(bug_id+"/target/classes").toURL());
64-
cp.add(new File(bug_id+"/target/test-classes").toURL());
83+
84+
File maven_app = new File(bug_id + "/target/classes");
85+
if (maven_app.exists()) {
86+
cp.add(maven_app.toURL());
87+
}
88+
File maven_test = new File(bug_id + "/target/test-classes");
89+
if (maven_test.exists()) {
90+
cp.add(maven_test.toURL());
91+
}
92+
File ant_app = new File(bug_id + "/build");
93+
if (ant_app.exists()) {
94+
cp.add(ant_app.toURL());
95+
}
96+
File ant_test = new File(bug_id + "/build-tests");
97+
if (ant_test.exists()) {
98+
cp.add(ant_test.toURL());
99+
}
65100
System.out.println(cp);
66101
//
67102
nopolContext.setProjectClasspath(cp.toArray(new URL[0]));

0 commit comments

Comments
 (0)