defects4j
defects4j copied to clipboard
How to apply patchs provided by my APR technique and validate against the test cases?
Hi, I find it hard to understand how to apply patch to the current system. According to my understanding, the steps to apply patch should be like this:
- The Automated Program Repair tool provides patch for a buggy file (say a new technique that i have just invented). Take an example concretely, the tool can provide patch for project Lang, bug id 1.
- Apply the patch to bug 1 in project Lang.
- Validate if the provided patch pass the set of test suit.
I'm struggling at step 2, what is the steps to apply the patch? Thanks.
The following commands should correspond to your described use case:
-
defects4j checkout -pLang -v1b -w<work-dir>
-> obtain the buggy version of Lang-1 -
defects4j compile -w<work-dir>
-> compile the source code -
defects4j test -w<work-dir>
-> test the source code and make sure the bug is reproducible -
git apply ...
-> apply a given patch to the source code (see the git manual for details;patch
works, too) -
defects4j compile -w<work-dir>
-> check whether the patched source code compiles -
defects4j test -w<work-dir>
-> check whether the patched source code passes all tests