Skip to content

Commit

Permalink
test: add several Defects4J Math bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
monperrus committed Mar 15, 2018
1 parent c73283c commit a4dd57e
Show file tree
Hide file tree
Showing 5 changed files with 141 additions and 2 deletions.
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ env:
- SCRIPT="./.travis_intellij.sh"
- SCRIPT="./.travis_tse.sh"
- SCRIPT="./.travis_defects4j_1.sh"
- SCRIPT="./.travis_defects4j_math.sh"

script: $SCRIPT

Expand Down
11 changes: 11 additions & 0 deletions .travis_defects4j_math.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/usr/bin/env bash
# executing all tests in Defects4jEvaluationTest
cd nopol
mvn -q versions:set -DnewVersion=TRAVIS
# creating target/nopol-TRAVIS-jar-with-dependencies.jar
mvn -q clean package -DskipTests

env NOPOL_EVAL_DEFECTS4J=1 mvn -q test -Dtest="Defects4jEvaluationMathTest"



5 changes: 4 additions & 1 deletion nopol/src/main/java/fr/inria/lille/repair/nopol/NoPol.java
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,10 @@ public Object call() throws Exception {
} catch (ExecutionException exception) {
LoggerFactory.getLogger(this.getClass()).error("Error ExecutionException "+ exception.toString());
return Collections.emptyList();
} catch (InterruptedException | TimeoutException exception) {
} catch (InterruptedException execption) {
LoggerFactory.getLogger(this.getClass()).error("Repair interrupted");
return Collections.emptyList();
} catch (TimeoutException exception) {
LoggerFactory.getLogger(this.getClass()).error("Timeout: execution time > " + nopolContext.getMaxTimeEachTypeOfFixInMinutes() + " " + TimeUnit.MINUTES, exception);
return Collections.emptyList();
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,123 @@
package fr.inria.lille.repair.nopol;

import fr.inria.lille.repair.common.config.NopolContext;
import org.junit.Test;

import static fr.inria.lille.repair.nopol.Defects4jUtils.FIFTEEN_MINUTES_TIMEOUT;
import static fr.inria.lille.repair.nopol.Defects4jUtils.FIVE_MINUTES_TIMEOUT;
import static fr.inria.lille.repair.nopol.Defects4jUtils.TEN_MINUTES_TIMEOUT;
import static fr.inria.lille.repair.nopol.Defects4jUtils.nopolConfigFor;
import static fr.inria.lille.repair.nopol.Defects4jUtils.testShouldBeRun;
import static org.junit.Assert.assertEquals;

public class Defects4jEvaluationMathTest {

@Test(timeout = FIVE_MINUTES_TIMEOUT *2)
public void test_Math32() throws Exception {
// On Travis 454sec
if (!testShouldBeRun()) { return; }
NopolContext nopolContext = nopolConfigFor("Math32");
NopolResult result = new NoPol(nopolContext).build();
assertEquals(1, result.getPatches().size());
}

@Test(timeout = FIVE_MINUTES_TIMEOUT *2)
public void test_Math33() throws Exception {
// on Travis: 458sec
if (!testShouldBeRun()) { return; }
NopolContext nopolContext = nopolConfigFor("Math33");
NopolResult result = new NoPol(nopolContext).build();
assertEquals(1, result.getPatches().size());
}

// Math40 Timeout on Travis on March 12
// @Test(timeout = FIVE_MINUTES_TIMEOUT*2)
// public void test_Math40() throws Exception {
// if (!testShouldBeRun()) { return; }
// NopolContext nopolContext = nopolConfigFor("Math40");
// NopolResult result = new NoPol(nopolContext).build();
// assertEquals(1, result.getPatches().size());
// }

@Test(timeout = FIVE_MINUTES_TIMEOUT *2)
public void test_Math42() throws Exception {
// on Travis: 215sec
if (!testShouldBeRun()) { return; }
NopolContext nopolContext = nopolConfigFor("Math42");
NopolResult result = new NoPol(nopolContext).build();
assertEquals(1, result.getPatches().size());
}

@Test(timeout = TEN_MINUTES_TIMEOUT)
public void test_Math49() throws Exception {
// on Travis: 179sec
if (!testShouldBeRun()) { return; }
NopolContext nopolContext = nopolConfigFor("Math49");
NopolResult result = new NoPol(nopolContext).build();
assertEquals(1, result.getPatches().size());
}

@Test(timeout = FIFTEEN_MINUTES_TIMEOUT)
public void test_Math50() throws Exception {
// on Travis: 8 minutes, sometimes more than 10 minutes
if (!testShouldBeRun()) { return; }
NopolContext nopolContext = nopolConfigFor("Math50");
NopolResult result = new NoPol(nopolContext).build();
assertEquals(1, result.getPatches().size());
}

// @Test(timeout = FIVE_MINUTES_TIMEOUT *2)
// public void test_Math57() throws Exception {
// if (!testShouldBeRun()) { return; }
// NopolContext nopolContext = nopolConfigFor("Math57");
// NopolResult result = new NoPol(nopolContext).build();
// assertEquals(1, result.getPatches().size());
// }

// @Test(timeout = FIVE_MINUTES_TIMEOUT *2)
// public void test_Math58() throws Exception {
// // on Travis: 169sec
// // it seems to crash
// if (!testShouldBeRun()) { return; }
// NopolContext nopolContext = nopolConfigFor("Math58");
// NopolResult result = new NoPol(nopolContext).build();
// assertEquals(1, result.getPatches().size());
// }

// @Test(timeout = FIVE_MINUTES_TIMEOUT *2)
// public void test_Math69() throws Exception {
// // on Travis: 22sec
// if (!testShouldBeRun()) { return; }
// NopolContext nopolContext = nopolConfigFor("Math69");
// NopolResult result = new NoPol(nopolContext).build();
// assertEquals(1, result.getPatches().size());
// }
//
// @Test(timeout = FIVE_MINUTES_TIMEOUT *2)
// public void test_Math71() throws Exception {
// if (!testShouldBeRun()) { return; }
// NopolContext nopolContext = nopolConfigFor("Math71");
// NopolResult result = new NoPol(nopolContext).build();
// assertEquals(1, result.getPatches().size());
// }
//
// @Test(timeout = FIVE_MINUTES_TIMEOUT *2)
// public void test_Math73() throws Exception {
// if (!testShouldBeRun()) { return; }
// NopolContext nopolContext = nopolConfigFor("Math73");
// NopolResult result = new NoPol(nopolContext).build();
// assertEquals(1, result.getPatches().size());
// }

// @Test(timeout = FIVE_MINUTES_TIMEOUT *2)
// public void test_Math78() throws Exception {
// if (!testShouldBeRun()) { return; }
// NopolContext nopolContext = nopolConfigFor("Math78");
// NopolResult result = new NoPol(nopolContext).build();
// assertEquals(1, result.getPatches().size());
// }

}



Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ public class Defects4jUtils {
private Defects4jUtils(){} // only static methods

public final static int FIVE_MINUTES_TIMEOUT =5*60*1000;// 5 minutes in millisecs
public final static int TEN_MINUTES_TIMEOUT =10*60*1000;// 5 minutes in millisecs
public final static int TEN_MINUTES_TIMEOUT =10*60*1000;// 10 minutes in millisecs
public final static int FIFTEEN_MINUTES_TIMEOUT =15*60*1000;// 15 minutes in millisecs

public static boolean testShouldBeRun() {
if (System.getenv("NOPOL_EVAL_DEFECTS4J")==null) {
Expand Down

0 comments on commit a4dd57e

Please sign in to comment.