Java Code Examples for fr.inria.lille.repair.common.config.NopolContext#setSolver()
The following examples show how to use
fr.inria.lille.repair.common.config.NopolContext#setSolver() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: AbstractRealBugsEvaluation.java From nopol with GNU General Public License v2.0 | 6 votes |
@Test public void AM1() { String projectName = "am1"; RepairType repairType = RepairType.DOUBLE_LITERAL; NopolContext config = new NopolContext(); config.setSolver(NopolContext.NopolSolver.Z3); config.setSolverPath("lib/z3/z3_for_linux"); List<Patch> patches = setupAndRun( projectName, repairType, new String[]{"org.apache.commons.math3.complex.QuaternionTest"}, config); assertEquals(patches.toString(), 1, patches.size()); Patch patch = patches.get(0); assertEquals(patch.getType(), repairType); System.out.println(String.format("Patch for real bug %s: %s", projectName, patch.asString())); TestUtility.assertAgainstKnownPatches(patch, "start == seqEnd"); String rootFolder = realBugPath + projectName + "/"; String srcFolder = rootFolder + "src"; clean(srcFolder); // TODO }
Example 2
Source File: NopolMojo.java From repairnator with MIT License | 5 votes |
private NopolContext createNopolContext(List<String> failingTestCases, List<URL> dependencies, List<File> sourceFolders) { NopolContext nopolContext = new NopolContext(sourceFolders.toArray(new File[0]), dependencies.toArray(new URL[0]), failingTestCases.toArray(new String[0]), Collections.<String>emptyList()); nopolContext.setComplianceLevel(getComplianceLevel()); nopolContext.setTimeoutTestExecution(300); nopolContext.setMaxTimeEachTypeOfFixInMinutes(15); nopolContext.setMaxTimeInMinutes(maxTime); nopolContext.setLocalizer(this.resolveLocalizer()); nopolContext.setSynthesis(this.resolveSynthesis()); nopolContext.setType(this.resolveType()); nopolContext.setOnlyOneSynthesisResult(true); nopolContext.setJson(true); if (!outputDirectory.exists()) { outputDirectory.mkdirs(); } nopolContext.setOutputFolder(outputDirectory.getAbsolutePath()); NopolContext.NopolSolver solver = this.resolveSolver(); nopolContext.setSolver(solver); if (nopolContext.getSynthesis() == NopolContext.NopolSynthesis.SMT) { if (solver == NopolContext.NopolSolver.Z3) { String z3Path = this.loadZ3AndGivePath(); SolverFactory.setSolver(solver, z3Path); nopolContext.setSolverPath(z3Path); } else { SolverFactory.setSolver(solver, null); } } return nopolContext; }
Example 3
Source File: AbstractRealBugsEvaluation.java From nopol with GNU General Public License v2.0 | 5 votes |
@Test public void CL1() { NopolContext config = new NopolContext(); config.setComplianceLevel(4); String projectName = "cl1"; RepairType repairType = RepairType.CONDITIONAL; config.setSolver(NopolContext.NopolSolver.Z3); config.setSolverPath("lib/z3/z3_for_linux"); List<Patch> patches = setupAndRun( projectName, repairType, new String[]{"org.apache.commons.lang.StringUtilsTest" }, config, "junit-3.8.jar"); assertEquals(patches.toString(), 1, patches.size()); Patch patch = patches.get(0); assertEquals(patch.getType(), repairType); System.out.println(String.format("Patch for real bug %s: %s", projectName, patch.asString())); TestUtility.assertAgainstKnownPatches(patch, "(text.length())==(3)", "(text.length())==(with.length())", "(null == with) || (0 != ((java.lang.String)with).length())", "(with.length()) != (0)"); String rootFolder = realBugPath + projectName + "/"; String srcFolder = rootFolder + "src"; clean(srcFolder); // TODO }
Example 4
Source File: AbstractRealBugsEvaluation.java From nopol with GNU General Public License v2.0 | 5 votes |
private List<Patch> setupAndRun(String projectName, RepairType repairType, String[] tests, NopolContext nopolContext, String... dependencies) { String rootFolder = realBugPath + projectName + "/"; String srcFolder = rootFolder + "src"; String binFolder = rootFolder + "target/classes/" + File.pathSeparatorChar + rootFolder + "target/test-classes/"; String libFolder = realBugPath + "../data/lib/"; String classpath = binFolder + File.pathSeparatorChar; for (int i = 0; i < dependencies.length; i++) { classpath += libFolder + dependencies[i]; if (i < dependencies.length - 1) { classpath += File.pathSeparatorChar; } } nopolContext.setProjectSourcePath(new File[]{new File(srcFolder)}); nopolContext.setSolverPath("lib/z3/z3_for_" + (isMac() ? "mac" : "linux")); nopolContext.setSolver(NopolContext.NopolSolver.Z3); nopolContext.setLocalizer(NopolContext.NopolLocalizer.GZOLTAR); nopolContext.setProjectTests(tests); nopolContext.setType(repairType); nopolContext.setProjectClasspath(JavaLibrary.classpathFrom(classpath)); SolverFactory.setSolver(nopolContext.getSolver(), nopolContext.getSolverPath()); switch (this.executionType) { case "symbolic": nopolContext.setOracle(NopolContext.NopolOracle.SYMBOLIC); break; case "nopol": nopolContext.setOracle(NopolContext.NopolOracle.ANGELIC); break; default: throw new RuntimeException("Execution type not found"); } return new NoPol(nopolContext).build().getPatches(); }