From f8ad2018088b5b1de5943d6ccdd06324b17f5884 Mon Sep 17 00:00:00 2001 From: Michael Ernst Date: Thu, 30 May 2024 07:49:21 -0700 Subject: [PATCH 1/4] Context about different command-line interfaces (#544) --- README.md | 15 ++++++++++++++- framework/bug-mining/README.md | 3 ++- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index f14e93fdf..a6a30de89 100644 --- a/README.md +++ b/README.md @@ -136,7 +136,20 @@ Using Defects4J - `defects4j compile` - `defects4j test` -5. The scripts in [`framework/test/`](framework/test/) +5. Some Defects4J commands take the project id as a command-line argument + (possibly along with other arguments). Examples include `info`, `checkout`, + and `query`. Note that `info` and `query` report infromation that is derived + from the Defects4J metadata and do not require access to project files that + are in the project's VCS. + + Other commands require a working directory, either set explicitly + (`-w` command-line argument) or implicitly (executed from within a working + directory). Examples include any command that requires access to files under + version control, including source code and build files. This includes all + commands that build or test the code (`compile`, `test`, `coverage`, `mutation`) + and commands that return version-specific information (`export`). + +6. The scripts in [`framework/test/`](framework/test/) are examples of how to use Defects4J, which you might find useful as inspiration when you are writing your own scripts that use Defects4J. diff --git a/framework/bug-mining/README.md b/framework/bug-mining/README.md index 69abb356f..99c9e9a47 100644 --- a/framework/bug-mining/README.md +++ b/framework/bug-mining/README.md @@ -322,7 +322,8 @@ Terms commonly used in Defects4J - `Rev ID`: A VCS-specific revision id (e.g., a git commit hash). - `active-bugs.csv`: A csv file, per project, that maps each BID to the revision ids of the pre-fix and post-fix revision. - +- working directory: where the buggy or fixed version of the code appears. + The `checkout` command creates a working directory. ## Troubleshooting From ed34738cd8f57a2761acc5353b303369d59b2137 Mon Sep 17 00:00:00 2001 From: Michael Ernst Date: Thu, 30 May 2024 08:00:24 -0700 Subject: [PATCH 2/4] Sort lines --- cpanfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cpanfile b/cpanfile index 7cef771f9..ff2ffa5d0 100644 --- a/cpanfile +++ b/cpanfile @@ -1,6 +1,6 @@ -requires 'DBI', '>= 1.63'; requires 'DBD::CSV', '>= 0.48'; -requires 'URI', '>= 1.72'; +requires 'DBI', '>= 1.63'; requires 'JSON', '>= 2.97'; requires 'JSON::Parse', '>= 0.55'; requires 'List::Util', '>= 1.33'; +requires 'URI', '>= 1.72'; From 796a1bdba440f66b36cc57bf77df5b08707e4b2a Mon Sep 17 00:00:00 2001 From: Michael Ernst Date: Thu, 30 May 2024 18:20:37 -0700 Subject: [PATCH 3/4] Improve documentation of `tests.trigger.cause` (#581) --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index a6a30de89..35875a361 100644 --- a/README.md +++ b/README.md @@ -208,7 +208,7 @@ all active bug IDs, along with the bug report ID and bug report URL for each. |-----------------------|-------------------------------------------------------------------------------------| | bug.id | Assigned bug IDs (included in all results) | | project.id | Assigned project ID | -| project.name | Original project name | +| project.name | Original project name | | project.build.file | Location of the Defects4J build file for the project | | project.vcs | Version control system used by the project | | project.repository | Location of the project repository | @@ -223,8 +223,8 @@ all active bug IDs, along with the bug report ID and bug report URL for each. | classes.relevant.src | Source classes loaded by the JVM when executing all triggering tests | | classes.relevant.test | Test classes loaded by the JVM when executing all triggering tests | | tests.relevant | List of relevant tests classes (a test class is relevant if, when executed, the JVM loads at least one of the modified classes) | -| tests.trigger | List of test methods that trigger (expose) the bug | -| tests.trigger.cause | List of test methods that trigger (expose) the bug, along with the root cause | +| tests.trigger | List of test methods that trigger (expose) the bug, separated by semicolons (`;`) | +| tests.trigger.cause | List of test methods that trigger (expose) the bug, along with the exception thrown. Each list element has the form "methodName --> exceptionClass[: message]", and list elements are separated by semicolons (`;`) | | deprecated.version | (for deprecated bugs only) Version of Defects4J where a bug was deprecated | | deprecated.reason | (for deprecated bugs only) Reason for deprecation | From e85036c044320f11df22d3f23f248fdd4e99a41b Mon Sep 17 00:00:00 2001 From: Michael Ernst Date: Thu, 30 May 2024 18:20:52 -0700 Subject: [PATCH 4/4] How to determine the method names of changed methods (#582) --- README.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/README.md b/README.md index 35875a361..76a64b291 100644 --- a/README.md +++ b/README.md @@ -232,6 +232,14 @@ By default, `defects4j query` returns information on active bugs. The `[-D]` flag returns information only on deprecated bugs, while the `[-A]` flag returns information for all active and deprecated bugs. +To determine the methods that are changed between the buggy and fixed version of the code: + +1. Add this line to your user-level git attributes file: + `*.java diff=java` + +2. Run `git diff --no-index`, for example `git diff --no-index /tmp/lang_1_buggy /tmp/lang_1_fixed`. + In the output, every line starting with "@" gives the method name of a changed method. + Test execution framework --------------------------