From c41707125e9fe6b6442042a198fc8ce88ebacd61 Mon Sep 17 00:00:00 2001 From: Michael Ernst Date: Tue, 11 Nov 2025 15:42:41 -0800 Subject: [PATCH 1/6] Ask the user to install Python dependencies --- scripts/experiment-scripts/README.md | 22 +++++++++++++++++++ .../mutation-fig6-table3.sh | 4 ---- scripts/experiment-scripts/mutation-fig7.sh | 4 ---- scripts/experiment-scripts/mutation-fig8-9.sh | 4 ---- 4 files changed, 22 insertions(+), 12 deletions(-) diff --git a/scripts/experiment-scripts/README.md b/scripts/experiment-scripts/README.md index 1a27279..12303bd 100644 --- a/scripts/experiment-scripts/README.md +++ b/scripts/experiment-scripts/README.md @@ -15,6 +15,28 @@ evaluation. To set up the environment, refer to the `scripts/mutation-prerequisites.md` file. +#### Python Dependencies + +Before running any experiment scripts, ensure the following Python packages are installed: + +* `pandas` +* `matplotlib` +* `seaborn` + +Install these packages using your preferred Python package manager. For example: + +**With pip:** + +```bash +pip install pandas matplotlib seaborn +``` + +**With uv:** + +```bash +uv pip install pandas matplotlib seaborn +``` + ### Running Scripts To generate the desired figures or tables from the paper, run the corresponding diff --git a/scripts/experiment-scripts/mutation-fig6-table3.sh b/scripts/experiment-scripts/mutation-fig6-table3.sh index bdae0f6..b759734 100755 --- a/scripts/experiment-scripts/mutation-fig6-table3.sh +++ b/scripts/experiment-scripts/mutation-fig6-table3.sh @@ -37,10 +37,6 @@ GRT_TESTING_ROOT="$(realpath "$SCRIPT_DIR"/../)" . "$SCRIPT_DIR"/common.sh -pip install pandas -pip install matplotlib -pip install seaborn - # Clean up previous run artifacts. make -C "$GRT_TESTING_ROOT" clean rm -f "$GRT_TESTING_ROOT"/results/fig6-table3.pdf diff --git a/scripts/experiment-scripts/mutation-fig7.sh b/scripts/experiment-scripts/mutation-fig7.sh index 17e4368..08e563f 100755 --- a/scripts/experiment-scripts/mutation-fig7.sh +++ b/scripts/experiment-scripts/mutation-fig7.sh @@ -36,10 +36,6 @@ SCRIPT_DIR="$(CDPATH='' cd -- "$(dirname -- "$0")" && pwd -P)" GRT_TESTING_ROOT="$(realpath "$SCRIPT_DIR"/../)" . "$SCRIPT_DIR"/common.sh -pip install pandas -pip install matplotlib -pip install seaborn - # Clean up previous run artifacts make -C "$GRT_TESTING_ROOT" clean rm -f "$GRT_TESTING_ROOT"/results/fig7.pdf diff --git a/scripts/experiment-scripts/mutation-fig8-9.sh b/scripts/experiment-scripts/mutation-fig8-9.sh index 1863dbf..2ce3ec6 100755 --- a/scripts/experiment-scripts/mutation-fig8-9.sh +++ b/scripts/experiment-scripts/mutation-fig8-9.sh @@ -41,10 +41,6 @@ GRT_TESTING_ROOT="$(realpath "$SCRIPT_DIR"/../)" . "$SCRIPT_DIR"/common.sh -pip install pandas -pip install matplotlib -pip install seaborn - # Clean up previous run artifacts make -C "$GRT_TESTING_ROOT" clean rm -f "$GRT_TESTING_ROOT"/results/fig8-9.pdf From 20d49c2349bd5e471bfc5f1f38e8d0d082b6906f Mon Sep 17 00:00:00 2001 From: Michael Ernst Date: Tue, 11 Nov 2025 15:52:29 -0800 Subject: [PATCH 2/6] Rename `mutation-prerequisites.md` to `prerequisites.md` --- README.md | 2 +- scripts/experiment-scripts/README.md | 2 +- .../mutation-fig6-table3.sh | 2 +- scripts/experiment-scripts/mutation-fig7.sh | 2 +- scripts/experiment-scripts/mutation-fig8-9.sh | 2 +- scripts/mutation-evosuite.sh | 2 +- scripts/mutation-prerequisites.md | 22 -------- scripts/mutation-randoop.sh | 2 +- scripts/prerequisites.md | 51 +++++++++++++++++++ 9 files changed, 58 insertions(+), 29 deletions(-) delete mode 100644 scripts/mutation-prerequisites.md create mode 100644 scripts/prerequisites.md diff --git a/README.md b/README.md index 3db580c..b91ea8c 100644 --- a/README.md +++ b/README.md @@ -13,7 +13,7 @@ Testing](GRT_Program-Analysis-Guided_Random_Testing.pdf)" ### Setup -To set up the environment, refer to the `scripts/mutation-prerequisites.md` file. +To set up the environment, refer to the `scripts/prerequisites.md` file. ### Running Scripts diff --git a/scripts/experiment-scripts/README.md b/scripts/experiment-scripts/README.md index 1a27279..e0fc01f 100644 --- a/scripts/experiment-scripts/README.md +++ b/scripts/experiment-scripts/README.md @@ -13,7 +13,7 @@ evaluation. ### Setup -To set up the environment, refer to the `scripts/mutation-prerequisites.md` file. +To set up the environment, refer to the `scripts/prerequisites.md` file. ### Running Scripts diff --git a/scripts/experiment-scripts/mutation-fig6-table3.sh b/scripts/experiment-scripts/mutation-fig6-table3.sh index bdae0f6..2101af3 100755 --- a/scripts/experiment-scripts/mutation-fig6-table3.sh +++ b/scripts/experiment-scripts/mutation-fig6-table3.sh @@ -28,7 +28,7 @@ #------------------------------------------------------------------------------ # Prerequisites: #------------------------------------------------------------------------------ -# See file `mutation-prerequisites.md`. +# See file `prerequisites.md`. # #=============================================================================== diff --git a/scripts/experiment-scripts/mutation-fig7.sh b/scripts/experiment-scripts/mutation-fig7.sh index 17e4368..b914c09 100755 --- a/scripts/experiment-scripts/mutation-fig7.sh +++ b/scripts/experiment-scripts/mutation-fig7.sh @@ -28,7 +28,7 @@ #------------------------------------------------------------------------------ # Prerequisites: #------------------------------------------------------------------------------ -# See file `mutation-prerequisites.md`. +# See file `prerequisites.md`. # #=============================================================================== diff --git a/scripts/experiment-scripts/mutation-fig8-9.sh b/scripts/experiment-scripts/mutation-fig8-9.sh index 1863dbf..fbf7b22 100755 --- a/scripts/experiment-scripts/mutation-fig8-9.sh +++ b/scripts/experiment-scripts/mutation-fig8-9.sh @@ -32,7 +32,7 @@ #------------------------------------------------------------------------------ # Prerequisites: #------------------------------------------------------------------------------ -# See file `mutation-prerequisites.md`. +# See file `prerequisites.md`. # #=============================================================================== diff --git a/scripts/mutation-evosuite.sh b/scripts/mutation-evosuite.sh index f1904ba..1243cd5 100755 --- a/scripts/mutation-evosuite.sh +++ b/scripts/mutation-evosuite.sh @@ -38,7 +38,7 @@ USAGE_STRING="usage: mutation-evosuite.sh [-h] [-v] [-r] [-o RESULTS_CSV] [-t to #------------------------------------------------------------------------------ # Prerequisites: #------------------------------------------------------------------------------ -# See file `mutation-prerequisites.md`. +# See file `prerequisites.md`. # Fail this script on errors. set -e diff --git a/scripts/mutation-prerequisites.md b/scripts/mutation-prerequisites.md deleted file mode 100644 index 861e610..0000000 --- a/scripts/mutation-prerequisites.md +++ /dev/null @@ -1,22 +0,0 @@ -# Prerequisites for running either mutation script - -1. Obtain the mutation programs, some dependencies, and the source code for the - subject programs: - - ```sh - make -C scripts - ``` - -2. If using Randoop, use the development version (the latest commit) rather than - a released version. Skip this step if only using EvoSuite. - - ```sh - make -C scripts randoop-from-source - ``` - -3. To get all subject programs, run: - - ```sh - cd scripts - ./get-all-subject-src.sh - ``` diff --git a/scripts/mutation-randoop.sh b/scripts/mutation-randoop.sh index 7d9614c..6093797 100755 --- a/scripts/mutation-randoop.sh +++ b/scripts/mutation-randoop.sh @@ -42,7 +42,7 @@ USAGE_STRING="usage: mutation-randoop.sh [-h] [-v] [-r] [-f features] [-a] [-o R #------------------------------------------------------------------------------ # Prerequisites: #------------------------------------------------------------------------------ -# See file `mutation-prerequisites.md`. +# See file `prerequisites.md`. # Fail this script on errors. set -e diff --git a/scripts/prerequisites.md b/scripts/prerequisites.md new file mode 100644 index 0000000..cb860f6 --- /dev/null +++ b/scripts/prerequisites.md @@ -0,0 +1,51 @@ +# Prerequisites for running the scripts + +## Java Versions Setup + +Different scripts require different Java versions: + +* **Defect scripts** (via [Defects4J](https://github.com/rjust/defects4j)) +require **Java 11** +* **Mutation scripts** (via [Major](https://github.com/rjust/major)) +require **Java 8** + +To allow automatic switching between Java versions, set the following +environment variables in your shell configuration file +(e.g., `.bashrc`, `.zshrc`, or `.bash_profile`): + +```sh +export JAVA8_HOME=/path/to/your/java8 +export JAVA11_HOME=/path/to/your/java11 +``` + +## Required Tools + +* **Git** ≥ 1.9 +* **Subversion (svn)** ≥ 1.8 +* **Perl** ≥ 5.12 +* **cpanm** (Perl module installer) + To install `cpanm`: + ```sh + curl -L https://cpanmin.us | perl - App::cpanminus + ``` + +## Obtaining Dependencies and Subject Programs + +```sh +make -C scripts +make -C scripts randoop-from-source +cd scripts +./get-all-subject-src.sh +``` + +## Adding Defects4J to PATH + +For defect detection scripts, add Defects4J's executables to your PATH in +the shell session where you run the scripts: + +```sh +export PATH=$PATH:"path2defects4j"/framework/bin +``` + +> "path2defects4j" points to the directory which Defects4J is in; it most +likely will look like "currentdirectory/build/defects4j". From 7869ca13b3c01c1f84c3f5acb7c7aa8df2352372 Mon Sep 17 00:00:00 2001 From: Michael Ernst Date: Tue, 11 Nov 2025 15:56:51 -0800 Subject: [PATCH 3/6] Use standard Markdown item separator --- scripts/experiment-scripts/README.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/scripts/experiment-scripts/README.md b/scripts/experiment-scripts/README.md index 1a27279..dde74c6 100644 --- a/scripts/experiment-scripts/README.md +++ b/scripts/experiment-scripts/README.md @@ -26,17 +26,17 @@ shell script. For example, to generate **Figure 7**, use: Each script is documented at the top of the file with: -- What it generates (figure/table) -- What input parameters or configuration it expects -- What output files it will produce and where +* What it generates (figure/table) +* What input parameters or configuration it expects +* What output files it will produce and where ### Output Each experiment script writes its output to the `results/` directory. This includes: -- `results/[experiment].csv`: the raw collected data from multiple +* `results/[experiment].csv`: the raw collected data from multiple `mutation-randoop.sh` and/or `mutation-evosuite.sh` runs. -- `results/[experiment].pdf`: the final rendered figure(s) and/or table(s) for +* `results/[experiment].pdf`: the final rendered figure(s) and/or table(s) for the experiment. **Note:** Running an experiment script will overwrite any existing results for From 77740de4e1ff4e607f33a7b951e3632a27f4e73e Mon Sep 17 00:00:00 2001 From: Michael Ernst Date: Tue, 11 Nov 2025 16:02:49 -0800 Subject: [PATCH 4/6] Abstract out the generator name to reduce diffs --- scripts/mutation-evosuite.sh | 12 +++++++----- scripts/mutation-randoop.sh | 12 +++++++----- 2 files changed, 14 insertions(+), 10 deletions(-) diff --git a/scripts/mutation-evosuite.sh b/scripts/mutation-evosuite.sh index f1904ba..b563f1a 100755 --- a/scripts/mutation-evosuite.sh +++ b/scripts/mutation-evosuite.sh @@ -60,6 +60,8 @@ if [[ "$JAVA_VER" -ne 18 ]]; then exit 1 fi +Generator=EvoSuite +generator=evosuite SCRIPT_DIR="$(CDPATH='' cd -- "$(dirname -- "$0")" && pwd -P)" MAJOR_HOME=$(realpath "${SCRIPT_DIR}/build/major/") # Major home directory, for mutation testing EVOSUITE_JAR=$(realpath "${SCRIPT_DIR}/build/evosuite-1.2.0.jar") # EvoSuite jar file @@ -391,7 +393,7 @@ EVOSUITE_BASE_COMMAND=( #=============================================================================== # Build System Preparation #=============================================================================== -echo "Using EvoSuite to generate tests." +echo "Using ${Generator} to generate tests." echo # Handle relative and absolute output files; make sure output file exists. @@ -413,7 +415,7 @@ for i in $(seq 1 "$NUM_LOOP"); do FILE_SUFFIX="$SUBJECT_PROGRAM-EVOSUITE-$UUID" # Test directory for each iteration. - TEST_DIRECTORY="$SCRIPT_DIR/build/evosuite-tests/$FILE_SUFFIX" + TEST_DIRECTORY="$SCRIPT_DIR/build/$generator-tests/$FILE_SUFFIX" rm -rf "$TEST_DIRECTORY" mkdir -p "$TEST_DIRECTORY" @@ -442,13 +444,13 @@ for i in $(seq 1 "$NUM_LOOP"); do cd "$RESULT_DIR" - EVOSUITE_COMMAND=( + GENERATOR_COMMAND=( "${EVOSUITE_BASE_COMMAND[@]}" -Dtest_dir="$TEST_DIRECTORY" -Dreport_dir="$REPORT_DIRECTORY" ) - "${EVOSUITE_COMMAND[@]}" + "${GENERATOR_COMMAND[@]}" # After test generation, for JSAP-2.1, we need to remove the ant.jar from the classpath if [[ "$SUBJECT_PROGRAM" == "JSAP-2.1" ]]; then @@ -459,7 +461,7 @@ for i in $(seq 1 "$NUM_LOOP"); do # Coverage & Mutation Analysis #=============================================================================== - buildfile=build-evosuite.xml + buildfile="build-$generator.xml" echo echo "Compiling and mutating subject program..." diff --git a/scripts/mutation-randoop.sh b/scripts/mutation-randoop.sh index 7d9614c..d8ab624 100755 --- a/scripts/mutation-randoop.sh +++ b/scripts/mutation-randoop.sh @@ -64,6 +64,8 @@ if [[ "$JAVA_VER" -ne 18 ]]; then exit 1 fi +Generator=Randoop +generator=randoop SCRIPT_DIR="$(CDPATH='' cd -- "$(dirname -- "$0")" && pwd -P)" MAJOR_HOME=$(realpath "${SCRIPT_DIR}/build/major/") # Major home directory, for mutation testing RANDOOP_JAR=$(realpath "${SCRIPT_DIR}/build/randoop-all-4.3.4.jar") # Randoop jar file @@ -478,7 +480,7 @@ fi #=============================================================================== # Build System Preparation #=============================================================================== -echo "Using Randoop to generate tests." +echo "Using ${Generator} to generate tests." echo # Handle relative and absolute output files; make sure output file exists. @@ -510,7 +512,7 @@ for i in $(seq 1 "$NUM_LOOP"); do FILE_SUFFIX="$SUBJECT_PROGRAM-$FEATURE_NAME-$UUID" # Test directory for each iteration. - TEST_DIRECTORY="$SCRIPT_DIR/build/randoop-tests/$FILE_SUFFIX" + TEST_DIRECTORY="$SCRIPT_DIR/build/$generator-tests/$FILE_SUFFIX" rm -rf "$TEST_DIRECTORY" mkdir -p "$TEST_DIRECTORY" @@ -588,12 +590,12 @@ for i in $(seq 1 "$NUM_LOOP"); do cd "$RESULT_DIR" # shellcheck disable=SC2086 # FEATURE_FLAG may contain multiple arguments. - RANDOOP_COMMAND=( + GENERATOR_COMMAND=( "${RANDOOP_BASE_COMMAND[@]}" --junit-output-dir="$TEST_DIRECTORY" ) - "${RANDOOP_COMMAND[@]}" + "${GENERATOR_COMMAND[@]}" # Remove jacoco.exec file generated by Randoop rm -rf "$RESULT_DIR/jacoco.exec" @@ -607,7 +609,7 @@ for i in $(seq 1 "$NUM_LOOP"); do # Coverage & Mutation Analysis #=============================================================================== - buildfile=build-randoop.xml + buildfile="build-$generator.xml" echo echo "Compiling and mutating subject program..." From c19bbd7cbd5edc1bef8f185583d1f6c802823386 Mon Sep 17 00:00:00 2001 From: Michael Ernst Date: Tue, 25 Nov 2025 20:07:16 -0800 Subject: [PATCH 5/6] Formatting --- scripts/prerequisites.md | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/scripts/prerequisites.md b/scripts/prerequisites.md index 4a313d7..c8aba8e 100644 --- a/scripts/prerequisites.md +++ b/scripts/prerequisites.md @@ -10,6 +10,7 @@ * **Perl** ≥ 5.12 * **cpanm** (Perl module installer) To install `cpanm`: + ```sh curl -L https://cpanmin.us | perl - App::cpanminus ``` @@ -34,7 +35,9 @@ pip install pandas matplotlib seaborn ```sh uv pip install pandas matplotlib seaborn -```## Obtaining Dependencies and Subject Programs +``` + +## Obtaining Dependencies and Subject Programs ```sh make -C scripts @@ -52,8 +55,8 @@ the shell session where you run the scripts: export PATH=$PATH:"PATH2DEFECTS4J"/framework/bin ``` -> "PATH2DEFECTS4J" points to the directory which Defects4J is in; it most ->likely will look like "currentdirectory/build/defects4j". +where "PATH2DEFECTS4J" points to the directory which Defects4J is in; it most +likely will look like "currentdirectory/build/defects4j". ### Java Versions Setup From 95a06f3fcdb00f5fa6d7f309f3838d19e2f039e4 Mon Sep 17 00:00:00 2001 From: Michael Ernst Date: Tue, 25 Nov 2025 20:09:30 -0800 Subject: [PATCH 6/6] Remove duplication --- scripts/experiment-scripts/README.md | 22 ---------------------- 1 file changed, 22 deletions(-) diff --git a/scripts/experiment-scripts/README.md b/scripts/experiment-scripts/README.md index 4fbd1da..2bbf62e 100644 --- a/scripts/experiment-scripts/README.md +++ b/scripts/experiment-scripts/README.md @@ -14,28 +14,6 @@ figures and tables. To set up the environment, refer to the `scripts/prerequisites.md` file. -#### Python Dependencies - -Before running any experiment scripts, ensure the following Python packages are installed: - -* `pandas` -* `matplotlib` -* `seaborn` - -Install these packages using your preferred Python package manager. For example: - -**With pip:** - -```bash -pip install pandas matplotlib seaborn -``` - -**With uv:** - -```bash -uv pip install pandas matplotlib seaborn -``` - ### Running Scripts To generate the desired figures or tables from the paper, run the corresponding