Inspired by Automated Patch Generation with Context-based Change Application, SPI is a revision of ConFix which uses change pool made out of patches from recommended projects, each of which is considered to have a similar bug as the target project.
SPI = CC + LCE + ConFix
- ConFix (Original Repository of ConFix)
- ChangeCollector (CC)
AllChangeCollector(Integrated into ChangeCollector)- Longest Common sub-vector Extractor (LCE)
- JDKs
- Oracle JDK 17 (Used to compile
ChangeCollectorandLongest Common sub-vector Extractor) - Oracle JDK 8 (Used by Defects4J)
- Oracle JDK 17 (Used to compile
- Defects4J
- See requirements
- Python
- Python 3.6+
- PIP packages necessary
- jproperties
- Launch
preconfig.sh(for linux) to install pre-requisites. Those will be installed locally:
Change Collectoris a submodule ofSPIwhich is responsible for generating the change vector pool.Change Collectoris a Java project which is built with Gradle.
- To execute the
ChangeCollectormodule, you need to have JDK 17 installed. - To launch
ChangeCollectorto generate the change vector pool, input values descripted below in target properties file.- ChangeCollector itself does not use
SPI.inifile. Instead, it uses.propertiesfile for input.
- ChangeCollector itself does not use
- The path of
.propertiesfile can be given by argument. If not,ChangeCollectorwill look forcc.propertiesunder{Path_to_SimilarPatchIdentifier}/core/ChangeCollectordirectory. - The
.propertiesfile should contain the following values to generate pool.project_root: Absolute path to the root directory of the project.output_dir: Absolute path to the directory where the output files should be stored.mode: For Change Vector Pool generation, the mode should bepoolminer.JAVA_HOME.8: Absolute path to JDK 8.set_file_path: Absolute path to the file which contains the list of metadata; {BIC commit ID, BFC commit ID, path for BIC file, path for BFC file, Git URL, JIRA key}.
- Execute the following command to launch
ChangeCollectorto generate the change vector pool.- If you want to execute
ChangeCollectorwith designated properties file, provide path as additional argument.
- If you want to execute
cd ./core/ChangeCollector {Path of .properties file}
gradle clean run
- Change value at key
modein sectionSPIamong [defects4j,defects4j-batch,github]. - Edit
SPI.ini: - You can run SPI through command below at project root directory; however at first launch or after submodule changes, you need to rebuild submodules; Add option
-r/--rebuildto do so.
python3 launcher.py
- If finished, the result of the execution will be stored within the folder inside the path set by key
byproduct_path.- If "diff.txt" is found within this path, it means the patch is found.
- Otherwise it means that there is no patch found for the buggy file.
| section | key | description | default value |
|---|---|---|---|
SPI |
mode |
How SPI will be run. Can choose among those options:- defects4j : Tells SPI to try finding a patch out of a Defects4J bug.- defects4j-batch : Tells SPI to try finding a patch out of a Defects4J bug, but with a number of bugs given as a list.- github : Currently not fully implemented. Tells SPI to try finding a patch out of a GitHub project with a bug. |
- |
SPI |
JAVA_HOME_8 |
Absolute path of JDK 8 | None, Should be specified |
SPI |
byproduct_path |
Directory which files and folders made during the progress of SPI should be stored into. |
{SPI_root_directory}/byproducts |
SPI |
root |
Directory where SPI root directory is placed. |
. |
SPI |
patch_strategy |
List of patch strategies (among flfreq, tested-first, noctx, patch) to run SPI with. Comma-separated. |
flfreq |
SPI |
concretization_strategy |
List of concretization strategies (among tcvfl, hash-match, neightbor, tc) to run SPI with. Comma-separated. |
hash-match |
ConFix |
patch.count |
Number of patch generation trials | 200000 |
ConFix |
max.change.count |
The threshold of number of changes to use as patch material | 2500 |
ConFix |
max.trials |
The threshold of patch generation trial | 100 |
ConFix |
time.budget |
Time limit of ConFix execution, hourly | 3 |
ConFix |
fl.metric |
How Fault Localization(FL) is done | perfect |
| section | key | description | default value |
|---|---|---|---|
SPI |
identifier |
Alias to the name of the project. | None |
SPI |
version |
Bug ID of Defects4J bug. | None |
| section | key | description | default value |
|---|---|---|---|
SPI |
batch_d4j_file |
Name of the file which contains names of Defects4J bugs | d4j-batch.txt |
| section | key | description | default value |
|---|---|---|---|
SPI |
repository_url |
URL of GitHub project to look for a patch upon | None |
SPI |
commit_id |
Commit ID of GitHub project that produces a bug | None |
SPI |
source_path |
Source directory path (relative path from project root) for parsing buggy codes | None |
SPI |
target_path |
Relative path (from project root) for compiled .class files | None |
SPI |
test_list |
List of names of test classes that a project uses | None |
SPI |
test_class_path |
Classpath for test execution. Colon(:)-separated. |
None |
SPI |
compile_class_path |
Classpath for candidate compilation. Colon(:)-separated. |
None |
SPI |
build_tool |
How a project is built. Only tools maven and gradle are available |
None |
SPI |
faulty_file |
Relative directory (from root of project) of a faulty file. | None |
SPI |
faulty_line_fix |
Line number of faulty_file to try modifying. |
None |
SPI |
faulty_line_blame |
Line number of faulty file where the bug is made. |
None |
'-r', '--rebuild': Rebuild all submodules (ChangeCollector, LCE) on start of execution. In default,launcher.pydoes not rebuild each submodules on execution.'-d', '--debug': Execute single Defects4J project,Closure-14for testing a cycle of execution. Debug usesflfreqandhash-matchstrategies. SPI consists of three Java projects as submodules. Thus you may need to check if there is no compile error or wrong paths given through debug execution. If no problem occurs, you are clear to launch.
- You may use inserted bash script,
tracker.shfor notifying execution finish through email. Through bash script,tracker.shwill executelauncher.pywith rebuild option given. - You must use
handong.ac.kraccount only for email.- due to Gmail Rules, we cannot use gmail accounts for mailing within SERVER #24.
./tracker.sh{location_of_SPI}{your@email}
| key | is_required | description |
|---|---|---|
mode |
Yes | How SPI will be run. Can choose among those options:- defects4j : Tells SPI to try finding a patch out of a Defects4J bug.- defects4j-batch : Tells SPI to try finding a patch out of a Defects4J bug, but with a number of bugs given as a list.- github : Currently not fully implemented. Tells SPI to try finding a patch out of a GitHub project with a bug. |
batch_d4j_file |
In mode defects4j-batch |
Name of the file which contains names of Defects4J bugs |
identifier |
In mode defects4j |
Alias to the name of the project. Automatically set when running SPI in mode defects4j-batch |
version |
In mode defects4j |
Bug ID of Defects4J bug. |
repository_url |
In mode github |
URL of GitHub project to look for a patch upon |
commit_id |
In mode github |
Commit ID of GitHub project that produces a bug |
source_path |
In mode github |
Source directory path (relative path from project root) for parsing buggy codes |
target_path |
In mode github |
Relative path (from project root) for compiled .class files |
test_list |
In mode github |
List of names of test classes that a project uses |
test_class_path |
In mode github |
Classpath for test execution. Colon(:)-separated. |
compile_class_path |
In mode github |
Classpath for candidate compilation. Colon(:)-separated. |
build_tool |
In mode github |
How a project is built. Only tools maven and gradle are available |
faulty_file |
In mode github |
Relative directory (from root of project) of a faulty file. Automatically set when running SPI in mode defects4j / defects4j-batch |
faulty_line_fix |
In mode github |
Line number of faulty_file to try modifying. Automatically set when running SPI in mode defects4j / defects4j-batch |
faulty_line_blame |
In mode github |
Line number of faulty file where the bug is made. Automatically set when running SPI in mode defects4j / defects4j-batch |
JAVA_HOME_8 |
Yes | Absolute path of JDK 8. Necessary to build and compile ConFix. |
byproduct_path |
No | Directory which files and folders made during the progress of SPI should be stored into. Will make folder byproducts inside root by default. |
root |
No | Directory where SPI root directory is placed. |
patch_strategy |
No | List of patch strategies (among flfreq, tested-first, noctx, patch) to run SPI with. Comma-separated. |
concretization_strategy |
No | List of concretization strategies (among tcvfl, hash-match, neightbor, tc) to run SPI with. Comma-separated. |
| key | is_required | description |
|---|---|---|
project_root |
no | automatically set by launcher through SPI/root |
output_dir |
no | automatically set by launcher through SPI/byproduct_path |
mode |
no | automatically set by launcher |
file_name |
no | automatically set by launcher through SPI/target_path |
commit_id |
no | automatically set by launcher through SPI/commit_id |
git_url |
no | automatically set by launcher through SPI/repository_url |
git_name |
no | unnecessary if git_url is given |
doClean |
no | whether to clean the output directory before recurrent execution with identical output directory |
JAVA_HOME.8 |
no | automatically set by launcher through SPI/JAVA_HOME_8 |
defects4j_name |
no | automatically set by launcher through SPI/identifier |
defects4j_id |
no | automatically set by launcher through SPI/version |
hash_id |
no | automatically set by launcher |
| key | is_required | description |
|---|---|---|
SPI.dir |
no | automatically set by launcher through SPI/root |
pool_file.dir |
no | automatically set by launcher |
meta_pool_file.dir |
no | automatically set by launcher |
target_vector.dir |
no | automatically set by launcher |
pool.dir |
no | automatically set by launcher |
candidates.dir |
no | automatically set by launcher |
candidate_number |
yes | select the number of candidate source codes. default is 10 |
d4j_project_name |
no | automatically set by launcher through SPI/identifier |
d4j_project_num |
no | automatically set by launcher through SPI/version |
doClean |
no | whether to clean the output directory before recurrent execution with identical output directory |
| key | is_required | description |
|---|---|---|
jvm |
yes | automatically set by launcher through SPI/JAVA_HOME_8 |
version |
no | Version of JDK. automatically set by launcher |
pool.path |
no | automatically set by launcher |
cp.lib |
no | automatically set by launcher |
patch.count |
yes | define the patch generation trial count. default is 200000 |
max.change.count |
yes | define the threshold of number of changes to use as patch material |
max.trials |
yes | define the threshold of patch generation trial |
time.budget |
yes | define the time limit of ConFix execution |
patch.strategy |
no | automatically set by launcher |
concretize.strategy |
no | automatically set by launcher |
fl.metric |
yes | define how Fault Localization is done. default is perfect. only required for ConFix |