program-repair / RepairThemAll

Automatic Repair Framework that abstract repair tools and bug benchmarks
MIT License
68 stars 23 forks source link

How can I modify the test cases on Defects4j and repair again? #41

Open guoweijun137 opened 1 year ago

guoweijun137 commented 1 year ago

After I ran the command "python script/repair.py jGenProg --benchmark Defects4j --id chart-1",I go to the working_directory and want to modify the test cases in the folder named jGenProg_Defects4j_chart_1.However,the folder is disappear or being deleted,only the outcome left in "results".So I want to retain the " jGenProg_Defects4j_chart_1"folder and re-run this bug when test are modified,How can I do for it?

martinezmatias commented 1 year ago

Hi @guoweijun137

I am not sure if that is possible. As far I remember, each time RtAll lanches a repair process first it checkout a bug, and at the end it removes the folder where it was removed.

guoweijun137 commented 1 year ago

Hello @martinezmatias Emmm maybe there is a problem with my Nopol deployment since after I ran the command "python script/repair.py Nopol...",the related folder named "Nopol_..." still exists

tdurieux commented 1 year ago

There is indeed a problem, you have commented the line that removes the folder: https://github.com/program-repair/RepairThemAll/blob/master/script/core/repair_tools/Nopol.py#L111

You can comment the same line for genprog in https://github.com/program-repair/RepairThemAll/blob/master/script/core/repair_tools/Astor.py#L141 if you want to keep the working directory

guoweijun137 commented 1 year ago

Appreciate you very much @tdurieux By the way ,If I want to re-run the program with my modified test cases,should I just need to comment the line in https://github.com/program-repair/RepairThemAll/blob/master/script/core/RepairTool.py#L60#L61 oh! I realized my stupidity.In Defects4j, it doesn't need to checkout and compile again if this project already exists.I will try to modify the "init_bug" function.

tdurieux commented 1 year ago

I think if you also remove https://github.com/program-repair/RepairThemAll/blob/master/script/core/RepairTool.py#L65 it should work. You should do some test to be sure but I don't see why it would not work.

guoweijun137 commented 1 year ago

What you suggested may also be a good method.I remove https://github.com/program-repair/RepairThemAll/blob/master/script/core/RepairTool.py#61 and add bug.working_directory=bug_path ,finally placing the other related parts of this function in else