This repository is used to replicate the experiments of article "Detecting, Creating, Repairing, and Understanding Indivisible Multi-Hunk Bugs" on SimFix. If you want to learn more about SimFix, please follow the original repository of SimFix.
In order to use SimFix more flexibly, we have added a parameter to SimFix to indicate the number of generated plausible patches.
- Ubuntu 20.04
- docker
- Python 3.8
- pip
- pandas
- JDK 1.8
- Defects4J 2.0
- CatenaD4J
- Timeout: 5h
- Plausible patches number: 500
None
Use the Dockerfile
in ./Docker
to create the docker image.
docker build -t simfix-env .
This docker image includes Defects4J, CatenaD4J, and JDK 1.8.
docker run -it --name=simfix simfix-env /bin/bash
At the root of this container, we clone the SimFix repository.
cd /
git clone https://github.com/BaiGeiQiShi/SimFixAPI.git
After testing, we found that using pip in the Docker file might cause image creation to fail, so configuration inside the container is required.
cd ./SimFixAPI
chmod +x *
./setup.sh
It takes several minutes to quickly test your installation. (Note: In quick test, the ochiai.ranking.txt
in Chart18b2 only contains one location!)
# Generate the patches
./start_simfix.sh
After finishing the repair, the results are in folders: log
and patch
.
-
log
: debug output, including buggy statements already tried, patches and reference code snippet for correct patch generation. -
patch
: a single source file repaired by SimFix that can pass the test suite. In the source file, you can find the patch, which is formatted as (example of Chart18b2):
// start of generated patch
if(index<=this.keys.size()){
rebuildIndex();
}
// end of generated patch
/* start of original code
if (index < this.keys.size()) {
rebuildIndex();
}
end of original code*/
It may take about 20 days to finish the entire experiment. If you want to fully replicate our experiments on SimFix, please first checkout the 105 bugs in Catena4J and then repair these 105 bugs. You can also modify 105_bugs.txt
to determine the bugs to be fixed.
# Clean the quick test files
rm -rf 105_bugs_with_src/*
# Repair bugs
./checkout_105.sh #checkout 105 bugs
./start_simfix.sh #repair 105 bugs
After finishing the repair, you can also check the results in folders: log
and patch
.
|——./log/ //repair log
|——./105BugsFL/ //FL results
|——./105_bugs_with_src/ //buggy project directory
|——105_bugs.txt //bug_id list(only fix bugs within this file)
|——checkout_105.sh //download buggy project in 105_bugs.txt
|——setup.sh //prepare environment
|——start_simfix.sh //start repair (you can change timeout here)
If you have any questions, you can go to the SimFix repository or create issues for more information.