initial commit for iFixFlakies4iFixPlus#24
Conversation
90b4245 to
a243828
Compare
a243828 to
bcb03f8
Compare
| import org.xmlunit.diff.Difference; | ||
| import org.xmlunit.diff.ElementSelectors; | ||
|
|
||
| public class iFixPlusPlugin extends TestPlugin { |
There was a problem hiding this comment.
Maybe we should change this to something like ODRepairPlugin, or ODRepairDebugPlugin, as to better match the paper.
|
|
||
| public class iFixPlusPlugin extends TestPlugin { | ||
| private Path replayPath; | ||
| private Path replayPath2; |
There was a problem hiding this comment.
Can we use a better name than replayPath2 as to distinguish what it is actually supposed to represent?
| final Runner runner = InstrumentingSmartRunner.fromRunner(runners.get(0)); | ||
|
|
||
| replayPath = Paths.get(Configuration.config().getProperty("replay.path")); | ||
| replayPath2 = Paths.get(Configuration.config().getProperty("replay.path2")); |
There was a problem hiding this comment.
Similar thing about the property name itself. In fact, should they all have the prefix "replay"? If they are more relevant for controlling testrunner's statecapture logic, maybe they should instead be prefix "statecapture"?
| // phase 0 check json file | ||
| System.out.println("~~~~~~ Begin to check if this test is a true order-dependent test."); | ||
| Configuration.config().properties().setProperty("statecapture.phase", "check"); | ||
| if (testFailOrder()==null) { |
There was a problem hiding this comment.
Spaces between operators, i.e., testFailOrder() == null.
| StandardOpenOption.APPEND); | ||
| // phase 0 check json file | ||
| System.out.println("~~~~~~ Begin to check if this test is a true order-dependent test."); | ||
| Configuration.config().properties().setProperty("statecapture.phase", "check"); |
There was a problem hiding this comment.
Does configuring the phase to be "check" affect anything for the testrunner run itself?
| System.out.println("xmlFileName: " + xmlFileNum); | ||
|
|
||
| if (runner != null && module.equals(PathManager.modulePath().toString())) { | ||
| System.out.println("replyPath: " + replayPath); |
There was a problem hiding this comment.
Can remove such print statements; also, replyPath -> replayPath.
|
|
||
| @Override | ||
| public void execute(final MavenProject mavenProject) { | ||
| Configuration.config().properties().setProperty("statecapture.phase", "initial"); |
There was a problem hiding this comment.
Does setting the phase to be "initial" affect anything?
| } | ||
|
|
||
| for(int i=0; i<10; i++) { | ||
| Try<TestRunResult> phase0ResultFail = null; |
There was a problem hiding this comment.
Let's also change the variable names to not use numbered phases, to match exactly what phase we care about.
| phase0ResultFail = runner.runList(testFailOrder()); | ||
| } | ||
| catch (Exception ex) { | ||
| System.out.println("## Encountering error when checking the failing order: " + ex); |
There was a problem hiding this comment.
What kind of exceptions can we get there?
| System.out.println("Failing order results: " + | ||
| phase0ResultFail.get().results().get(dtname).result().toString()); | ||
|
|
||
| if (phase0ResultFail.get().results().get(dtname).result().toString().equals("PASS")) { |
There was a problem hiding this comment.
Since the variable gets initalized to null and can potentially not be set properly in the try block, this could actually lead to a NullPointerException. That kind of defeats the purpose of using the Try construct, since the point of that is to not have to check for null (you would first check whether it has a value).
| System.out.println("## Running double victim order results: " + phase1Result.get().results()); | ||
| } | ||
| catch (Exception e) { | ||
| System.out.println("## Encountering error when running in double victim order: " + e); |
There was a problem hiding this comment.
Please check what kind of exceptions we can get in these places.
|
|
||
| replayPath = Paths.get(Configuration.config().getProperty("replay.path")); | ||
| replayPath2 = Paths.get(Configuration.config().getProperty("replay.path2")); | ||
| dtname= Configuration.config().getProperty("replay.dtname"); |
There was a problem hiding this comment.
Spaces after the variable name.
| System.out.println("~~~~~~ Finish phase capturing the state in passing order(double victim)!!"); | ||
| } | ||
|
|
||
| xmlFileNum = countDirNums(subxmlFold); |
There was a problem hiding this comment.
Do we still need to do these counting?
| Configuration.config().properties(). | ||
| setProperty("statecapture.phase", "capture_before"); | ||
| Configuration.config().properties(). | ||
| setProperty("statecapture.state", "passing_order"); |
There was a problem hiding this comment.
Is this "statecapture.state" property actually useful?
| System.out.println("~~~~~~ Begin capturing the state in passing order!"); | ||
| // phase 2: run doublevictim order state capture | ||
| Configuration.config().properties(). | ||
| setProperty("statecapture.phase", "capture_after"); |
There was a problem hiding this comment.
I wonder instead of "phase" the property should actually reflect that it means the relative position for capture, maybe something like "statecapture.position"?
| xmlFileNum = countDirNums(subxmlFold); | ||
| System.out.println("xmlFileNum: " + xmlFileNum); | ||
|
|
||
| File passingSubXmlFolder = new File(subxmlFold + "/failing_order_xml"); |
There was a problem hiding this comment.
Why is passingSubXmlFolder referencing the name "failing_order_xml"?
| String line; | ||
| while ((line = br.readLine()) != null) { | ||
| if (line.contains(" made test success#######")) { | ||
| successfulField = line.substring(8, line.lastIndexOf(" made test success#######")); |
There was a problem hiding this comment.
This feels so complicated to parse some English, can we get it to simply write out the valid polluted field?
| return num; | ||
| } | ||
|
|
||
| public void diffing() { |
There was a problem hiding this comment.
If all diffing does is call diffSub, is there any need for this method?
| return FileUtils.readFileToString(file, "UTF-8"); | ||
| } | ||
|
|
||
| Set<String> File2SetString(String path) { |
There was a problem hiding this comment.
Method should not start with capitalized letter, should have access modifier like private, maybe change to something like readFileContentsAsSet.
| } | ||
|
|
||
| if (!state0.equals(state1)) { | ||
| diffFields_filtered.add(s); |
There was a problem hiding this comment.
Does this just compare whether the two strings read from the files are exactly the same? Shouldn't there be a more in-depth comparison to determine whether they are truly different?
No description provided.