diff --git a/pom.xml b/pom.xml index fc3b74c6b..1774a1001 100644 --- a/pom.xml +++ b/pom.xml @@ -1,6 +1,6 @@ - + 4.0.0 org.inria.sacha.automaticRepair astor @@ -48,7 +48,7 @@ com.github.spoonlabs flacoco - 1.0.5 + 1.0.6 @@ -166,26 +166,16 @@ https://oss.sonatype.org/content/repositories/snapshots - - inria - http://spoon.gforge.inria.fr/repositories/releases/ - - - spoon-snapshot - maven repository for spoon snapshots - https://repository.ow2.org/nexus/content/repositories/snapshots/ - - EvoSuite EvoSuite Repository - http://www.evosuite.org/m2 + https://www.evosuite.org/m2 sachaproject.gforge.inria.fr-release Maven Repository for Spoon Release - http://sachaproject.gforge.inria.fr/repositories/releases/ + https://sachaproject.gforge.inria.fr/repositories/releases/ @@ -195,12 +185,6 @@ https://tdurieux.github.io/maven-repository/snapshots/ - - maven.inria.fr-snapshot - Maven Repository for Spoon Artifac Snapshot - http://maven.inria.fr/artifactory/spoon-public-snapshot/ - - diff --git a/src/main/java/fr/inria/astor/approaches/extensions/minimpact/validator/ProcessEvoSuiteValidator.java b/src/main/java/fr/inria/astor/approaches/extensions/minimpact/validator/ProcessEvoSuiteValidator.java index be388174c..c3459ba3c 100755 --- a/src/main/java/fr/inria/astor/approaches/extensions/minimpact/validator/ProcessEvoSuiteValidator.java +++ b/src/main/java/fr/inria/astor/approaches/extensions/minimpact/validator/ProcessEvoSuiteValidator.java @@ -98,9 +98,12 @@ public TestCaseVariantValidationResult runTestFromEvoSuite(ProgramVariant curren // Set up dirs String classpathForCompile = ""; classpathForCompile = projectFacade.getProperties().getDependenciesString() + File.pathSeparator - + projectFacade.getOutDirWithPrefix(currentVariant.currentMutatorIdentifier()) + File.pathSeparator// + + new File(projectFacade.getOutDirWithPrefix(currentVariant.currentMutatorIdentifier())) + .getAbsolutePath() + + File.pathSeparator// + new File(ConfigurationProperties.getProperty("evosuitejar")).getAbsolutePath() + File.pathSeparator - + projectFacade.getOutDirWithPrefix(currentVariant.DEFAULT_ORIGINAL_VARIANT); + + new File(projectFacade.getOutDirWithPrefix(currentVariant.DEFAULT_ORIGINAL_VARIANT)) + .getAbsolutePath(); String outPutTest = projectFacade.getOutDirWithPrefix("/evosuite/evosuite-tests/" + sufix); @@ -129,8 +132,8 @@ public TestCaseVariantValidationResult runTestFromEvoSuite(ProgramVariant curren List pathTestGenerated = new ArrayList(); log.debug("Generating test for the first time"); - boolean executed = fev.runEvosuite(currentVariant, classesToGenerateTests, projectFacade, testEScodepath, - runOverOriginal); + boolean executed = fev.runEvosuite(currentVariant, classesToGenerateTests, projectFacade, + esPath.getAbsolutePath(), runOverOriginal); // we collect the files generated @@ -145,7 +148,7 @@ public TestCaseVariantValidationResult runTestFromEvoSuite(ProgramVariant curren // Collect test generated from files generated by ES for (String f : pathTestGenerated) { String qualifiedTestName = f.replace(".java", "").replace(esPath.toString(), "") - .replace("/evosuite-tests/", "").replace(File.separator, "."); + .replace(File.separator,".").replace(".evosuite-tests.", ""); if (!qualifiedTestName.endsWith(EvoSuiteFacade.EVOSUITE_scaffolding_SUFFIX) && classesToGenerateTests .contains(qualifiedTestName.replace(EvoSuiteFacade.EVOSUITE_SUFFIX, ""))) { testGenerated.add(qualifiedTestName); @@ -165,10 +168,13 @@ public TestCaseVariantValidationResult runTestFromEvoSuite(ProgramVariant curren // WE COMPILE EVO TEST log.info("Classpath " + classpathForCompile); - + String envOS = System.getProperty("os.name"); String javaPath = ConfigurationProperties.getProperty("jvm4evosuitetestexecution"); List command = new ArrayList(); - command.add(javaPath + File.separator + "javac"); + if (!envOS.contains("Windows")) + command.add(javaPath + File.separator + "javac"); + else + command.add("\"" + javaPath + File.separator + "javac" + "\""); command.add("-classpath"); command.add(classpathForCompile); command.add("-d"); @@ -176,7 +182,7 @@ public TestCaseVariantValidationResult runTestFromEvoSuite(ProgramVariant curren //// Save compiled File fout = new File(outPutTest); fout.mkdirs(); - command.add(outPutTest); + command.add(fout.getAbsolutePath()); // Adding the files for (String testPath : pathTestGenerated) { @@ -189,8 +195,8 @@ public TestCaseVariantValidationResult runTestFromEvoSuite(ProgramVariant curren log.debug("Any test to generate, all test cases were generated before: " + testAlreadyGenerated); } - String classpathForRunTest = classpathForCompile + (File.pathSeparator) + outPutTest + File.pathSeparator - + System.getProperty("java.class.path"); + String classpathForRunTest = classpathForCompile + (File.pathSeparator) + new File(outPutTest).getAbsolutePath() + + File.pathSeparator + System.getProperty("java.class.path"); log.info("Process classpath " + classpathForRunTest); ProcessEvoSuiteValidator evoProcess = new ProcessEvoSuiteValidator(); @@ -231,4 +237,4 @@ public TestCasesProgramValidationResult executeRegressionTesting(URL[] processCl } } -} +} \ No newline at end of file diff --git a/src/main/java/fr/inria/astor/core/setup/ProjectRepairFacade.java b/src/main/java/fr/inria/astor/core/setup/ProjectRepairFacade.java index 051e6744a..e449f4eb1 100644 --- a/src/main/java/fr/inria/astor/core/setup/ProjectRepairFacade.java +++ b/src/main/java/fr/inria/astor/core/setup/ProjectRepairFacade.java @@ -80,24 +80,36 @@ public void copyOriginalSourceCode(String pathOriginalCode, String currentMutato */ public void cleanMutationResultDirectories(String currentMutatorIdentifier) throws IOException { - removeDir(getProperties().getWorkingDirForSource() + File.separator + currentMutatorIdentifier); - removeDir(getProperties().getWorkingDirForBytecode() + File.separator + currentMutatorIdentifier); + removeDir(getProperties().getWorkingDirForSource() + File.separator + currentMutatorIdentifier, false); + removeDir(getProperties().getWorkingDirForBytecode() + File.separator + currentMutatorIdentifier, false); + } + + /** + * Remove source dir for a given mutation + * + * @throws IOException + */ + public void cleanMutationResultSourceDirectory(String currentMutatorIdentifier) throws IOException { + + removeDir(getProperties().getWorkingDirForSource() + File.separator + currentMutatorIdentifier, false); } public void cleanMutationResultDirectories() throws IOException { - removeDir(getProperties().getWorkingDirForSource()); - removeDir(getProperties().getWorkingDirForBytecode()); + removeDir(getProperties().getWorkingDirForSource(), true); + removeDir(getProperties().getWorkingDirForBytecode(), true); } - private void removeDir(String dir) throws IOException { + private void removeDir(String dir, boolean isFolderToBeRecreated) throws IOException { File dirin = new File(dir); try { FileUtils.deleteDirectory(dirin); } catch (Exception ex) { logger.error("ex: " + ex.getMessage()); } - dirin.mkdir(); + if (isFolderToBeRecreated) { + dirin.mkdir(); + } } public boolean copyOriginalBin(List inDirs, String mutatorIdentifier) throws IOException { diff --git a/src/main/java/fr/inria/astor/core/solutionsearch/AstorCoreEngine.java b/src/main/java/fr/inria/astor/core/solutionsearch/AstorCoreEngine.java index 9169d186e..485935794 100644 --- a/src/main/java/fr/inria/astor/core/solutionsearch/AstorCoreEngine.java +++ b/src/main/java/fr/inria/astor/core/solutionsearch/AstorCoreEngine.java @@ -251,6 +251,10 @@ public ExecutionResult atEnd() { fw.close(); } } + if (!ConfigurationProperties.getPropertyBool("saveall")) { + projectFacade.cleanMutationResultDirectories(ProgramVariant.DEFAULT_ORIGINAL_VARIANT); + projectFacade.cleanMutationResultDirectories(ProgramVariant.DEFAULT_ORIGINAL_VARIANT + PatchDiffCalculator.DIFF_SUFFIX); + } } catch (Exception e1) { e1.printStackTrace(); } @@ -563,6 +567,9 @@ public boolean processCreatedVariant(ProgramVariant programVariant, int generati saveVariant(programVariant); return true; + } else if (!ConfigurationProperties.getPropertyBool("saveall")) { + projectFacade.cleanMutationResultDirectories( + ConfigurationProperties.getProperty("pvariantfoldername") + programVariant.getId()); } } else { log.debug("-The child does NOT compile: " + programVariant.getId() + ", errors: " diff --git a/src/main/java/fr/inria/astor/core/validation/junit/LaucherJUnitProcess.java b/src/main/java/fr/inria/astor/core/validation/junit/LaucherJUnitProcess.java index c5b93e63a..2f90e612d 100644 --- a/src/main/java/fr/inria/astor/core/validation/junit/LaucherJUnitProcess.java +++ b/src/main/java/fr/inria/astor/core/validation/junit/LaucherJUnitProcess.java @@ -13,6 +13,7 @@ import java.util.ArrayList; import java.util.HashSet; import java.util.List; +import java.util.UUID; import java.util.concurrent.TimeUnit; import org.apache.log4j.Logger; @@ -49,11 +50,14 @@ public TestResult execute(String jvmPath, URL[] classpath, List classesT boolean outputInFile = ConfigurationProperties.getPropertyBool("processoutputinfile"); public TestResult execute(String jvmPath, String classpath, List classesToExecute, int waitTime) { + String envOS = System.getProperty("os.name"); + String timeZone = ConfigurationProperties.getProperty("timezone"); + Process p = null; - jvmPath += File.separator + "java"; + UUID procWinUUID = null; + String newJvmPath = jvmPath + File.separator + "java"; List cls = new ArrayList<>(new HashSet(classesToExecute)); - String newClasspath = classpath; if (ConfigurationProperties.getPropertyBool("runjava7code") || ProjectConfiguration.isJDKLowerThan8()) { newClasspath = (new File(ConfigurationProperties.getProperty("executorjar")).getAbsolutePath()) @@ -67,7 +71,7 @@ public TestResult execute(String jvmPath, String classpath, List classes List command = new ArrayList(); - command.add(jvmPath); + command.add("\"" + newJvmPath + "\""); command.add("-Xmx2048m"); String[] ids = ConfigurationProperties.getProperty(MetaGenerator.METALL).split(File.pathSeparator); @@ -75,15 +79,28 @@ public TestResult execute(String jvmPath, String classpath, List classes command.add("-D" + MetaGenerator.MUT_IDENTIFIER + mutid + "=" + ConfigurationProperties.getProperty(MetaGenerator.MUT_IDENTIFIER + mutid)); } + if (envOS.contains("Windows")) { + procWinUUID = UUID.randomUUID(); + command.add("-DwinProcUUID=" + procWinUUID); + System.setProperty("user.timezone", timeZone); + } command.add("-cp"); - command.add(newClasspath); + command.add("\"" + newClasspath + "\""); command.add(laucherClassName().getCanonicalName()); command.addAll(cls); - printCommandToExecute(command, waitTime); - - ProcessBuilder pb = new ProcessBuilder("/bin/bash"); + ProcessBuilder pb; + if (!envOS.contains("Windows")) { + printCommandToExecute(command, waitTime); + pb = new ProcessBuilder("/bin/bash"); + } else { + command.set(0, "'" + newJvmPath + "'"); + command.set(5, "'" + newClasspath + "'"); + // On Windows, BufferedWriter have a problem to write over 8192 characters. + // We must provide command in ProcessBuilder constructor. + pb = new ProcessBuilder("powershell", "-Command", "& " + toString(command)); + } if (outputInFile) { pb.redirectOutput(ftemp); @@ -97,22 +114,23 @@ public TestResult execute(String jvmPath, String classpath, List classes BufferedWriter p_stdin = new BufferedWriter(new OutputStreamWriter(p.getOutputStream())); try { - // Set up the timezone - String timeZone = ConfigurationProperties.getProperty("timezone"); - p_stdin.write("TZ=\"" + timeZone + "\""); - p_stdin.newLine(); - p_stdin.flush(); - p_stdin.write("export TZ"); - p_stdin.newLine(); - p_stdin.flush(); - p_stdin.write("echo $TZ"); - p_stdin.newLine(); - p_stdin.flush(); - // Writing the command - p_stdin.write(toString(command)); - - p_stdin.newLine(); - p_stdin.flush(); + if (!envOS.contains("Windows")) { + // Set up the timezone + p_stdin.write("TZ=\"" + timeZone + "\""); + p_stdin.newLine(); + p_stdin.flush(); + p_stdin.write("export TZ"); + p_stdin.newLine(); + p_stdin.flush(); + p_stdin.write("echo $TZ"); + p_stdin.newLine(); + p_stdin.flush(); + // Writing the command + p_stdin.write(toString(command)); + + p_stdin.newLine(); + p_stdin.flush(); + } // end p_stdin.write("exit"); @@ -125,13 +143,12 @@ public TestResult execute(String jvmPath, String classpath, List classes // if (!p.waitFor(waitTime, TimeUnit.MILLISECONDS)) { - killProcess(p, waitTime); + killProcess(p, waitTime, procWinUUID); return null; } long t_end = System.currentTimeMillis(); - // log.debug("Execution time " + ((t_end - t_start) / 1000) + " - // seconds"); + log.debug("Execution time " + ((t_end - t_start) / 1000) + "seconds"); if (!avoidInterruption) { // We force obtaining the exit value. @@ -143,12 +160,13 @@ public TestResult execute(String jvmPath, String classpath, List classes output = new BufferedReader(new FileReader(ftemp.getAbsolutePath())); else output = new BufferedReader(new InputStreamReader(p.getInputStream())); + TestResult tr = getTestResult(output); p.destroyForcibly(); return tr; } catch (IOException | InterruptedException | IllegalThreadStateException ex) { log.info("The Process that runs JUnit test cases had problems: " + ex.getMessage()); - killProcess(p, waitTime); + killProcess(p, waitTime, procWinUUID); } return null; } @@ -159,41 +177,62 @@ public TestResult execute(String jvmPath, String classpath, List classes * * @param waitTime */ - private void killProcess(Process p, int waitTime) { + private void killProcess(Process p, int waitTime, UUID procWinUUID) { if (p == null) return; Object pid = null; try { - Field f = p.getClass().getDeclaredField("pid"); - f.setAccessible(true); - pid = f.get(p); - log.debug("-Killed id: pid->" + pid); - - } catch (Exception e) { + if (procWinUUID != null) { + Process survivedPID = Runtime.getRuntime() + .exec("wmic process where \"commandline like '%-DwinProcUUID=" + procWinUUID + + "%' and name like '%java.exe%'\" get processid"); + BufferedReader outputSurvivedPIDs = new BufferedReader( + new InputStreamReader(survivedPID.getInputStream())); + String line; + int i = 0; + while ((line = outputSurvivedPIDs.readLine()) != null) { + if (i == 2 && !line.isEmpty()) { + pid = line.trim(); + break; + } + i++; + } + } else { + Field f = p.getClass().getDeclaredField("pid"); + f.setAccessible(true); + pid = f.get(p); + } + } catch (IOException | NoSuchFieldException | SecurityException | IllegalArgumentException | IllegalAccessException e) { log.error(e); } - p.destroyForcibly(); + p.destroyForcibly(); log.info("The Process that runs JUnit test cases did not terminate within waitTime of " + TimeUnit.MILLISECONDS.toSeconds(waitTime) + " seconds"); - log.info("Killed the Process that runs JUnit test cases " + pid); + log.info("Killing the Process that runs JUnit test cases " + pid); // workarrond!! if (ConfigurationProperties.getPropertyBool("forcesubprocesskilling")) { Integer subprocessid = Integer.valueOf(pid.toString()) + 1; try { - log.debug("Killing subprocess " + subprocessid); - Process process = new ProcessBuilder(new String[] { "kill", subprocessid.toString() }).start(); + Process process; + if (procWinUUID != null) { + log.error("Killing Windows process " + pid); + process = Runtime.getRuntime().exec("taskkill /T /F /PID " + pid); + } else { + log.debug("Killing subprocess " + subprocessid); + process = new ProcessBuilder(new String[] { "kill", subprocessid.toString() }).start(); + } process.waitFor(); - - } catch (Exception e) { - log.error("Problems killing subprocess " + subprocessid); + } catch (IOException | InterruptedException e) { + if (procWinUUID != null) + log.error("Problems killing Windows process " + pid); + else + log.error("Problems killing subprocess " + subprocessid); log.error(e); } - } - } protected String urlArrayToString(URL[] urls) { @@ -289,4 +328,4 @@ protected TestResult getTestResult(BufferedReader in) { } } -} +} \ No newline at end of file diff --git a/src/main/java/fr/inria/astor/util/EvoSuiteFacade.java b/src/main/java/fr/inria/astor/util/EvoSuiteFacade.java index 4a077ef23..74da8dd79 100644 --- a/src/main/java/fr/inria/astor/util/EvoSuiteFacade.java +++ b/src/main/java/fr/inria/astor/util/EvoSuiteFacade.java @@ -219,6 +219,8 @@ protected static URL[] redefineURL(File foutgen, URL[] originalURL) throws Malfo * @return */ protected boolean runProcess(URL[] urlClasspath, String[] argumentsEvo) { + String envOS = System.getProperty("os.name"); + Process p = null; String javaPath = ConfigurationProperties.getProperty("jvm4evosuitetestexecution"); @@ -227,7 +229,10 @@ protected boolean runProcess(URL[] urlClasspath, String[] argumentsEvo) { try { List command = new ArrayList(); - command.add(javaPath); + if (!envOS.contains("Windows")) + command.add(javaPath); + else + command.add("\"" + javaPath + "\""); command.add("-jar"); command.add(new File(ConfigurationProperties.getProperty("evosuitejar")).getAbsolutePath()); @@ -439,4 +444,4 @@ public static void runProcess(String[] command) throws Exception { logger.debug(command + " exitValue() " + pro.exitValue()); } -} +} \ No newline at end of file diff --git a/src/main/java/fr/inria/astor/util/PatchDiffCalculator.java b/src/main/java/fr/inria/astor/util/PatchDiffCalculator.java index d7dad7451..52229b837 100644 --- a/src/main/java/fr/inria/astor/util/PatchDiffCalculator.java +++ b/src/main/java/fr/inria/astor/util/PatchDiffCalculator.java @@ -124,7 +124,20 @@ public String getDiff(File original, File newvariant, String fileName) { public String getDiff(File original, File newvariant, String fileNameLeft, String fileNameRight) { try { - ProcessBuilder builder = new ProcessBuilder("/bin/bash"); + int diffContext = ConfigurationProperties.getPropertyInt("diffcontext"); + + String command = "diff -w -b " + " --label=" + fileNameLeft + " --label=" + fileNameRight + " " + + original.getAbsolutePath() + " " + newvariant.getAbsolutePath() + " --unified=" + diffContext; + log.debug("diff command : " + command); + + ProcessBuilder builder; + String envOS = System.getProperty("os.name"); + if (!envOS.contains("Windows")) + builder = new ProcessBuilder("/bin/bash"); + else { + // Linux 'diff' command must be added on Windows Path (ex. by Cygwin) + builder = new ProcessBuilder("cmd", "/C", command); + } builder.redirectErrorStream(true); Process process = builder.start(); @@ -132,16 +145,13 @@ public String getDiff(File original, File newvariant, String fileNameLeft, Strin BufferedWriter p_stdin = new BufferedWriter(new OutputStreamWriter(process.getOutputStream())); try { + if (!envOS.contains("Windows")) { + // Set up the timezone - int diffContext = ConfigurationProperties.getPropertyInt("diffcontext"); - - // Set up the timezone - String command = "diff -w -b " + " --label=" + fileNameLeft + " --label=" + fileNameRight + " " - + original.getAbsolutePath() + " " + newvariant.getAbsolutePath() + " --unified=" + diffContext; - log.debug("diff command : " + command); - p_stdin.write(command); - p_stdin.newLine(); - p_stdin.flush(); + p_stdin.write(command); + p_stdin.newLine(); + p_stdin.flush(); + } // end p_stdin.write("exit"); @@ -188,4 +198,4 @@ private String readBuffer(BufferedReader reader) throws IOException { return dd; } -} +} \ No newline at end of file diff --git a/src/main/java/fr/inria/main/AbstractMain.java b/src/main/java/fr/inria/main/AbstractMain.java index 7fa3c9e91..f0159763e 100644 --- a/src/main/java/fr/inria/main/AbstractMain.java +++ b/src/main/java/fr/inria/main/AbstractMain.java @@ -1053,14 +1053,21 @@ private void addToFolder(List pathResults, String[] possibleTestSrcFolde boolean onlyOne) throws IOException { boolean added = false; for (String possibleSrc : possibleTestSrcFolders) { - File fSrc = new File(File.separator + possibleSrc).getAbsoluteFile(); + possibleSrc = possibleSrc.trim(); + File fSrc = null; + String envOS = System.getProperty("os.name"); + if (envOS.contains("Windows") && possibleSrc.startsWith("/")) { + fSrc = new File(possibleSrc).getAbsoluteFile(); + } else { + fSrc = new File(File.separator + possibleSrc).getAbsoluteFile(); + } if (Files.exists(fSrc.toPath())) { if (!pathResults.contains(fSrc.getAbsolutePath())) { pathResults.add(fSrc.getAbsolutePath()); added = true; } - } else { + } else if (!fSrc.getAbsolutePath().contains(originalProjectRoot)) { File fSrcRelative = new File(originalProjectRoot + File.separator + possibleSrc); if (Files.isDirectory(fSrcRelative.toPath())) { if (!pathResults.contains(fSrcRelative.getAbsolutePath())) { diff --git a/src/main/resources/astor.properties b/src/main/resources/astor.properties index b71be5239..8677ce138 100755 --- a/src/main/resources/astor.properties +++ b/src/main/resources/astor.properties @@ -28,7 +28,7 @@ forceExecuteRegression=false #Fault localization threshold. flthreshold=0.1 #Gzoltar version -gzoltarVersion=1.7.3 +gzoltarVersion=1.7.4-SNAPSHOT #Default location of GZoltar jar files locationGzoltarJar=./lib/ #Max number of suspicious analyzed @@ -81,11 +81,11 @@ srctestfolder=src/test/java # binjavafolder=/target/classes bintestfolder=/target/test-classes -# +# separated using File.pathSeparator (': in Unix/Linux/Solaris), please, replace it by ';' if you use Windows) resourcesfolder=/src/main/resources:/src/test/resources: # # Gzoltar configuration -## working directory for Gzoltar +## working directory for Gzoltar (replace it if you use Windows) location=/tmp #Faul localization class faultlocalization=fr.inria.astor.core.faultlocalization.flacoco.FlacocoFaultLocalization @@ -197,7 +197,7 @@ max_synthesis_step=10000 # synthesis_depth=3 # -forcesubprocesskilling=false +forcesubprocesskilling=true # collectonlyusedmethod=false #default|git|relative diff --git a/src/test/java/fr/inria/astor/test/D4JWorkflowTestSingle.java b/src/test/java/fr/inria/astor/test/D4JWorkflowTestSingle.java index 43614723b..99ef6e962 100644 --- a/src/test/java/fr/inria/astor/test/D4JWorkflowTestSingle.java +++ b/src/test/java/fr/inria/astor/test/D4JWorkflowTestSingle.java @@ -82,8 +82,10 @@ public void testMath2Perfect() throws Exception { fw.close(); cs.append("-parameters", - "logtestexecution:true:" + "maxmemory" + File.pathSeparator + "-Xmx4G" + File.pathSeparator - + "fixedLocation:HypergeometricDistribution-321:" + "peOperator:insertbefore:pefile:" + "logtestexecution" + File.pathSeparator + "true" + File.pathSeparator + "" + "maxmemory" + + File.pathSeparator + "-Xmx4G" + File.pathSeparator + "fixedLocation" + File.pathSeparator + + "HypergeometricDistribution-321" + File.pathSeparator + "" + "peOperator" + File.pathSeparator + + "insertbefore" + File.pathSeparator + "pefile" + File.pathSeparator + "" + f.getAbsolutePath()); AstorMain main1 = new AstorMain(); @@ -125,9 +127,10 @@ public void testLang44Perfect() throws Exception { " if (val.length() == 1 && !Character.isDigit(val.charAt(0))) { throw new NumberFormatException(val + \" is not a valid number.\"); }"); fw.close(); - cs.append("-parameters", - "logtestexecution:true:" + "maxmemory" + File.pathSeparator + "-Xmx4G" + File.pathSeparator - + "fixedLocation:NumberUtils-145:" + "peOperator:insertbefore:pefile:" + f.getAbsolutePath()); + cs.append("-parameters", "logtestexecution" + File.pathSeparator + "true" + File.pathSeparator + "" + + "maxmemory" + File.pathSeparator + "-Xmx4G" + File.pathSeparator + "fixedLocation" + + File.pathSeparator + "NumberUtils-145" + File.pathSeparator + "" + "peOperator" + File.pathSeparator + + "insertbefore" + File.pathSeparator + "pefile" + File.pathSeparator + "" + f.getAbsolutePath()); AstorMain main1 = new AstorMain(); @@ -167,7 +170,7 @@ public void testMath28() throws Exception { public void testMath40() throws Exception { CommandSummary cs = new CommandSummary(); cs.command.putIfAbsent("-flthreshold", "0.2"); - cs.command.put("-parameters", "logtestexecution:true"); + cs.command.put("-parameters", "logtestexecution" + File.pathSeparator + "true"); cs.command.put("-ignoredtestcases", "org.apache.commons.math.util.FastMathTest" + File.pathSeparator + "org.apache.commons.math.ode.nonstiff.ClassicalRungeKuttaIntegratorTest" + File.pathSeparator @@ -346,7 +349,7 @@ public void testMath32JKali() throws Exception { public void testMath40JKali() throws Exception { CommandSummary cs = new CommandSummary(); cs.command.putIfAbsent("-flthreshold", "0"); - cs.command.put("-parameters", "logtestexecution:true"); + cs.command.put("-parameters", "logtestexecution" + File.pathSeparator + "true"); cs.command.put("-ignoredtestcases", "org.apache.commons.math.util.FastMathTest" + File.pathSeparator + "org.apache.commons.math.ode.nonstiff.ClassicalRungeKuttaIntegratorTest" + File.pathSeparator @@ -481,10 +484,11 @@ public void testChart25JKali() throws Exception { runComplete("Chart25", "", "jKali", TIMEOUTMIN); } - @Test - public void testChart26JKali() throws Exception { - runComplete("Chart26", "", "jKali", TIMEOUTMIN); - } + // removed on August 24 by Martin, flaky + // @Test + // public void testChart26JKali() throws Exception { + // runComplete("Chart26", "", "jKali", TIMEOUTMIN); + // } public static void runCompleteJGenProg(String bug_id, String mvn_option) throws Exception { @@ -703,7 +707,8 @@ public static void createCommand(String bug_id, String approach, int timeout, St } System.out.println("\nConfiguration " + cs.command.toString()); - cs.append("-parameters", "logtestexecution:true:" + "maxmemory" + File.pathSeparator + "-Xmx4G"); + cs.append("-parameters", "logtestexecution" + File.pathSeparator + "true" + File.pathSeparator + "" + + "maxmemory" + File.pathSeparator + "-Xmx4G"); } @@ -826,4 +831,4 @@ public void testSynthesisjKaliIssueMath78PatchNopol() throws Exception { } -} \ No newline at end of file +} diff --git a/src/test/java/fr/inria/astor/test/FaultLocalizationTest.java b/src/test/java/fr/inria/astor/test/FaultLocalizationTest.java index 869d5dff4..eaa0c4c50 100644 --- a/src/test/java/fr/inria/astor/test/FaultLocalizationTest.java +++ b/src/test/java/fr/inria/astor/test/FaultLocalizationTest.java @@ -9,7 +9,6 @@ import java.util.Arrays; import java.util.List; -import org.fest.util.Files; import org.junit.Test; import fr.inria.astor.core.entities.ProgramVariant; @@ -150,7 +149,8 @@ private void helperLimitedTestAndClasses(FaultLocalization fl) throws Exception cs.command.put("-faultlocalization", fl.name()); cs.command.put("-flthreshold", "0.0000"); - cs.command.put("-parameters", "includeZeros:false:keepGZoltarFiles:false"); + cs.command.put("-parameters", "includeZeros" + File.pathSeparator + "false" + File.pathSeparator + + "keepGZoltarFiles" + File.pathSeparator + "false"); String oneFailingTestClassToRun = "org.apache.commons.math.analysis.solvers.BisectionSolverTest#testMath369"; String anotherTestClassToRun = "org.apache.commons.math.estimation.LevenbergMarquardtEstimatorTest"; @@ -191,13 +191,14 @@ private void helperLimitedTestAndClassesFromFile(FaultLocalization fl) throws Ex cs.command.put("-faultlocalization", fl.name()); cs.command.put("-flthreshold", "0.0000"); - cs.command.put("-parameters", "includeZeros:false:keepGZoltarFiles:false"); + cs.command.put("-parameters", "includeZeros" + File.pathSeparator + "false" + File.pathSeparator + + "keepGZoltarFiles" + File.pathSeparator + "false"); String oneFailingTestClassToRun = "org.apache.commons.math.analysis.solvers.BisectionSolverTest#testMath369"; String anotherTestClassToRun = "org.apache.commons.math.estimation.LevenbergMarquardtEstimatorTest"; String thirdTestclassToRun = "org.apache.commons.math.estimation.WeightedMeasurementTest"; - File ft = Files.newTemporaryFile(); + File ft = File.createTempFile("astortmp",""); FileWriter fw = new FileWriter(ft); fw.write(oneFailingTestClassToRun); @@ -262,7 +263,7 @@ public void testMath70FixedFL() throws Exception { System.out.println(Arrays.toString(args)); CommandSummary command = new CommandSummary(args); - command.command.put("-parameters", "fixedLocation:BisectionSolver-72"); + command.command.put("-parameters", "fixedLocation" + File.pathSeparator + "BisectionSolver-72"); main1.execute(command.flat()); List solutions = main1.getEngine().getSolutions(); @@ -277,7 +278,8 @@ public void testFLMath70Ngz() throws Exception { // by default, max generations is zero, that means, it does not evolve cs.command.put("-faultlocalization", FaultLocalization.GZOLTAR1_7.name()); cs.command.put("-flthreshold", "0.0000"); - cs.command.put("-parameters", "includeZeros:false:keepGZoltarFiles:false"); + cs.command.put("-parameters", "includeZeros" + File.pathSeparator + "false" + File.pathSeparator + + "keepGZoltarFiles" + File.pathSeparator + "false"); // We execute astor for creating the model and run FL @@ -311,7 +313,8 @@ private void helperLimitedTestClasses(FaultLocalization flocalization) throws Ex cs.command.put("-faultlocalization", flocalization.name()); cs.command.put("-flthreshold", "0.0000"); - cs.command.put("-parameters", "includeZeros:false:keepGZoltarFiles:false"); + cs.command.put("-parameters", "includeZeros" + File.pathSeparator + "false" + File.pathSeparator + + "keepGZoltarFiles" + File.pathSeparator + "false"); String oneFailingTestClassToRun = "org.apache.commons.math.analysis.solvers.BisectionSolverTest"; String anotherTestClassToRun = "org.apache.commons.math.estimation.LevenbergMarquardtEstimatorTest"; @@ -358,7 +361,8 @@ private void helperLimitedNumberOfTestMethods(FaultLocalization fl) throws Excep cs.command.put("-faultlocalization", fl.name()); cs.command.put("-flthreshold", "0.0000"); - cs.command.put("-parameters", "includeZeros:false:keepGZoltarFiles:false"); + cs.command.put("-parameters", "includeZeros" + File.pathSeparator + "false" + File.pathSeparator + + "keepGZoltarFiles" + File.pathSeparator + "false"); String oneFailingTestClassToRun = "org.apache.commons.math.analysis.solvers.BisectionSolverTest#testMath369"; String anotherTestClassToRun = "org.apache.commons.math.estimation.LevenbergMarquardtEstimatorTest#testTrivial"; diff --git a/src/test/java/fr/inria/astor/test/repair/QuixBugsRepairTest.java b/src/test/java/fr/inria/astor/test/repair/QuixBugsRepairTest.java index d136fca38..07820ef57 100644 --- a/src/test/java/fr/inria/astor/test/repair/QuixBugsRepairTest.java +++ b/src/test/java/fr/inria/astor/test/repair/QuixBugsRepairTest.java @@ -21,7 +21,7 @@ import fr.inria.astor.core.entities.ModificationPoint; import fr.inria.astor.core.entities.OperatorInstance; import fr.inria.astor.core.entities.SuspiciousModificationPoint; -import fr.inria.astor.core.faultlocalization.gzoltar.GZoltarFaultLocalization; +import fr.inria.astor.core.faultlocalization.flacoco.FlacocoFaultLocalization; import fr.inria.astor.core.ingredientbased.IngredientBasedApproach; import fr.inria.astor.core.setup.ConfigurationProperties; import fr.inria.astor.core.solutionsearch.AstorCoreEngine; @@ -64,9 +64,12 @@ public static CommandSummary getQuixBugsCommand(String name) { cs.command.put("-flthreshold", "0.0"); cs.command.put("-loglevel", "INFO"); cs.command.put("-stopfirst", "TRUE"); - cs.command.put("-parameters", "logtestexecution:TRUE:" - + "disablelog:FALSE:maxtime:120:autocompile:false:gzoltarpackagetonotinstrument:com.google.gson_engine" - + "-" + "java_programs_test"); + cs.command.put("-parameters", + "logtestexecution" + File.pathSeparator + "TRUE" + File.pathSeparator + "" + "disablelog" + + File.pathSeparator + "FALSE" + File.pathSeparator + "maxtime" + File.pathSeparator + "120" + + File.pathSeparator + "autocompile" + File.pathSeparator + "false" + File.pathSeparator + + "gzoltarpackagetonotinstrument" + File.pathSeparator + "com.google.gson_engine" + + File.pathSeparator + "java_programs_test"); cs.command.put("-location", new File("./examples/quixbugscompiled/" + name).getAbsolutePath()); return cs; @@ -296,7 +299,7 @@ public void test_get_factorsRepair_cardumen_Debug_mode() throws Exception { CommandSummary command = (getQuixBugsCommand("get_factors")); command.command.put("-maxgen", "0"); command.command.put("-mode", "cardumen"); - command.append("-parameters", "packageToInstrument:java_programs"); + command.append("-parameters", "packageToInstrument" + File.pathSeparator + "java_programs"); main1.execute(command.flat()); @@ -427,8 +430,8 @@ public void testLISRepair_statement() throws Exception { command.command.put("-maxgen", "1000"); // The suspicious is a var declaration used in the patch, so, the default // transformation ignore it - command.append("-parameters", ExtensionPoints.INGREDIENT_TRANSFORM_STRATEGY.identifier + ":" - + NoIngredientTransformation.class.getName()); + command.append("-parameters", ExtensionPoints.INGREDIENT_TRANSFORM_STRATEGY.identifier + "" + File.pathSeparator + + "" + NoIngredientTransformation.class.getName()); main1.execute(command.flat()); assertTrue("No solution", main1.getEngine().getSolutions().size() > 0); @@ -452,8 +455,8 @@ public void testLISRepair_statement_debug() throws Exception { CommandSummary command = (getQuixBugsCommand("lis")); command.command.put("-maxgen", "0"); command.command.put("-loglevel", "ERROR"); - command.append("-parameters", ExtensionPoints.INGREDIENT_TRANSFORM_STRATEGY.identifier + ":" - + NoIngredientTransformation.class.getName()); + command.append("-parameters", ExtensionPoints.INGREDIENT_TRANSFORM_STRATEGY.identifier + "" + File.pathSeparator + + "" + NoIngredientTransformation.class.getName()); main1.execute(command.flat()); @@ -651,4 +654,4 @@ public void ne_test_hanoiRepair_cardumen1h() throws Exception { assertTrue(main1.getEngine().getSolutions().size() == 0); } -} +} \ No newline at end of file diff --git a/src/test/java/fr/inria/astor/test/repair/approaches/EvoSuiteGenerationTest.java b/src/test/java/fr/inria/astor/test/repair/approaches/EvoSuiteGenerationTest.java index f8a326cac..a8e7d0de1 100644 --- a/src/test/java/fr/inria/astor/test/repair/approaches/EvoSuiteGenerationTest.java +++ b/src/test/java/fr/inria/astor/test/repair/approaches/EvoSuiteGenerationTest.java @@ -232,7 +232,7 @@ public void testjGenProgWithEvoSuiteTests() throws Exception { "-bintestfolder", "/target/test-classes", "-javacompliancelevel", "7", "-flthreshold", "0.5", "-out", out.getAbsolutePath(), "-scope", "local", "-seed", "10", "-stopfirst", "true", "-population", "1", "-stopfirst", "true", "-maxtime", "100", "-validation", "evosuite", "-maxgen", "250", "-parameters", - "overridemaxtime:false" + "overridemaxtime" + File.pathSeparator + "false" }; System.out.println(Arrays.toString(args)); @@ -345,7 +345,7 @@ public void testMath70WithEvosuiteTests() throws Exception { out.getAbsolutePath(), "-scope", "package", "-seed", "10", "-maxgen", "2000", "-population", "1", "-stopfirst", "true", "-maxtime", "20", // PARAMETER TO TEST - "-validation", "evosuite", "-parameters", "overridemaxtime:false" + "-validation", "evosuite", "-parameters", "overridemaxtime" + File.pathSeparator + "false" }; System.out.println(Arrays.toString(args)); @@ -428,9 +428,36 @@ public void testBugProcessDoesNotReturn() throws Exception { // memory + "-Xmx2048m " + "-cp " // Classpath - + "/Users/matias/develop/code/astor/target/test-classes:/Users/matias/develop/code/astor/target/classes:/Users/matias/.m2/repository/fr/inria/gforge/spoon/spoon-core/4.4.1/spoon-core-4.4.1.jar:/Users/matias/.m2/repository/org/eclipse/jdt/org.eclipse.jdt.core/3.12.0.v20150913-1717/org.eclipse.jdt.core-3.12.0.v20150913-1717.jar:/Users/matias/.m2/repository/com/martiansoftware/jsap/2.1/jsap-2.1.jar:/Users/matias/.m2/repository/log4j/log4j/1.2.17/log4j-1.2.17.jar:/Users/matias/.m2/repository/commons-collections/commons-collections/3.2.1/commons-collections-3.2.1.jar:/Users/matias/.m2/repository/commons-io/commons-io/2.4/commons-io-2.4.jar:/Users/matias/.m2/repository/com/gzoltar/gzoltar/0.1.1/gzoltar-0.1.1.jar:/Users/matias/.m2/repository/junit/junit/4.11/junit-4.11.jar:/Users/matias/.m2/repository/org/hamcrest/hamcrest-core/1.3/hamcrest-core-1.3.jar:/Users/matias/.m2/repository/commons-cli/commons-cli/1.2/commons-cli-1.2.jar:/Users/matias/develop/Eclipse.app/Contents/Eclipse/configuration/org.eclipse.osgi/214/0/.cp/:/Users/matias/develop/Eclipse.app/Contents/Eclipse/configuration/org.eclipse.osgi/213/0/.cp/:/Users/matias/develop/code/astor/./examples/libs/junit-4.4.jar:/Users/matias/develop/code/astor/./outputMutation/math_70_spooned/bin/default/:/Users/matias/develop/wsastor/testES/libs/evosuite-1.0.3.jar:" + + "/Users/matias/develop/code/astor/target/test-classes" + File.pathSeparator + + "/Users/matias/develop/code/astor/target/classes" + File.pathSeparator + + "/Users/matias/.m2/repository/fr/inria/gforge/spoon/spoon-core/4.4.1/spoon-core-4.4.1.jar" + + File.pathSeparator + + "/Users/matias/.m2/repository/org/eclipse/jdt/org.eclipse.jdt.core/3.12.0.v20150913-1717/org.eclipse.jdt.core-3.12.0.v20150913-1717.jar" + + File.pathSeparator + "/Users/matias/.m2/repository/com/martiansoftware/jsap/2.1/jsap-2.1.jar" + + File.pathSeparator + "/Users/matias/.m2/repository/log4j/log4j/1.2.17/log4j-1.2.17.jar" + + File.pathSeparator + + "/Users/matias/.m2/repository/commons-collections/commons-collections/3.2.1/commons-collections-3.2.1.jar" + + File.pathSeparator + + "/Users/matias/.m2/repository/commons-io/commons-io/2.4/commons-io-2.4.jar" + + File.pathSeparator + + "/Users/matias/.m2/repository/com/gzoltar/gzoltar/0.1.1/gzoltar-0.1.1.jar" + + File.pathSeparator + "/Users/matias/.m2/repository/junit/junit/4.11/junit-4.11.jar" + + File.pathSeparator + + "/Users/matias/.m2/repository/org/hamcrest/hamcrest-core/1.3/hamcrest-core-1.3.jar" + + File.pathSeparator + + "/Users/matias/.m2/repository/commons-cli/commons-cli/1.2/commons-cli-1.2.jar" + + File.pathSeparator + + "/Users/matias/develop/Eclipse.app/Contents/Eclipse/configuration/org.eclipse.osgi/214/0/.cp/" + + File.pathSeparator + + "/Users/matias/develop/Eclipse.app/Contents/Eclipse/configuration/org.eclipse.osgi/213/0/.cp/" + + File.pathSeparator + "/Users/matias/develop/code/astor/./examples/libs/junit-4.4.jar" + + File.pathSeparator + + "/Users/matias/develop/code/astor/./outputMutation/math_70_spooned/bin/default/" + + File.pathSeparator + "/Users/matias/develop/wsastor/testES/libs/evosuite-1.0.3.jar" + + File.pathSeparator + "" // TestGenerated by Evosuite - + "/Users/matias/develop/code/astor/outputMutation/math_70_spooned/bin/evosuite/evosuite-tests/: " + + "/Users/matias/develop/code/astor/outputMutation/math_70_spooned/bin/evosuite/evosuite-tests/" + + File.pathSeparator + " " // jUnit and arguments + "fr.inria.astor.junitexec.JUnitTestExecutor org.apache.commons.math.analysis.solvers.BisectionSolver_ESTest"; System.out.println("Running "); @@ -518,7 +545,7 @@ public void testNonDeterministimsMath70WithEvosuiteTests() throws Exception { "/target/classes", "-bintestfolder", "/target/test-classes", "-javacompliancelevel", "7", "-flthreshold", "0.5", "-out", out.getAbsolutePath(), "-scope", "package", "-seed", "10", "-maxgen", "250", "-population", "1", "-stopfirst", "true", "-maxtime", "100", "-validation", "evosuite", - "-parameters", "overridemaxtime:false" + "-parameters", "overridemaxtime" + File.pathSeparator + "false" }; System.out.println(Arrays.toString(args)); @@ -556,4 +583,4 @@ public void testNonDeterministimsMath70WithEvosuiteTests() throws Exception { } } -} +} \ No newline at end of file diff --git a/src/test/java/fr/inria/astor/test/repair/approaches/ExhaustiveAstorTest.java b/src/test/java/fr/inria/astor/test/repair/approaches/ExhaustiveAstorTest.java index 90d92c7b2..890be1da2 100644 --- a/src/test/java/fr/inria/astor/test/repair/approaches/ExhaustiveAstorTest.java +++ b/src/test/java/fr/inria/astor/test/repair/approaches/ExhaustiveAstorTest.java @@ -108,9 +108,10 @@ public void testExhaustiveTibraMath70LocalSolutionAssertPatch() throws Exception "-scope", "package", "-seed", "10", "-maxgen", "10000", "-stopfirst", "false", // "-maxtime", "100", "-loglevel", "INFO", // For excluding regression - "-excludeRegression", "-parameters", "maxCombinationVariableLimit:true" - // reduced search space - + ":maxVarCombination:1" + ":ingredienttransformstrategy:" + "-excludeRegression", "-parameters", "maxCombinationVariableLimit" + File.pathSeparator + "true" + // reduced search space + + "" + File.pathSeparator + "maxVarCombination" + File.pathSeparator + "1" + "" + + File.pathSeparator + "ingredienttransformstrategy" + File.pathSeparator + "" + RandomTransformationStrategy.class.getCanonicalName() }; @@ -250,7 +251,9 @@ public void testExhaustiveCloneMath70LocalSolution() throws Exception { File out = new File(ConfigurationProperties.getProperty("workingDirectory")); String[] args = new String[] { "-dependencies", dep, "-mode", "custom", "-customengine", DeepRepairExhausitiveCloneEngine.class.getCanonicalName(), ExtensionPoints.REPAIR_OPERATORS.argument(), - "fr.inria.astor.approaches.jgenprog.operators.InsertAfterOp:fr.inria.astor.approaches.jgenprog.operators.InsertBeforeOp:fr.inria.astor.approaches.jgenprog.operators.ReplaceOp", + "fr.inria.astor.approaches.jgenprog.operators.InsertAfterOp" + File.pathSeparator + + "fr.inria.astor.approaches.jgenprog.operators.InsertBeforeOp" + File.pathSeparator + + "fr.inria.astor.approaches.jgenprog.operators.ReplaceOp", "-failing", "org.apache.commons.math.analysis.solvers.BisectionSolverTest", "-location", new File("./examples/math_70").getAbsolutePath(), "-package", "org.apache.commons", "-srcjavafolder", @@ -294,4 +297,4 @@ public void testExhaustiveCloneMath70LocalSolution() throws Exception { } -} +} \ No newline at end of file diff --git a/src/test/java/fr/inria/astor/test/repair/approaches/JGenProgEvolutionaryTest.java b/src/test/java/fr/inria/astor/test/repair/approaches/JGenProgEvolutionaryTest.java index ee6121d21..39c0ffbf0 100644 --- a/src/test/java/fr/inria/astor/test/repair/approaches/JGenProgEvolutionaryTest.java +++ b/src/test/java/fr/inria/astor/test/repair/approaches/JGenProgEvolutionaryTest.java @@ -44,7 +44,8 @@ public void testMath70PackageSolutionsEvolving() throws Exception { "-population", "1", "-reintroduce", PopulationConformation.PARENTS.toString() + File.pathSeparator + PopulationConformation.SOLUTIONS.toString(), // Parameters: - "-parameters", "maxnumbersolutions:3:ignoredTestCases:org.apache.commons.math.estimation.MinpackTest" + "-parameters", "maxnumbersolutions" + File.pathSeparator + "3" + File.pathSeparator + "ignoredTestCases" + + File.pathSeparator + "org.apache.commons.math.estimation.MinpackTest" }; System.out.println(Arrays.toString(args)); @@ -60,4 +61,4 @@ public void testMath70PackageSolutionsEvolving() throws Exception { assertTrue(withMultiple); } -} +} \ No newline at end of file diff --git a/src/test/java/fr/inria/astor/test/repair/approaches/JGenProgTest.java b/src/test/java/fr/inria/astor/test/repair/approaches/JGenProgTest.java index 913767b40..d520a5fcf 100644 --- a/src/test/java/fr/inria/astor/test/repair/approaches/JGenProgTest.java +++ b/src/test/java/fr/inria/astor/test/repair/approaches/JGenProgTest.java @@ -141,7 +141,7 @@ public void testMath70ThisKeyword() throws Exception { cs.command.put("-stopfirst", "true"); cs.command.put("-loglevel", "INFO"); cs.command.put("-saveall", "true"); - cs.append("-parameters", ("logtestexecution:true")); + cs.append("-parameters", ("logtestexecution" + File.pathSeparator + "true")); System.out.println(Arrays.toString(cs.flat())); main1.execute(cs.flat()); @@ -198,7 +198,8 @@ public static String[] commandMath70(String dep, File out, int generations) { "/src/main/java/", "-srctestfolder", "/src/test/java", "-binjavafolder", "/target/classes", "-bintestfolder", "/target/test-classes", "-javacompliancelevel", "7", "-flthreshold", "0.5", "-out", out.getAbsolutePath(), "-scope", "local", "-seed", "10", "-maxgen", Integer.toString(generations), - "-stopfirst", "true", "-maxtime", "5", "-loglevel", "INFO", "-parameters", "disablelog:false" + "-stopfirst", "true", "-maxtime", "5", "-loglevel", "INFO", "-parameters", + "disablelog" + File.pathSeparator + "false" }; return args; @@ -373,7 +374,7 @@ public void testMath5_buggy() throws Exception { // "-javacompliancelevel", "6", - "-parameters", "maxmodificationpoints:1" + "-parameters", "maxmodificationpoints" + File.pathSeparator + "1" }; main1.execute(args); @@ -440,8 +441,9 @@ public void testMath70DiffOfSolution() throws Exception { CommandSummary cs = MathCommandsTests.getMath70Command(); cs.command.put("-stopfirst", "true"); cs.command.put("-parameters", - "logtestexecution:true:ignoredTestCases:org.apache.commons.math.estimation.MinpackTest:" + "maxmemory" - + File.pathSeparator + "-Xmx4G"); + "logtestexecution" + File.pathSeparator + "true" + File.pathSeparator + "ignoredTestCases" + + File.pathSeparator + "org.apache.commons.math.estimation.MinpackTest" + File.pathSeparator + + "" + "maxmemory" + File.pathSeparator + "-Xmx4G"); // testMinpackMeyer(org.apache.commons.math.estimation.MinpackTest) @@ -523,11 +525,11 @@ public void testMath70StopAtXVariantsSolution() throws Exception { // "-scope", "package", "-seed", "10", "-maxgen", "10000", "-stopfirst", "false", "-maxtime", "10", "-population", "1", "-reintroduce", PopulationConformation.PARENTS.toString(), "-parameters", - "maxnumbersolutions:2" }; + "maxnumbersolutions" + File.pathSeparator + "2" }; System.out.println(Arrays.toString(args)); CommandSummary command = new CommandSummary(args); - command.command.put("-parameters", "maxnumbersolutions:2"); + command.command.put("-parameters", "maxnumbersolutions" + File.pathSeparator + "2"); main1.execute(command.flat()); List solutions = main1.getEngine().getSolutions(); @@ -536,7 +538,7 @@ public void testMath70StopAtXVariantsSolution() throws Exception { assertTrue(existPatchWithCode(solutions, "return solve(f, min, max)") || existPatchWithCode(solutions, "return solve(f, initial, max)")); - command.command.put("-parameters", "maxnumbersolutions:1"); + command.command.put("-parameters", "maxnumbersolutions" + File.pathSeparator + "1"); main1.execute(command.flat()); solutions = main1.getEngine().getSolutions(); @@ -566,7 +568,7 @@ public void testMath70FixedFL() throws Exception { System.out.println(Arrays.toString(args)); CommandSummary command = new CommandSummary(args); - command.command.put("-parameters", "fixedLocation:BisectionSolver-72"); + command.command.put("-parameters", "fixedLocation" + File.pathSeparator + "BisectionSolver-72"); main1.execute(command.flat()); List solutions = main1.getEngine().getSolutions(); @@ -601,7 +603,9 @@ public void testMath70Perfect() throws Exception { fw.write("return solve(f, min, max)"); fw.close(); command.command.put("-parameters", - "fixedLocation:BisectionSolver-72:" + "peOperator:replace:pefile:" + f.getAbsolutePath()); + "fixedLocation" + File.pathSeparator + "BisectionSolver-72" + File.pathSeparator + "" + "peOperator" + + File.pathSeparator + "replace" + File.pathSeparator + "pefile" + File.pathSeparator + "" + + f.getAbsolutePath()); main1.execute(command.flat()); List solutions = main1.getEngine().getSolutions(); @@ -720,4 +724,4 @@ public void testMath28() throws Exception { assertTrue(variants.size() > 0); } -} +} \ No newline at end of file diff --git a/src/test/java/fr/inria/astor/test/repair/approaches/TibraApproachTest.java b/src/test/java/fr/inria/astor/test/repair/approaches/TibraApproachTest.java index fbfc67c12..68d18a506 100644 --- a/src/test/java/fr/inria/astor/test/repair/approaches/TibraApproachTest.java +++ b/src/test/java/fr/inria/astor/test/repair/approaches/TibraApproachTest.java @@ -3,6 +3,7 @@ import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertTrue; +import java.io.File; import java.util.Arrays; import java.util.List; @@ -37,7 +38,7 @@ public void testTimbraMath70() throws Exception { cs.command.put("-mode", "custom"); cs.command.put("-saveall", "true"); cs.command.put("-customengine", TibraApproach.class.getCanonicalName()); - cs.command.put("-parameters", "desactivateingredientcache:true"); + cs.command.put("-parameters", "desactivateingredientcache" + File.pathSeparator + "true"); System.out.println(Arrays.toString(cs.flat())); main1.execute(cs.flat()); @@ -46,4 +47,4 @@ public void testTimbraMath70() throws Exception { assertTrue(solutions.size() > 0); assertEquals(1, solutions.size()); } -} +} \ No newline at end of file diff --git a/src/test/java/fr/inria/astor/test/repair/approaches/cardumen/CardumenApproachTest.java b/src/test/java/fr/inria/astor/test/repair/approaches/cardumen/CardumenApproachTest.java index b79dd9060..584913236 100644 --- a/src/test/java/fr/inria/astor/test/repair/approaches/cardumen/CardumenApproachTest.java +++ b/src/test/java/fr/inria/astor/test/repair/approaches/cardumen/CardumenApproachTest.java @@ -322,9 +322,9 @@ public void testCardumentM70TransformationBugSameCombination() throws Exception command.command.put("-maxgen", "0"); command.command.put("-population", "1"); command.command.put("-scope", scope.toString().toLowerCase()); - command.command.put("-parameters", "disablelog:true"); + command.command.put("-parameters", "disablelog" + File.pathSeparator + "true"); int maxCombinations = 30000; - command.command.put("-parameters", "maxVarCombination:" + maxCombinations + ":disablelog:true"); + command.command.put("-parameters", "maxVarCombination" + File.pathSeparator + "" + maxCombinations + "" + File.pathSeparator + "disablelog" + File.pathSeparator + "true"); AstorMain main1 = new AstorMain(); main1.execute(command.flat()); @@ -380,9 +380,9 @@ public void testCardumentM70TransformationBugSameCombination2() throws Exception command.command.put("-maxgen", "0"); command.command.put("-population", "1"); command.command.put("-scope", scope.toString().toLowerCase()); - command.command.put("-parameters", "disablelog:true"); + command.command.put("-parameters", "disablelog" + File.pathSeparator + "true"); int maxCombinations = 30000; - command.command.put("-parameters", "maxVarCombination:" + maxCombinations + ":disablelog:true"); + command.command.put("-parameters", "maxVarCombination" + File.pathSeparator + "" + maxCombinations + "" + File.pathSeparator + "disablelog" + File.pathSeparator + "true"); AstorMain main1 = new AstorMain(); main1.execute(command.flat()); @@ -451,7 +451,7 @@ public void testCardumentLang7NPE() throws Exception { command.command.put("-dependencies", dep); command.command.put("-loglevel", "INFO"); command.command.put("-location", new File("./examples/lang_7").getAbsolutePath()); - command.command.put("-parameters", "maxCombinationVariableLimit:true"); + command.command.put("-parameters", "maxCombinationVariableLimit" + File.pathSeparator + "true"); AstorMain main1 = new AstorMain(); main1.execute(command.flat()); @@ -474,7 +474,7 @@ public void testCardumentM70bugHEAP() throws Exception { command.command.put("-population", "1"); command.command.put("-scope", scope.toString().toLowerCase()); int maxCombinations = 3000; - command.command.put("-parameters", "maxVarCombination:" + maxCombinations + ":disablelog:true"); + command.command.put("-parameters", "maxVarCombination" + File.pathSeparator + "" + maxCombinations + "" + File.pathSeparator + "disablelog" + File.pathSeparator + "true"); AstorMain main1 = new AstorMain(); main1.execute(command.flat()); @@ -704,7 +704,7 @@ public void testCardumentM70Evolve() throws Exception { command.command.put("-maxgen", "200"); command.command.put("-population", "1"); command.command.put("-scope", scope.toString().toLowerCase()); - command.command.put("-parameters", "disablelog:false"); + command.command.put("-parameters", "disablelog" + File.pathSeparator + "false"); command.command.put("-maxVarCombination", "100"); AstorMain main1 = new AstorMain(); @@ -766,7 +766,7 @@ public void testCardumentM70EvolveNotUniformreplacement() throws Exception { command.command.put("-maxgen", "100"); command.command.put("-scope", scope.toString().toLowerCase()); command.command.put("-parameters", - "limitbysuspicious:false:" + "disablelog:true:uniformreplacement:false:frequenttemplate:true"); + "limitbysuspicious" + File.pathSeparator + "false" + File.pathSeparator + "" + "disablelog" + File.pathSeparator + "true" + File.pathSeparator + "uniformreplacement" + File.pathSeparator + "false" + File.pathSeparator + "frequenttemplate" + File.pathSeparator + "true"); command.command.put("-loglevel", Level.INFO.toString()); command.command.put("-maxVarCombination", "1000"); command.command.put("-stopfirst", "false"); @@ -795,7 +795,7 @@ public void testCardumentM70EvolveUniformreplacement() throws Exception { command.command.put("-maxgen", "200"); command.command.put("-population", "1"); command.command.put("-scope", scope.toString().toLowerCase()); - command.command.put("-parameters", "disablelog:true:uniformreplacement:true"); + command.command.put("-parameters", "disablelog" + File.pathSeparator + "true" + File.pathSeparator + "uniformreplacement" + File.pathSeparator + "true"); AstorMain main1 = new AstorMain(); main1.execute(command.flat()); @@ -829,7 +829,7 @@ public void testCardumentM70EvolveUniformreplacementMostUsedTemplate() throws Ex command.command.put("-population", "1"); command.command.put("-scope", scope.toString().toLowerCase()); command.command.put("-stopfirst", "false"); - command.command.put("-parameters", "disablelog:true:uniformreplacement:true:frequenttemplate:true"); + command.command.put("-parameters", "disablelog" + File.pathSeparator + "true" + File.pathSeparator + "uniformreplacement" + File.pathSeparator + "true" + File.pathSeparator + "frequenttemplate" + File.pathSeparator + "true"); AstorMain main1 = new AstorMain(); main1.execute(command.flat()); @@ -861,7 +861,7 @@ public void testCardumentM70Suspicious() throws Exception { command.command.put("-population", "1"); command.command.put("-scope", scope.toString().toLowerCase()); command.command.put("-stopfirst", "false"); - command.command.put("-parameters", "disablelog:true:uniformreplacement:true:frequenttemplate:true"); + command.command.put("-parameters", "disablelog" + File.pathSeparator + "true" + File.pathSeparator + "uniformreplacement" + File.pathSeparator + "true" + File.pathSeparator + "frequenttemplate" + File.pathSeparator + "true"); AstorMain main1 = new AstorMain(); main1.execute(command.flat()); @@ -885,7 +885,7 @@ public void testCardumentM70Suspicious() throws Exception { maxsusp = 100; command.command.put("-maxsuspcandidates", maxsusp.toString()); command.command.put("-flthreshold", "0.000000001"); - command.command.put("-parameters", "limitbysuspicious:false"); + command.command.put("-parameters", "limitbysuspicious" + File.pathSeparator + "false"); main1.execute(command.flat()); @@ -910,7 +910,7 @@ public void testCardumentM70AssertStats() throws Exception { command.command.put("-scope", scope.toString().toLowerCase()); command.command.put("-stopfirst", "false"); command.command.put("-loglevel", "INFO"); - command.command.put("-parameters", "disablelog:true:uniformreplacement:true:frequenttemplate:true"); + command.command.put("-parameters", "disablelog" + File.pathSeparator + "true" + File.pathSeparator + "uniformreplacement" + File.pathSeparator + "true" + File.pathSeparator + "frequenttemplate" + File.pathSeparator + "true"); AstorMain main1 = new AstorMain(); main1.execute(command.flat()); @@ -1152,7 +1152,7 @@ public void testCardumentM70MaxModPoints() throws Exception { command.command.put("-customengine", CardumenExhaustiveEngine4Stats.class.getCanonicalName()); command.command.put("-scope", scope.toString().toLowerCase()); command.command.put("-parameters", - "maxmodificationpoints:" + maxModPoints + ":skipfitnessinitialpopulation:true:limitbysuspicious:false"); + "maxmodificationpoints" + File.pathSeparator + "" + maxModPoints + "" + File.pathSeparator + "skipfitnessinitialpopulation" + File.pathSeparator + "true" + File.pathSeparator + "limitbysuspicious" + File.pathSeparator + "false"); command.command.put("-loglevel", Level.INFO.toString()); AstorMain main1 = new AstorMain(); @@ -1175,8 +1175,8 @@ public void testCardumentM42() throws Exception { command.command.put("-population", "1"); command.command.put("-customengine", CardumenExhaustiveEngine4Stats.class.getCanonicalName()); command.command.put("-scope", scope.toString().toLowerCase()); - command.command.put("-parameters", "skipfitnessinitialpopulation:true:limitbysuspicious:false:" - + "disablelog:false:uniformreplacement:" + Boolean.toString(uniformreplacement)); + command.command.put("-parameters", "skipfitnessinitialpopulation" + File.pathSeparator + "true" + File.pathSeparator + "limitbysuspicious" + File.pathSeparator + "false" + File.pathSeparator + "" + + "disablelog" + File.pathSeparator + "false" + File.pathSeparator + "uniformreplacement" + File.pathSeparator + "" + Boolean.toString(uniformreplacement)); command.command.put("-loglevel", Level.INFO.toString()); AstorMain main1 = new AstorMain(); @@ -1198,7 +1198,7 @@ public void testCardumentM70ScopeLocalProbTransformation() throws Exception { command.command.put("-maxgen", "0"); command.command.put("-population", "1"); command.command.put("-scope", scope.toString().toLowerCase()); - command.command.put("-parameters", "probabilistictransformation:true"); + command.command.put("-parameters", "probabilistictransformation" + File.pathSeparator + "true"); AstorMain main1 = new AstorMain(); main1.execute(command.flat()); @@ -1253,7 +1253,7 @@ public void testCardumentM70ScopeLocalRandomTransformation() throws Exception { command.command.put("-population", "1"); command.command.put("-scope", scope.toString().toLowerCase()); // RANDOM - command.command.put("-parameters", "probabilistictransformation:false"); + command.command.put("-parameters", "probabilistictransformation" + File.pathSeparator + "false"); AstorMain main1 = new AstorMain(); main1.execute(command.flat()); @@ -1321,4 +1321,4 @@ public void testCardumentM57() throws Exception { } -} +} \ No newline at end of file diff --git a/src/test/java/fr/inria/astor/test/repair/approaches/cardumen/CardumenExahustiveTest.java b/src/test/java/fr/inria/astor/test/repair/approaches/cardumen/CardumenExahustiveTest.java index 3d27fcf15..4675c7059 100644 --- a/src/test/java/fr/inria/astor/test/repair/approaches/cardumen/CardumenExahustiveTest.java +++ b/src/test/java/fr/inria/astor/test/repair/approaches/cardumen/CardumenExahustiveTest.java @@ -4,6 +4,7 @@ import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertTrue; +import java.io.File; import java.util.List; import org.apache.log4j.Level; @@ -46,8 +47,8 @@ public void testCardumentM70ExhausitveComplete() throws Exception { command.command.put("-customengine", CardumenExhaustiveApproach.class.getCanonicalName()); command.command.put("-scope", scope.toString().toLowerCase()); int maxSol = 7; - command.command.put("-parameters", "limitbysuspicious:false:" + "disablelog:false:uniformreplacement:false:" - + "frequenttemplate:false:" + "maxnumbersolutions:" + maxSol); + command.command.put("-parameters", "limitbysuspicious" + File.pathSeparator + "false" + File.pathSeparator + "" + "disablelog" + File.pathSeparator + "false" + File.pathSeparator + "uniformreplacement" + File.pathSeparator + "false" + File.pathSeparator + "" + + "frequenttemplate" + File.pathSeparator + "false" + File.pathSeparator + "" + "maxnumbersolutions" + File.pathSeparator + "" + maxSol); command.command.put("-loglevel", Level.INFO.toString()); command.command.put("-maxVarCombination", "1000"); @@ -81,16 +82,16 @@ public void testCardumentM70Exhausitve() throws Exception { command.command.put("-maxtime", "60"); command.command.put("-population", "1"); command.command.put("-customengine", CardumenExhaustiveEngine4Stats.class.getCanonicalName()); - command.command.put("-parameters", "includeZeros:true:scope:" + scope.toString().toLowerCase() - + "scope:limitbysuspicious:false:" + "disablelog:true:uniformreplacement:false:frequenttemplate:true"); + command.command.put("-parameters", "includeZeros" + File.pathSeparator + "true" + File.pathSeparator + "scope" + File.pathSeparator + "" + scope.toString().toLowerCase() + + "scope" + File.pathSeparator + "limitbysuspicious" + File.pathSeparator + "false" + File.pathSeparator + "" + "disablelog" + File.pathSeparator + "true" + File.pathSeparator + "uniformreplacement" + File.pathSeparator + "false" + File.pathSeparator + "frequenttemplate" + File.pathSeparator + "true"); command.command.put("-loglevel", Level.INFO.toString()); command.command.put("-maxVarCombination", "100000000"); AstorMain main1 = new AstorMain(); log.debug("LOCAL SCOPE"); // Local - command.command.put("-parameters", "includeZeros:false:scope:local" + ":limitbysuspicious:false:" - + "disablelog:true:uniformreplacement:false:frequenttemplate:true"); + command.command.put("-parameters", "includeZeros" + File.pathSeparator + "false" + File.pathSeparator + "scope" + File.pathSeparator + "local" + "" + File.pathSeparator + "limitbysuspicious" + File.pathSeparator + "false" + File.pathSeparator + "" + + "disablelog" + File.pathSeparator + "true" + File.pathSeparator + "uniformreplacement" + File.pathSeparator + "false" + File.pathSeparator + "frequenttemplate" + File.pathSeparator + "true"); main1 = new AstorMain(); main1.execute(command.flat()); @@ -101,8 +102,8 @@ public void testCardumentM70Exhausitve() throws Exception { log.debug("PACKAGE SCOPE"); // PACKAGE - command.command.put("-parameters", "includeZeros:false:scope:package" + ":limitbysuspicious:false:" - + "disablelog:true:uniformreplacement:false:frequenttemplate:true"); + command.command.put("-parameters", "includeZeros" + File.pathSeparator + "false" + File.pathSeparator + "scope" + File.pathSeparator + "package" + "" + File.pathSeparator + "limitbysuspicious" + File.pathSeparator + "false" + File.pathSeparator + "" + + "disablelog" + File.pathSeparator + "true" + File.pathSeparator + "uniformreplacement" + File.pathSeparator + "false" + File.pathSeparator + "frequenttemplate" + File.pathSeparator + "true"); main1 = new AstorMain(); main1.execute(command.flat()); @@ -125,7 +126,7 @@ public void testCardumentM70ExhausitveMaxLimited() throws Exception { command.command.put("-customengine", CardumenExhaustiveEngine4Stats.class.getCanonicalName()); command.command.put("-scope", scope.toString().toLowerCase()); command.command.put("-parameters", - "limitbysuspicious:false:" + "disablelog:true:uniformreplacement:false:frequenttemplate:true"); + "limitbysuspicious" + File.pathSeparator + "false" + File.pathSeparator + "" + "disablelog" + File.pathSeparator + "true" + File.pathSeparator + "uniformreplacement" + File.pathSeparator + "false" + File.pathSeparator + "frequenttemplate" + File.pathSeparator + "true"); command.command.put("-loglevel", Level.INFO.toString()); command.command.put("-maxVarCombination", "1000"); @@ -154,8 +155,8 @@ public void testCardumentM70ExhausitveMaxSuspiciousLimited() throws Exception { command.command.put("-population", "1"); command.command.put("-customengine", CardumenExhaustiveEngine4Stats.class.getCanonicalName()); command.command.put("-scope", scope.toString().toLowerCase()); - command.command.put("-parameters", "skipfitnessinitialpopulation:true:limitbysuspicious:false:" - + "disablelog:false:uniformreplacement:false:frequenttemplate:false"); + command.command.put("-parameters", "skipfitnessinitialpopulation" + File.pathSeparator + "true" + File.pathSeparator + "limitbysuspicious" + File.pathSeparator + "false" + File.pathSeparator + "" + + "disablelog" + File.pathSeparator + "false" + File.pathSeparator + "uniformreplacement" + File.pathSeparator + "false" + File.pathSeparator + "frequenttemplate" + File.pathSeparator + "false"); command.command.put("-loglevel", Level.INFO.toString()); command.command.put("-maxVarCombination", "100"); command.command.put("-maxsuspcandidates", "1000"); @@ -191,8 +192,8 @@ public void testCardumentM70ExhausitveReplacement() throws Exception { command.command.put("-population", "1"); command.command.put("-customengine", CardumenExhaustiveEngine4Stats.class.getCanonicalName()); command.command.put("-scope", scope.toString().toLowerCase()); - command.command.put("-parameters", "skipfitnessinitialpopulation:true:limitbysuspicious:false:" - + "disablelog:false:uniformreplacement:" + Boolean.toString(uniformreplacement)); + command.command.put("-parameters", "skipfitnessinitialpopulation" + File.pathSeparator + "true" + File.pathSeparator + "limitbysuspicious" + File.pathSeparator + "false" + File.pathSeparator + "" + + "disablelog" + File.pathSeparator + "false" + File.pathSeparator + "uniformreplacement" + File.pathSeparator + "" + Boolean.toString(uniformreplacement)); command.command.put("-loglevel", Level.INFO.toString()); AstorMain main1 = new AstorMain(); @@ -210,8 +211,8 @@ public void testCardumentM70ExhausitveReplacement() throws Exception { uniformreplacement = true; - command.command.put("-parameters", "skipfitnessinitialpopulation:true:limitbysuspicious:false:" - + "disablelog:false:uniformreplacement:" + Boolean.toString(uniformreplacement)); + command.command.put("-parameters", "skipfitnessinitialpopulation" + File.pathSeparator + "true" + File.pathSeparator + "limitbysuspicious" + File.pathSeparator + "false" + File.pathSeparator + "" + + "disablelog" + File.pathSeparator + "false" + File.pathSeparator + "uniformreplacement" + File.pathSeparator + "" + Boolean.toString(uniformreplacement)); cardumen = null; main1.execute(command.flat()); @@ -226,4 +227,4 @@ public void testCardumentM70ExhausitveReplacement() throws Exception { assertTrue(tingNotUnifall + " > " + tingUnifall, tingNotUnifall > tingUnifall); } -} +} \ No newline at end of file diff --git a/src/test/java/fr/inria/astor/test/repair/core/OutputTest.java b/src/test/java/fr/inria/astor/test/repair/core/OutputTest.java index 3bf0f7eea..433524184 100644 --- a/src/test/java/fr/inria/astor/test/repair/core/OutputTest.java +++ b/src/test/java/fr/inria/astor/test/repair/core/OutputTest.java @@ -60,9 +60,9 @@ public void testMath70LogFileInfoLevel() throws Exception { cs.command.put("-scope", "package"); cs.command.put("-loglevel", "INFO"); cs.command.put("-maxgen", "500"); - cs.command.put("-parameters", "disablelog:false"); + cs.command.put("-parameters", "disablelog" + File.pathSeparator + "false"); File fileLog = File.createTempFile("logTest", ".log"); - cs.append("-parameters", "logfilepath:" + fileLog.getAbsolutePath()); + cs.append("-parameters", "logfilepath" + File.pathSeparator + "" + fileLog.getAbsolutePath()); assertEquals(4, cs.command.get("-parameters").split(File.pathSeparator).length); System.out.println(Arrays.toString(cs.flat())); @@ -154,7 +154,7 @@ public void testExtPoint2Outputs() throws Exception { cs.command.put("-stopfirst", "true"); cs.command.put("-outputresult", PatchJSONStandarOutput.class.getCanonicalName() + "|" + StandardOutputReport.class.getCanonicalName()); - cs.command.put("-parameters", "outputjsonresult:true"); + cs.command.put("-parameters", "outputjsonresult" + File.pathSeparator + "true"); System.out.println(Arrays.toString(cs.flat())); main1.execute(cs.flat()); @@ -211,9 +211,9 @@ public void testMath70LogFile() throws Exception { cs.command.put("-scope", "package"); cs.command.put("-loglevel", Level.DEBUG.toString()); - cs.command.put("-parameters", "disablelog:false"); + cs.command.put("-parameters", "disablelog" + File.pathSeparator + "false"); File fileLog = File.createTempFile("logTest", ".log"); - cs.append("-parameters", "logfilepath:" + fileLog.getAbsolutePath()); + cs.append("-parameters", "logfilepath" + File.pathSeparator + "" + fileLog.getAbsolutePath()); assertEquals(4, cs.command.get("-parameters").split(File.pathSeparator).length); System.out.println(Arrays.toString(cs.flat())); @@ -267,7 +267,7 @@ public void testMath70Path() throws Exception { CommandSummary cs = MathCommandsTests.getMath70Command(); cs.command.put("-stopfirst", "true"); - cs.command.put("-parameters", "parsesourcefromoriginal:true"); + cs.command.put("-parameters", "parsesourcefromoriginal" + File.pathSeparator + "true"); cs.command.put("-loglevel", "DEBUG"); System.out.println(Arrays.toString(cs.flat())); @@ -326,7 +326,7 @@ public void testMath70Identifier() throws Exception { "-bintestfolder", new File("./examples/math_70").getAbsolutePath() + "/target/test-classes", // "-javacompliancelevel", "7", "-flthreshold", "0.5", "-out", out.getAbsolutePath(), "-scope", "local", "-seed", "10", "-maxgen", Integer.toString(generations), "-stopfirst", "true", "-maxtime", "100", - "-loglevel", "INFO", "-parameters", "disablelog:false" + "-loglevel", "INFO", "-parameters", "disablelog" + File.pathSeparator + "false" }; @@ -358,4 +358,4 @@ public void testMath70Identifier() throws Exception { assertEquals(id, retrievedId); } -} +} \ No newline at end of file diff --git a/src/test/java/fr/inria/astor/test/repair/core/PatchDiffTest.java b/src/test/java/fr/inria/astor/test/repair/core/PatchDiffTest.java index ad3a398c9..475873316 100644 --- a/src/test/java/fr/inria/astor/test/repair/core/PatchDiffTest.java +++ b/src/test/java/fr/inria/astor/test/repair/core/PatchDiffTest.java @@ -7,6 +7,7 @@ import java.io.File; import java.util.Arrays; import java.util.List; +import java.util.regex.Pattern; import org.junit.Before; import org.junit.Test; @@ -35,7 +36,10 @@ public void testMath70Diff_default() throws Exception { CommandSummary cs = MathCommandsTests.getMath70Command(); cs.command.put("-stopfirst", "true"); - cs.command.put("-parameters", "savesolution:false:" + "preservelinenumbers:false" + ":diff_type:default"); + cs.command.put("-parameters", + "savesolution" + File.pathSeparator + "false" + File.pathSeparator + "" + "preservelinenumbers" + + File.pathSeparator + "false" + "" + File.pathSeparator + "diff_type" + File.pathSeparator + + "default"); System.out.println(Arrays.toString(cs.flat())); main1.execute(cs.flat()); @@ -54,8 +58,12 @@ public void testMath70Diff_default() throws Exception { String diff2 = variant.getPatchDiff().getOriginalStatementAlignmentDiff(); System.out.println("Patch original alignment: \n" + diff2); assertTrue(diff2.contains("return solve(f, min, max)")); - assertTrue(diff2.startsWith("--- org/apache/commons/math/analysis/solvers/BisectionSolver.java")); - assertTrue(diff2.contains("+++ org/apache/commons/math/analysis/solvers/BisectionSolver.java")); + assertTrue(diff2.startsWith("--- org" + File.separator + "apache" + File.separator + "commons" + File.separator + + "math" + File.separator + "analysis" + File.separator + "solvers" + File.separator + + "BisectionSolver.java")); + assertTrue(diff2.contains("+++ org" + File.separator + "apache" + File.separator + "commons" + File.separator + + "math" + File.separator + "analysis" + File.separator + "solvers" + File.separator + + "BisectionSolver.java")); String path_o = main1.getEngine().getProjectFacade().getInDirWithPrefix(variant.currentMutatorIdentifier()); assertTrue(new File(path_o + File.separator + PatchDiffCalculator.PATCH_DIFF_FILE_NAME).exists()); @@ -72,7 +80,10 @@ public void testMath70Diff_git() throws Exception { CommandSummary cs = MathCommandsTests.getMath70Command(); cs.command.put("-stopfirst", "true"); - cs.command.put("-parameters", "savesolution:false:" + "preservelinenumbers:true" + ":diff_type:git"); + cs.command.put("-parameters", + "savesolution" + File.pathSeparator + "false" + File.pathSeparator + "" + "preservelinenumbers" + + File.pathSeparator + "true" + "" + File.pathSeparator + "diff_type" + File.pathSeparator + + "git"); System.out.println(Arrays.toString(cs.flat())); main1.execute(cs.flat()); @@ -91,8 +102,12 @@ public void testMath70Diff_git() throws Exception { String diff2 = variant.getPatchDiff().getOriginalStatementAlignmentDiff(); System.out.println("Patch original alignment: \n" + diff2); assertTrue(diff2.contains("return solve(f, min, max)")); - assertTrue(diff2.startsWith("--- a/org/apache/commons/math/analysis/solvers/BisectionSolver.java")); - assertTrue(diff2.contains("+++ b/org/apache/commons/math/analysis/solvers/BisectionSolver.java")); + assertTrue(diff2.startsWith("--- a" + File.separator + "org" + File.separator + "apache" + File.separator + + "commons" + File.separator + "math" + File.separator + "analysis" + File.separator + "solvers" + + File.separator + "BisectionSolver.java")); + assertTrue(diff2.contains("+++ b" + File.separator + "org" + File.separator + "apache" + File.separator + + "commons" + File.separator + "math" + File.separator + "analysis" + File.separator + "solvers" + + File.separator + "BisectionSolver.java")); String path_o = main1.getEngine().getProjectFacade().getInDirWithPrefix(variant.currentMutatorIdentifier()); assertTrue(new File(path_o + File.separator + PatchDiffCalculator.PATCH_DIFF_FILE_NAME).exists()); @@ -109,7 +124,10 @@ public void testMath70Diff_relative() throws Exception { CommandSummary cs = MathCommandsTests.getMath70Command(); cs.command.put("-stopfirst", "true"); - cs.command.put("-parameters", "savesolution:false:" + "preservelinenumbers:true" + ":diff_type:relative"); + cs.command.put("-parameters", + "savesolution" + File.pathSeparator + "false" + File.pathSeparator + "" + "preservelinenumbers" + + File.pathSeparator + "true" + "" + File.pathSeparator + "diff_type" + File.pathSeparator + + "relative"); System.out.println(Arrays.toString(cs.flat())); main1.execute(cs.flat()); @@ -128,9 +146,18 @@ public void testMath70Diff_relative() throws Exception { String diff2 = variant.getPatchDiff().getOriginalStatementAlignmentDiff(); System.out.println("Patch original alignment: \n" + diff2); assertTrue(diff2.contains("return solve(f, min, max)")); - assertTrue( - diff2.startsWith("--- /src/main/java/org/apache/commons/math/analysis/solvers/BisectionSolver.java")); - assertTrue(diff2.contains("+++ /src/main/java/org/apache/commons/math/analysis/solvers/BisectionSolver.java")); + String envOS = System.getProperty("os.name"); + if (!envOS.contains("Windows")) { + assertTrue(diff2.startsWith("--- /src/main/java/org/apache/commons/math/analysis/solvers/BisectionSolver.java")); + assertTrue(diff2.contains("+++ /src/main/java/org/apache/commons/math/analysis/solvers/BisectionSolver.java")); + } else { + assertTrue(Pattern.compile( + "--- [^\r\n]*\\\\src\\\\main\\\\java\\\\org\\\\apache\\\\commons\\\\math\\\\analysis\\\\solvers\\\\BisectionSolver.java\n.*", + Pattern.DOTALL).matcher(diff2).matches()); + assertTrue(Pattern.compile( + ".*\\+\\+\\+ [^\r\n]*\\\\src\\\\main\\\\java\\\\org\\\\apache\\\\commons\\\\math\\\\analysis\\\\solvers\\\\BisectionSolver.java\n.*", + Pattern.DOTALL).matcher(diff2).matches()); + } String path_o = main1.getEngine().getProjectFacade().getInDirWithPrefix(variant.currentMutatorIdentifier()); assertTrue(new File(path_o + File.separator + PatchDiffCalculator.PATCH_DIFF_FILE_NAME).exists()); @@ -141,4 +168,4 @@ public void testMath70Diff_relative() throws Exception { } -} +} \ No newline at end of file diff --git a/src/test/java/fr/inria/astor/test/repair/core/ValidationTest.java b/src/test/java/fr/inria/astor/test/repair/core/ValidationTest.java index fd01ebc39..057d3c515 100644 --- a/src/test/java/fr/inria/astor/test/repair/core/ValidationTest.java +++ b/src/test/java/fr/inria/astor/test/repair/core/ValidationTest.java @@ -72,8 +72,8 @@ public void testMath70LocalSolutionJUExLog() throws Exception { cs.command.put("-scope", "package"); cs.command.put("-maxgen", "200"); cs.command.put("-loglevel", "INFO"); - cs.command.put("-parameters", "disablelog:false"); - cs.append("-parameters", "logtestexecution:true"); + cs.command.put("-parameters", "disablelog" + File.pathSeparator + "false"); + cs.append("-parameters", "logtestexecution" + File.pathSeparator + "true"); assertEquals(4, cs.command.get("-parameters").split(File.pathSeparator).length); System.out.println(Arrays.toString(cs.flat())); @@ -85,4 +85,4 @@ public void testMath70LocalSolutionJUExLog() throws Exception { } -} +} \ No newline at end of file diff --git a/src/test/java/fr/inria/astor/test/repair/core/solutionsearch/ProgramVariantFactoryTest.java b/src/test/java/fr/inria/astor/test/repair/core/solutionsearch/ProgramVariantFactoryTest.java index 048b003ec..2a1cf20e1 100644 --- a/src/test/java/fr/inria/astor/test/repair/core/solutionsearch/ProgramVariantFactoryTest.java +++ b/src/test/java/fr/inria/astor/test/repair/core/solutionsearch/ProgramVariantFactoryTest.java @@ -10,6 +10,7 @@ import spoon.reflect.cu.SourcePosition; import spoon.reflect.cu.position.NoSourcePosition; +import java.io.File; import java.util.List; import java.util.stream.Collectors; @@ -30,7 +31,8 @@ public void testProgramVariantFactory() throws Exception { command.command.put("-maxgen", "0"); command.command.put("-population", "1"); command.command.put("-scope", scope.toString().toLowerCase()); - command.command.put("-parameters", "disablelog:false:tmax2:6000"); + command.command.put("-parameters", "disablelog" + File.pathSeparator + "false" + File.pathSeparator + "tmax2" + + File.pathSeparator + "6000"); command.command.put("-maxVarCombination", "100"); AstorMain main = new AstorMain(); @@ -45,4 +47,4 @@ public void testProgramVariantFactory() throws Exception { // Confirm that there are no source positions that are instance of NoSourcePosition assertTrue(sourcePositions.stream().noneMatch(sourcePosition -> sourcePosition instanceof NoSourcePosition)); } -} +} \ No newline at end of file diff --git a/src/test/java/fr/inria/astor/test/repair/evaluation/extensionpoints/FaultLocalizationExtensionTest.java b/src/test/java/fr/inria/astor/test/repair/evaluation/extensionpoints/FaultLocalizationExtensionTest.java index 064333d47..7b0ec4740 100644 --- a/src/test/java/fr/inria/astor/test/repair/evaluation/extensionpoints/FaultLocalizationExtensionTest.java +++ b/src/test/java/fr/inria/astor/test/repair/evaluation/extensionpoints/FaultLocalizationExtensionTest.java @@ -4,7 +4,6 @@ import fr.inria.astor.core.entities.ProgramVariant; import fr.inria.astor.core.entities.SuspiciousModificationPoint; import fr.inria.astor.core.faultlocalization.flacoco.FlacocoFaultLocalization; -import fr.inria.astor.core.faultlocalization.gzoltar.GZoltarFaultLocalization; import fr.inria.astor.core.faultlocalization.gzoltar.NovelGZoltarFaultLocalization; import fr.inria.astor.core.setup.ConfigurationProperties; import fr.inria.astor.core.solutionsearch.navigation.SuspiciousNavigationValues; @@ -195,7 +194,8 @@ private AstorMain runMath85(String fltorun) throws Exception { csDefault.command.put("-maxgen", "0"); csDefault.command.put("-modificationpointnavigation", SuspiciousNavigationValues.WEIGHT.toString()); csDefault.command.put("-faultlocalization", fltorun); - csDefault.command.put("-parameters", "includeTestInSusp:true:loglevel:INFO"); + csDefault.command.put("-parameters", "includeTestInSusp" + File.pathSeparator + "true" + File.pathSeparator + + "loglevel" + File.pathSeparator + "INFO"); final Double flthreshold = 0.5; csDefault.command.put("-flthreshold", flthreshold.toString()); @@ -206,4 +206,4 @@ private AstorMain runMath85(String fltorun) throws Exception { return main1; } -} +} \ No newline at end of file diff --git a/src/test/java/fr/inria/astor/test/repair/evaluation/extensionpoints/ingredients/IngredientPoolTest.java b/src/test/java/fr/inria/astor/test/repair/evaluation/extensionpoints/ingredients/IngredientPoolTest.java index 3ee11dd7a..b80e723e7 100644 --- a/src/test/java/fr/inria/astor/test/repair/evaluation/extensionpoints/ingredients/IngredientPoolTest.java +++ b/src/test/java/fr/inria/astor/test/repair/evaluation/extensionpoints/ingredients/IngredientPoolTest.java @@ -513,7 +513,7 @@ public void testMath70WithCtLocationAvoidDuplicatesInSpace() throws Exception { "/target/test-classes", "-javacompliancelevel", "7", "-flthreshold", "0.5", "-out", out.getAbsolutePath(), "-stopfirst", "true", "-seed", "10", "-maxgen", "100", "-scope", CtLocationIngredientSpace.class.getCanonicalName(), "-parameters", - "duplicateingredientsinspace:false" }; + "duplicateingredientsinspace" + File.pathSeparator + "false" }; System.out.println(Arrays.toString(args)); main1.execute(args); @@ -545,7 +545,7 @@ public void testMath70WithCtLocationAvoidDuplicatesInSpace() throws Exception { // Now, with duplicates: CommandSummary cs = new CommandSummary(args); - cs.command.put("-parameters", "duplicateingredientsinspace:true"); + cs.command.put("-parameters", "duplicateingredientsinspace" + File.pathSeparator + "true"); main1.execute(cs.flat()); jgp = (JGenProg) main1.getEngine(); pv = solutions.get(0); @@ -559,4 +559,4 @@ public void testMath70WithCtLocationAvoidDuplicatesInSpace() throws Exception { } -} +} \ No newline at end of file diff --git a/src/test/java/fr/inria/astor/test/repair/evaluation/extensionpoints/ingredients/IngredientScopeTest.java b/src/test/java/fr/inria/astor/test/repair/evaluation/extensionpoints/ingredients/IngredientScopeTest.java index e370c4983..52f80903c 100644 --- a/src/test/java/fr/inria/astor/test/repair/evaluation/extensionpoints/ingredients/IngredientScopeTest.java +++ b/src/test/java/fr/inria/astor/test/repair/evaluation/extensionpoints/ingredients/IngredientScopeTest.java @@ -45,7 +45,7 @@ public void testMath70LocalSimple() throws Exception { cs.command.put("-stopfirst", "true"); cs.command.put("-loglevel", "INFO"); cs.command.put("-saveall", "true"); - cs.append("-parameters", ("logtestexecution:true")); + cs.append("-parameters", ("logtestexecution" + File.pathSeparator + "true")); System.out.println(Arrays.toString(cs.flat())); main1.execute(cs.flat()); @@ -74,7 +74,8 @@ public void testMath70LocalSimpleAutocompile() throws Exception { cs.command.put("-stopfirst", "true"); cs.command.put("-loglevel", "DEBUG"); cs.command.put("-saveall", "true"); - cs.append("-parameters", ("logtestexecution:true:autocompile:true")); + cs.append("-parameters", ("logtestexecution" + File.pathSeparator + "true" + File.pathSeparator + "autocompile" + + File.pathSeparator + "true")); System.out.println(Arrays.toString(cs.flat())); main1.execute(cs.flat()); @@ -184,7 +185,7 @@ public void testMath70PackageSolutions() throws Exception { "-scope", "package", "-seed", "10", "-maxgen", "2000", "-stopfirst", "false", "-maxtime", "10", "-population", "1", "-reintroduce", PopulationConformation.PARENTS.toString(), // Parameters: - "-parameters", "maxnumbersolutions:2" };// Two ingredients from package + "-parameters", "maxnumbersolutions" + File.pathSeparator + "2" };// Two ingredients from package System.out.println(Arrays.toString(args)); main1.execute(args); @@ -192,4 +193,4 @@ public void testMath70PackageSolutions() throws Exception { assertEquals(AstorOutputStatus.STOP_BY_PATCH_FOUND, main1.getEngine().getOutputStatus()); assertEquals(2, solutions.size()); } -} +} \ No newline at end of file diff --git a/src/test/java/fr/inria/astor/test/repair/evaluation/extensionpoints/ingredients/MultiPatchTest.java b/src/test/java/fr/inria/astor/test/repair/evaluation/extensionpoints/ingredients/MultiPatchTest.java index a7e6a0f06..1bba28fd3 100644 --- a/src/test/java/fr/inria/astor/test/repair/evaluation/extensionpoints/ingredients/MultiPatchTest.java +++ b/src/test/java/fr/inria/astor/test/repair/evaluation/extensionpoints/ingredients/MultiPatchTest.java @@ -55,7 +55,8 @@ public void testMath70Steps() throws Exception { // "-loglevel", "INFO", "-scope", "package", "-seed", "10", "-maxgen", "0", "-stopfirst", "false", "-maxtime", "10", "-population", "1", "-reintroduce", PopulationConformation.PARENTS.toString(), - "-parameters", "logtestexecution:true:saveall:true" }; + "-parameters", "logtestexecution" + File.pathSeparator + "true" + File.pathSeparator + "saveall" + + File.pathSeparator + "true" }; System.out.println(Arrays.toString(args)); main1.execute(args); @@ -131,7 +132,8 @@ public void testMath70StepsInverted1() throws Exception { // "-loglevel", "INFO", "-scope", "package", "-seed", "10", "-maxgen", "0", "-stopfirst", "false", "-maxtime", "10", "-population", "1", "-reintroduce", PopulationConformation.PARENTS.toString(), - "-parameters", "logtestexecution:true:saveall:true" }; + "-parameters", "logtestexecution" + File.pathSeparator + "true" + File.pathSeparator + "saveall" + + File.pathSeparator + "true" }; System.out.println(Arrays.toString(args)); main1.execute(args); @@ -201,7 +203,7 @@ public void testMath70PriorityLocalSolution() throws Exception { "/target/test-classes", "-javacompliancelevel", "7", "-flthreshold", "1", "-out", out.getAbsolutePath(), "-scope", "package", "-seed", "10", "-maxgen", "10000", "-stopfirst", "false", "-maxtime", "15", // "-patchprioritization", IdentifierPriorityCriterion.class.getName(), "-parameters", - "maxnumbersolutions:2" + "maxnumbersolutions" + File.pathSeparator + "2" }; System.out.println(Arrays.toString(args)); @@ -231,7 +233,7 @@ public void testMath70Multi() throws Exception { // "-scope", "package", "-seed", "10", "-maxgen", "2000", "-stopfirst", "false", "-maxtime", "10", "-population", "1", "-reintroduce", PopulationConformation.PARENTS.toString(), "-parameters", - "maxnumbersolutions:2" }; + "maxnumbersolutions" + File.pathSeparator + "2" }; System.out.println(Arrays.toString(args)); main1.execute(args); @@ -280,4 +282,4 @@ private OperatorInstance createSecondPatch(ProgramVariant variant, ModificationP return operation; } -} +} \ No newline at end of file diff --git a/src/test/java/fr/inria/astor/test/repair/evaluation/extensionpoints/operatorselection/RepairOperatorTest.java b/src/test/java/fr/inria/astor/test/repair/evaluation/extensionpoints/operatorselection/RepairOperatorTest.java index 406b6bc8b..b4a1e3f55 100644 --- a/src/test/java/fr/inria/astor/test/repair/evaluation/extensionpoints/operatorselection/RepairOperatorTest.java +++ b/src/test/java/fr/inria/astor/test/repair/evaluation/extensionpoints/operatorselection/RepairOperatorTest.java @@ -8,7 +8,6 @@ import java.util.Arrays; import java.util.List; -import fr.inria.astor.core.faultlocalization.gzoltar.GZoltarFaultLocalization; import org.junit.Test; import fr.inria.astor.approaches.jgenprog.JGenProg; diff --git a/src/test/java/fr/inria/astor/test/repair/evaluation/extensionpoints/operatorselection/SelectionOperatorTest.java b/src/test/java/fr/inria/astor/test/repair/evaluation/extensionpoints/operatorselection/SelectionOperatorTest.java index ee3b2a9f4..d22cb08b2 100644 --- a/src/test/java/fr/inria/astor/test/repair/evaluation/extensionpoints/operatorselection/SelectionOperatorTest.java +++ b/src/test/java/fr/inria/astor/test/repair/evaluation/extensionpoints/operatorselection/SelectionOperatorTest.java @@ -4,6 +4,8 @@ import static org.junit.Assert.assertTrue; import static org.junit.Assert.fail; +import java.io.File; + import org.junit.Before; import org.junit.Test; @@ -32,7 +34,7 @@ public void testWeightedRandom() throws Exception { csDefault.command.put("-maxgen", "0"); csDefault.command.put("-opselectionstrategy", WeightedRandomOperatorSelection.class.getName()); - csDefault.append("-parameters", "weightsopselection:0.25_0.25_0.25_0.25"); + csDefault.append("-parameters", "weightsopselection" + File.pathSeparator + "0.25_0.25_0.25_0.25"); AstorMain main1 = new AstorMain(); main1.execute(csDefault.flat()); @@ -47,7 +49,7 @@ public void testWeightedRandom1Exception() throws Exception { CommandSummary csDefault = MathCommandsTests.getMath70Command(); csDefault.command.put("-maxgen", "0"); csDefault.command.put("-opselectionstrategy", WeightedRandomOperatorSelection.class.getName()); - csDefault.append("-parameters", "weightsopselection:0.25"); + csDefault.append("-parameters", "weightsopselection" + File.pathSeparator + "0.25"); AstorMain main1 = new AstorMain(); main1.execute(csDefault.flat()); fail(); @@ -60,7 +62,7 @@ public void testWeightedRandom1Exception() throws Exception { CommandSummary csDefault = MathCommandsTests.getMath70Command(); csDefault.command.put("-maxgen", "0"); csDefault.command.put("-opselectionstrategy", WeightedRandomOperatorSelection.class.getName()); - csDefault.append("-parameters", "weightsopselection:0.a5_0.25_0.25_0.25"); + csDefault.append("-parameters", "weightsopselection" + File.pathSeparator + "0.a5_0.25_0.25_0.25"); AstorMain main1 = new AstorMain(); main1.execute(csDefault.flat()); fail(); @@ -75,7 +77,7 @@ public void testWeightedRandom1Operator() throws Exception { csDefault.command.put("-maxgen", "0"); csDefault.command.put("-opselectionstrategy", WeightedRandomOperatorSelection.class.getName()); - csDefault.append("-parameters", "weightsopselection:1_0.0_0.0_0.0"); + csDefault.append("-parameters", "weightsopselection" + File.pathSeparator + "1_0.0_0.0_0.0"); AstorMain main1 = new AstorMain(); main1.execute(csDefault.flat()); @@ -92,4 +94,4 @@ public void testWeightedRandom1Operator() throws Exception { } -} +} \ No newline at end of file diff --git a/src/test/java/fr/inria/astor/test/repair/evaluation/extensionpoints/patchsorting/PatchPriorizationTest.java b/src/test/java/fr/inria/astor/test/repair/evaluation/extensionpoints/patchsorting/PatchPriorizationTest.java index e890a216c..ba3dcc2f2 100644 --- a/src/test/java/fr/inria/astor/test/repair/evaluation/extensionpoints/patchsorting/PatchPriorizationTest.java +++ b/src/test/java/fr/inria/astor/test/repair/evaluation/extensionpoints/patchsorting/PatchPriorizationTest.java @@ -36,7 +36,7 @@ public void testMath70PriorityLocalSolution() throws Exception { out.getAbsolutePath(), "-scope", "package", "-seed", "10", "-maxgen", "10000", "-stopfirst", "false", "-maxtime", "15", // "-patchprioritization", IdentifierPriorityCriterion.class.getName(), "-parameters", - "maxnumbersolutions:2" + "maxnumbersolutions" + File.pathSeparator + "2" }; System.out.println(Arrays.toString(args)); @@ -50,4 +50,4 @@ public void testMath70PriorityLocalSolution() throws Exception { assertEquals(AstorOutputStatus.STOP_BY_PATCH_FOUND, main1.getEngine().getOutputStatus()); } -} +} \ No newline at end of file diff --git a/src/test/java/fr/inria/astor/test/repair/evaluation/regression/LangTest.java b/src/test/java/fr/inria/astor/test/repair/evaluation/regression/LangTest.java index 1e4ab6b34..2254e4bc3 100644 --- a/src/test/java/fr/inria/astor/test/repair/evaluation/regression/LangTest.java +++ b/src/test/java/fr/inria/astor/test/repair/evaluation/regression/LangTest.java @@ -49,7 +49,7 @@ public void testLang63OneSingle() throws Exception { String[] args = commandLang63(dep, out, stepbystep); CommandSummary command = new CommandSummary(args); System.out.println(Arrays.toString(command.flat())); - command.command.put("-parameters", "logtestexecution:true"); + command.command.put("-parameters", "logtestexecution" + File.pathSeparator + "true"); command.command.put("-population", "1"); command.command.put("-mode", "jkali"); main1.execute(command.flat()); @@ -74,7 +74,7 @@ public void testLang63OneSingleJUnitNologExternalExecutor() throws Exception { CommandSummary command = new CommandSummary(args); System.out.println(Arrays.toString(command.flat())); String save = "true"; - command.command.put("-parameters", "logtestexecution:" + save); + command.command.put("-parameters", "logtestexecution" + File.pathSeparator + "" + save); command.command.put("-population", "1"); command.command.put("-mode", "jkali"); main1.execute(command.flat()); @@ -213,4 +213,4 @@ private String getLangCommonLibs() { return dep; } -} +} \ No newline at end of file diff --git a/src/test/java/fr/inria/astor/test/repair/evaluation/regression/MathCommandsTests.java b/src/test/java/fr/inria/astor/test/repair/evaluation/regression/MathCommandsTests.java index dc5bfd92d..f33debdf0 100644 --- a/src/test/java/fr/inria/astor/test/repair/evaluation/regression/MathCommandsTests.java +++ b/src/test/java/fr/inria/astor/test/repair/evaluation/regression/MathCommandsTests.java @@ -199,14 +199,17 @@ public void testMath1() throws Exception { String[] args = new String[] { "-dependencies", dep, "-mode", "jgenprog", // "-failing", - "org.apache.commons.math3.fraction.FractionTest:org.apache.commons.math3.fraction.BigFractionTest", + "org.apache.commons.math3.fraction.FractionTest" + File.pathSeparator + + "org.apache.commons.math3.fraction.BigFractionTest", "-location", new File("./examples/math_1").getAbsolutePath(), "-package", "org.apache.commons", "-srcjavafolder", "/src/main/java/ ", "-srctestfolder", "/src/test/java/", "-binjavafolder", "/target/classes", "-bintestfolder", "/target/test-classes", "-javacompliancelevel", "5", "-flthreshold", "0.1", "-out", out.getAbsolutePath(), // "-seed", "11", "-maxgen", "50", "-stopfirst", "true", "-maxtime", "100", // ExtensionPoints.REPAIR_OPERATORS.argument(), - "fr.inria.astor.approaches.jgenprog.operators.InsertAfterOp:fr.inria.astor.approaches.jgenprog.operators.InsertBeforeOp:fr.inria.astor.approaches.jgenprog.operators.ReplaceOp", + "fr.inria.astor.approaches.jgenprog.operators.InsertAfterOp" + File.pathSeparator + + "fr.inria.astor.approaches.jgenprog.operators.InsertBeforeOp" + File.pathSeparator + + "fr.inria.astor.approaches.jgenprog.operators.ReplaceOp", "-scope", "fr.inria.astor.core.loop.spaces.ingredients.scopes.ctscopes.CtGlobalIngredientScope", "-ingredientstrategy", "fr.inria.astor.core.loop.spaces.ingredients.ingredientSearch.CloneIngredientSearchStrategy", @@ -221,4 +224,4 @@ public void testMath1() throws Exception { // assertTrue(solutions.size() > 0); } -} +} \ No newline at end of file diff --git a/src/test/java/fr/inria/astor/test/repair/evaluation/regression/RepairnatorTest.java b/src/test/java/fr/inria/astor/test/repair/evaluation/regression/RepairnatorTest.java index 5774b2527..59822842d 100644 --- a/src/test/java/fr/inria/astor/test/repair/evaluation/regression/RepairnatorTest.java +++ b/src/test/java/fr/inria/astor/test/repair/evaluation/regression/RepairnatorTest.java @@ -37,11 +37,10 @@ public void testjsoup285353482() throws Exception { throw new Exception(m2path + "does not exit"); } - String[] command = new String[] { "-dependencies", - m2path + "/junit/junit/4.12/junit-4.12.jar:" + m2path - + "/org/hamcrest/hamcrest-core/1.3/hamcrest-core-1.3.jar:" + m2path - + "/com/google/code/gson/gson/2.7/gson-2.7.jar", - "-mode", "jgenprog", "-location", + String[] command = new String[] { "-dependencies", m2path + "/junit/junit/4.12/junit-4.12.jar" + + File.pathSeparator + "" + m2path + "/org/hamcrest/hamcrest-core/1.3/hamcrest-core-1.3.jar" + + File.pathSeparator + "" + m2path + "/com/google/code/gson/gson/2.7/gson-2.7.jar", "-mode", "jgenprog", + "-location", new File("./examples/librepair-experiments-jhy-jsoup-285353482-20171009-062400_bugonly") .getAbsolutePath(), "-srcjavafolder", "/src/main/java", // Modified by M.M, original @@ -56,7 +55,10 @@ public void testjsoup285353482() throws Exception { // sent // by // S.U. - "-parameters", "timezone:Europe/Paris:maxnumbersolutions:3:limitbysuspicious:false:" + "loglevel:DEBUG", + "-parameters", + "timezone" + File.pathSeparator + "Europe/Paris" + File.pathSeparator + "maxnumbersolutions" + + File.pathSeparator + "3" + File.pathSeparator + "limitbysuspicious" + File.pathSeparator + + "false" + File.pathSeparator + "" + "loglevel" + File.pathSeparator + "DEBUG", "-maxtime", "100", "-seed", "1" }; CommandSummary cs = new CommandSummary(command); AstorMain main1 = new AstorMain(); @@ -76,11 +78,10 @@ public void testjsoup285353482WithPackageInfo() throws Exception { throw new Exception(m2path + "does not exit"); } - String[] command = new String[] { "-dependencies", - m2path + "/junit/junit/4.12/junit-4.12.jar:" + m2path - + "/org/hamcrest/hamcrest-core/1.3/hamcrest-core-1.3.jar:" + m2path - + "/com/google/code/gson/gson/2.7/gson-2.7.jar", - "-mode", "jgenprog", "-location", + String[] command = new String[] { "-dependencies", m2path + "/junit/junit/4.12/junit-4.12.jar" + + File.pathSeparator + "" + m2path + "/org/hamcrest/hamcrest-core/1.3/hamcrest-core-1.3.jar" + + File.pathSeparator + "" + m2path + "/com/google/code/gson/gson/2.7/gson-2.7.jar", "-mode", "jgenprog", + "-location", new File( "./examples/librepair-experiments-jhy-jsoup-285353482-20171009-062400_bugonly_with_package_info") .getAbsolutePath(), @@ -96,7 +97,10 @@ public void testjsoup285353482WithPackageInfo() throws Exception { // sent // by // S.U. - "-parameters", "timezone:Europe/Paris:maxnumbersolutions:3:limitbysuspicious:false:" + "loglevel:DEBUG", + "-parameters", + "timezone" + File.pathSeparator + "Europe/Paris" + File.pathSeparator + "maxnumbersolutions" + + File.pathSeparator + "3" + File.pathSeparator + "limitbysuspicious" + File.pathSeparator + + "false" + File.pathSeparator + "" + "loglevel" + File.pathSeparator + "DEBUG", "-maxtime", "100", "-seed", "1" }; CommandSummary cs = new CommandSummary(command); AstorMain main1 = new AstorMain(); @@ -123,7 +127,7 @@ public void testMath70AbsolutesPaths() throws Exception { "-bintestfolder", new File("./examples/math_70").getAbsolutePath() + "/target/test-classes", // "-javacompliancelevel", "7", "-flthreshold", "0.5", "-out", out.getAbsolutePath(), "-scope", "local", "-seed", "10", "-maxgen", Integer.toString(generations), "-stopfirst", "true", "-maxtime", "100", - "-loglevel", "INFO", "-parameters", "disablelog:false" + "-loglevel", "INFO", "-parameters", "disablelog" + File.pathSeparator + "false" }; @@ -158,7 +162,7 @@ public void testMath70WrongPaths() throws Exception { "-bintestfolder", new File("./examples/math_70").getAbsolutePath() + "/target/test-classes", // "-javacompliancelevel", "7", "-flthreshold", "0.5", "-out", out.getAbsolutePath(), "-scope", "local", "-seed", "10", "-maxgen", Integer.toString(generations), "-stopfirst", "true", "-maxtime", "100", - "-loglevel", "INFO", "-parameters", "disablelog:false" + "-loglevel", "INFO", "-parameters", "disablelog" + File.pathSeparator + "false" }; @@ -207,7 +211,12 @@ public void testAsc() throws Exception { "/root/workspace/AsyncHttpClient/async-http-client/285409364/client", "-srcjavafolder", "/root/workspace/AsyncHttpClient/async-http-client/285409364/client/src/main/java", "-stopfirst", "true", "-population", "1", "-parameters", - "timezone:Europe/Paris:maxnumbersolutions:3:limitbysuspicious:false:maxmodificationpoints:1000:javacompliancelevel:8:logfilepath:./workspace/AsyncHttpClient/async-http-client/285409364/repairnator.astor.log", + "timezone" + File.pathSeparator + "Europe/Paris" + File.pathSeparator + "maxnumbersolutions" + + File.pathSeparator + "3" + File.pathSeparator + "limitbysuspicious" + File.pathSeparator + + "false" + File.pathSeparator + "maxmodificationpoints" + File.pathSeparator + "1000" + + File.pathSeparator + "javacompliancelevel" + File.pathSeparator + "8" + File.pathSeparator + + "logfilepath" + File.pathSeparator + + "./workspace/AsyncHttpClient/async-http-client/285409364/repairnator.astor.log", "-maxtime", "100", "-seed", "1" }; CommandSummary cs = new CommandSummary(command); AstorMain main1 = new AstorMain(); @@ -215,4 +224,4 @@ public void testAsc() throws Exception { } -} +} \ No newline at end of file