defects4j icon indicating copy to clipboard operation
defects4j copied to clipboard

How to apply patchs provided by my APR technique and validate against the test cases?

Open bdqnghi opened this issue 2 years ago • 1 comments

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:

  1. 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.
  2. Apply the patch to bug 1 in project Lang.
  3. 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.

bdqnghi avatar Feb 19 '22 21:02 bdqnghi

The following commands should correspond to your described use case:

  1. defects4j checkout -pLang -v1b -w<work-dir> -> obtain the buggy version of Lang-1
  2. defects4j compile -w<work-dir> -> compile the source code
  3. defects4j test -w<work-dir> -> test the source code and make sure the bug is reproducible
  4. git apply ... -> apply a given patch to the source code (see the git manual for details; patch works, too)
  5. defects4j compile -w<work-dir> -> check whether the patched source code compiles
  6. defects4j test -w<work-dir> -> check whether the patched source code passes all tests

rjust avatar Feb 26 '22 16:02 rjust