SpoonLabs / astor

Automatic program repair for Java with generate-and-validate techniques :v::v:: jGenProg (2014) - jMutRepair (2016) - jKali (2016) - DeepRepair (2017) - Cardumen (2018) - 3sfix (2018)
https://hal.archives-ouvertes.fr/hal-01321615/document
GNU General Public License v2.0
208 stars 106 forks source link

An error while using tools #202

Closed Amirfarhad-Nilizadeh closed 4 years ago

Amirfarhad-Nilizadeh commented 5 years ago

When I run the following program with (jGenProg, jkali, MutRepair, Cardumen) I get the following error message instead of the "----SUMMARY_EXECUTION---". Also, test-suite covers the bug.

java -cp /home/amirfarhad/Desktop/ProgramAnalysis/codes/Repair_Tools/astor/target/astor-1.0.0-SNAPSHOT-jar-with-dependencies.jar fr.inria.main.evolution.AstorMain -mode Cardumen -jvm4testexecution /usr/lib/jvm/java-8-openjdk-amd64/jre/bin -location /home/amirfarhad/Desktop/ProgramAnalysis/codes/result_repair_tools/Cardumen/BubbleSort/bug/BubbleSort/ -dependencies /home/amirfarhad/Desktop/ProgramAnalysis/codes/Repair_Tools/astor/examples/libs/junit-4.4.jar:/home/amirfarhad/Desktop/ProgramAnalysis/codes/Repair_Tools/astor/examples/libs/hamcrest-core-1.3.jar -failing BubbleSort.bug1.JUnitBubbleSort -package BubbleSort.bug1 -srcjavafolder /src/main/java/ -srctestfolder /src/test/java/ -binjavafolder target/classes -bintestfolder target/test-classes -stopfirst true [INFO] 13:48:04,060 fr.inria.astor.core.setup.ProjectConfiguration:282 - Version of the JVM used: 1.8.0_222 [INFO] 13:48:04,062 main:380 - Java version of the JDK used to run tests: 1.8.0_222 [INFO] 13:48:04,062 main:381 - The compliance of the JVM is: 8 [INFO] 13:48:04,063 main:659 - command line arguments: [-mode Cardumen -jvm4testexecution /usr/lib/jvm/java-8-openjdk-amd64/jre/bin -location /home/amirfarhad/Desktop/ProgramAnalysis/codes/result_repair_tools/Cardumen/BubbleSort/bug13/BubbleSort/ -dependencies /home/amirfarhad/Desktop/ProgramAnalysis/codes/Repair_Tools/astor/examples/libs/junit-4.4.jar:/home/amirfarhad/Desktop/ProgramAnalysis/codes/Repair_Tools/astor/examples/libs/hamcrest-core-1.3.jar -failing BubbleSort.bug1.JUnitBubbleSort -package BubbleSort.bug1 -srcjavafolder /src/main/java/ -srctestfolder /src/test/java/ -binjavafolder target/classes -bintestfolder target/test-classes -stopfirst true] [INFO] 13:48:04,065 fr.inria.main.evolution.AstorMain:212 - Running Astor on a JDK at /usr/lib/jvm/java-8-openjdk-amd64/jre [INFO ] fr.inria.main.AbstractMain.determineSourceFolders(AbstractMain.java:973) - Source folders: [/home/amirfarhad/Desktop/ProgramAnalysis/codes/result_repair_tools/Cardumen/BubbleSort/bug13/BubbleSort/src/main/java] [INFO ] fr.inria.main.AbstractMain.determineSourceFolders(AbstractMain.java:992) - Source Test folders: [/home/amirfarhad/Desktop/ProgramAnalysis/codes/result_repair_tools/Cardumen/BubbleSort/bug13/BubbleSort/src/test/java] [INFO ] fr.inria.astor.core.solutionsearch.AstorCoreEngine.resolveTestsToRun(AstorCoreEngine.java:1368) - Test retrieved from classes: 1 [INFO ] fr.inria.astor.core.faultlocalization.gzoltar.GZoltarFaultLocalization.calculateSuspicious(GZoltarFaultLocalization.java:74) - -Executing Gzoltar classpath: /home/amirfarhad/Desktop/ProgramAnalysis/codes/result_repair_tools/Cardumen/BubbleSort/bug13/BubbleSort/./output_astor/AstorMain-BubbleSort//bin//default from 1 classes with test cases [INFO ] fr.inria.astor.core.faultlocalization.gzoltar.GZoltarFaultLocalization.searchSuspicious(GZoltarFaultLocalization.java:154) - Gzoltar fault localization: min susp value parameter: 0.1 [INFO ] fr.inria.astor.core.faultlocalization.gzoltar.GZoltarFaultLocalization.searchSuspicious(GZoltarFaultLocalization.java:174) - -gz-Adding classpath: [/home/amirfarhad/Desktop/ProgramAnalysis/codes/result_repair_tools/Cardumen/BubbleSort/bug13/BubbleSort/./output_astor/AstorMain-BubbleSort//bin//default, /home/amirfarhad/Desktop/ProgramAnalysis/codes/Repair_Tools/astor/examples/libs/junit-4.4.jar, /home/amirfarhad/Desktop/ProgramAnalysis/codes/Repair_Tools/astor/examples/libs/hamcrest-core-1.3.jar] [INFO ] fr.inria.astor.core.faultlocalization.gzoltar.GZoltarFaultLocalization.searchSuspicious(GZoltarFaultLocalization.java:214) - Test failt: BubbleSort.bug1.JUnitBubbleSort#test [INFO ] fr.inria.astor.core.faultlocalization.gzoltar.GZoltarFaultLocalization.searchSuspicious(GZoltarFaultLocalization.java:214) - Test failt: BubbleSort.bug1.JUnitBubbleSort#test1 [INFO ] fr.inria.astor.core.faultlocalization.gzoltar.GZoltarFaultLocalization.searchSuspicious(GZoltarFaultLocalization.java:214) - Test failt: BubbleSort.bug1.JUnitBubbleSort#test2 [INFO ] fr.inria.astor.core.faultlocalization.gzoltar.GZoltarFaultLocalization.searchSuspicious(GZoltarFaultLocalization.java:214) - Test failt: BubbleSort.bug1.JUnitBubbleSort#test3 [INFO ] fr.inria.astor.core.faultlocalization.gzoltar.GZoltarFaultLocalization.searchSuspicious(GZoltarFaultLocalization.java:214) - Test failt: BubbleSort.bug1.JUnitBubbleSort#test4 [INFO ] fr.inria.astor.core.faultlocalization.gzoltar.GZoltarFaultLocalization.searchSuspicious(GZoltarFaultLocalization.java:226) - Gzoltar Test Result Total:5, fails: 5, GZoltar suspicious 0, with positive susp 0 [INFO ] fr.inria.astor.core.faultlocalization.gzoltar.GZoltarFaultLocalization.searchSuspicious(GZoltarFaultLocalization.java:234) - nr test results 5 [INFO ] fr.inria.astor.core.faultlocalization.gzoltar.GZoltarFaultLocalization.searchSuspicious(GZoltarFaultLocalization.java:289) - Gzoltar found: 0 with susp > 0.1, we consider: 0 Exception in thread "main" java.lang.IllegalArgumentException: No suspicious gen for analyze at fr.inria.astor.core.faultlocalization.gzoltar.GZoltarFaultLocalization.calculateSuspicious(GZoltarFaultLocalization.java:100) at fr.inria.astor.core.faultlocalization.gzoltar.GZoltarFaultLocalization.searchSuspicious(GZoltarFaultLocalization.java:48) at fr.inria.astor.core.solutionsearch.AstorCoreEngine.calculateSuspicious(AstorCoreEngine.java:945) at fr.inria.main.evolution.AstorMain.createEngine(AstorMain.java:121) at fr.inria.main.evolution.AstorMain.run(AstorMain.java:175) at fr.inria.main.evolution.AstorMain.execute(AstorMain.java:235) at fr.inria.main.evolution.AstorMain.main(AstorMain.java:206)

bug.zip

Also, in my examples with two classes these tools cannot repair the programs. Am I doing something wrong based on this example? Should I guide these tools to work on the buggy class?

Amirfarhad-Nilizadeh commented 5 years ago

The buggy program and its test-suite are attache.

Thanks in advance for your time and help.

Amirfarhad-Nilizadeh commented 5 years ago

Can anyone help me in this case? Is any limitation in Astor that cannot make a usual output in this case?

Thanks in advance for your time.

martinezmatias commented 5 years ago

Hi @Amirfarhad-Nilizadeh The line - Gzoltar Test Result Total:5, fails: 5, GZoltar suspicious 0, with positive susp 0 means that the fault localization component (Gzoltar) could not find any suspicious, even it's able to run all test cases (all of them fail). Consequently, Astor cannot proceed with the repair. Could you create a test cases that execute that bug and assert the wrong behaviour and push it as a Pull Request? Thanks Matias

Amirfarhad-Nilizadeh commented 5 years ago

Thank you so much.

What do you mean exactly by "it's able to run all test cases (all of them fail)"?

Do you mean that at least one of the tests have to pass the buggy program correctly? Or, with one test a crash should happen in the program?

This program is a bubble sort, which based on the test suite output array should be in ascending order. But the buggy bubble sort program, sort the array in a descending order. (Only the relational is changed in the if condition of the bubble sort)

So, any array as an input will be run successfully, but it will be failed based on the test suite. Only, if all array's elements be equal to each other, then it can be passed by both correct version and buggy version of the bubble sort.

Thank you for your time.

martinezmatias commented 5 years ago

Hi @Amirfarhad-Nilizadeh

What do you mean exactly by "it's able to run all test cases (all of them fail)"?

I mean that Astor is able to find all the test cases from the project and is able to pass them to the fault localization.

Do you mean that at least one of the tests have to pass the buggy program correctly?

No, you can have zero passing test, but it's strange that scenario. I would recommend to create at least one passing test case (consequently that will have an impact on the fault localization formula and, maybe, to solve the problem you have)

Amirfarhad-Nilizadeh commented 5 years ago

Thank you for your help and time.

Amirfarhad-Nilizadeh commented 4 years ago

It seems that there is a bug in astor.

Astor will be crashed by running the attache file in the first comment. Also, I have one more buggy program with same crash after running astor (in any mode). Also, it is not related to the tests.

I used many other buggy programs with no passing test. Then, in some cases Astor could repair them and in other cases Astor could not. But, Astor will be crashed only by running the attached program and its test . Also, I have one more program which has both failing and passing tests, but it leads to the same crash.

martinezmatias commented 4 years ago

Hi @Amirfarhad-Nilizadeh

Also, I have one more buggy program with same crash after running astor (in any mode).

Could you create a PR with a test cases that presents that crash? Thanks Regards Matias

Amirfarhad-Nilizadeh commented 4 years ago

Thank you for your time,

Everything is correct and there is no crash.

You can close this issue.

Merry Christmas! Amirfarhad

martinezmatias commented 4 years ago

Thanks @Amirfarhad-Nilizadeh Regards Matias