Skip to content
Open
Show file tree
Hide file tree
Changes from 32 commits
Commits
Show all changes
63 commits
Select commit Hold shift + click to select a range
7793d51
Add checker-qual for running impurity obj fuzzing
776styjsu Jul 30, 2025
8f604c2
Move all subject program jars into jars/
776styjsu Jul 31, 2025
c69ea5d
Add the jars back
776styjsu Jul 31, 2025
8eda5bd
Remove version number for CF to reduce potential future refactor effort
776styjsu Jul 31, 2025
a7485fe
Less indentation for comments
mernst Aug 6, 2025
3ea8f45
Add annotated jars; use them when GRT_FUZZING is on
776styjsu Aug 8, 2025
2d08e1f
Merge branch 'impurity-annotation' of github.com:776styjsu/grt-testin…
776styjsu Aug 8, 2025
3d1d11a
Add annotated jars; use them when GRT_FUZZING is on; Merge
776styjsu Aug 8, 2025
5905a5a
Add missing separator
776styjsu Aug 8, 2025
ea2a440
Fix jdom dependencies path
776styjsu Aug 9, 2025
37bbb96
Update slf4j jar namespace; remove binders
776styjsu Aug 9, 2025
8b7c211
Merge branch 'randoop:main' into main
776styjsu Aug 10, 2025
cde99c4
Merge ../grt-testing-branch-main into impurity-annotation
mernst Aug 11, 2025
12cea4d
Merge branch 'main' into impurity-annotation
776styjsu Aug 11, 2025
5e6cc7d
Merge ../grt-testing-branch-main into impurity-annotation
mernst Aug 20, 2025
5e6e92e
Merge ../grt-testing-branch-main into impurity-annotation
mernst Sep 1, 2025
c5c5f91
Abstract out version number
mernst Sep 1, 2025
a35c932
Merge ../grt-testing-branch-main into impurity-annotation
mernst Sep 1, 2025
41297e7
Fix make issues
776styjsu Sep 11, 2025
0e3f50e
Fix make
776styjsu Sep 11, 2025
a9f0f73
Update scripts/Makefile
mernst Sep 11, 2025
659177e
Remove stray command-line arguments
mernst Sep 11, 2025
dd22826
Merge ../grt-testing-branch-main into impurity-annotation
mernst Oct 30, 2025
353d40c
Merge branch 'randoop:main' into impurity-annotation
776styjsu Oct 31, 2025
260ce15
Add README.md on building annotated subject-program jars
776styjsu Nov 1, 2025
79545fd
Update README.md
776styjsu Nov 1, 2025
4c6a19f
Update README.md
776styjsu Nov 1, 2025
ceb5b82
Update README.md
776styjsu Nov 1, 2025
5cc6053
Merge ../grt-testing-branch-main into impurity-annotation
mernst Nov 1, 2025
cc23b13
Merge ../grt-testing-branch-main into impurity-annotation
mernst Nov 13, 2025
7672dd7
Merge main into impurity-annotation
Nov 16, 2025
035b0c1
Fix linter
Nov 16, 2025
be4b6c6
Fix bug in grt fuzzing check
Nov 16, 2025
fab2301
Fix last linter
Nov 16, 2025
66b6429
Merge ../grt-testing-branch-main into impurity-annotation
mernst Nov 26, 2025
4635465
Only `sh` is needed, not full `bash`
mernst Nov 26, 2025
9fa1783
Fill paragraph
mernst Nov 26, 2025
a26c382
Brevity, fix `CHECKERFRAMEWORK` environment variable
mernst Nov 26, 2025
89e1db0
Checkpoint
mernst Dec 3, 2025
aa39829
Checkpoint
mernst Dec 4, 2025
affffe7
Linting
mernst Dec 4, 2025
8ead668
Use virtual environment
mernst Dec 4, 2025
c9b3bb3
Update .gitignore
mernst Dec 4, 2025
bd99141
Update subject-programs/get-grt-source.sh
mernst Dec 4, 2025
a8ed0f7
Update subject-programs/get-upstream-source.py
mernst Dec 4, 2025
59dde89
Update subject-programs/get-upstream-source.py
mernst Dec 4, 2025
6a42cb6
Update subject-programs/get-upstream-source.py
mernst Dec 4, 2025
462b22a
Update subject-programs/get-upstream-source.py
mernst Dec 4, 2025
02da047
Use local plume-scripts
mernst Dec 4, 2025
786ef0a
Use shlex
mernst Dec 4, 2025
5e87351
Merge branch 'impurity-annotation' of github.com:mernst/grt-testing i…
mernst Dec 4, 2025
41943cb
Diagnostics
mernst Dec 4, 2025
3bea3fc
Build more quietly
mernst Dec 4, 2025
c4c83e2
Use `uv`
mernst Dec 4, 2025
6f86438
ty typechecking
mernst Dec 4, 2025
d1253d1
Update instructions
mernst Dec 4, 2025
e216c95
Resolve CodeRabbit suggestions
mernst Dec 4, 2025
f73b8b2
Makefile
mernst Dec 5, 2025
50215bf
Merge ../grt-testing-branch-main into impurity-annotation
mernst Dec 5, 2025
c5870ae
Reduce duplication
mernst Dec 5, 2025
02b1993
Require Python 3.10
mernst Dec 6, 2025
e3465e2
Merge ../grt-testing-branch-main into impurity-annotation
mernst Dec 9, 2025
c7b8867
Exclude `subject-programs` from style checking
mernst Dec 9, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion scripts/Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
MAKEFILE_DIR := $(dir $(realpath $(lastword $(MAKEFILE_LIST))))

all: \
build/checker-framework/checker/dist/checker-qual.jar \
build/evosuite-1.2.0.jar \
build/evosuite-standalone-runtime-1.2.0.jar \
build/hamcrest-core-1.3.jar \
Expand Down Expand Up @@ -64,13 +65,21 @@ build/junit-4.12.jar:

build/hamcrest-core-1.3.jar:
mkdir -p build
cp ../subject-programs/hamcrest-core-1.3.jar build/
cp ../subject-programs/jars/hamcrest-core-1.3.jar build/

build/major/bin/ant-replacecall:
LATEST_RELEASE=$$(curl -s https://api.github.com/repos/randoop/grt-replacecall/releases/latest | grep -o '"tag_name": "[^"]*' | cut -d'"' -f4) && \
wget "https://github.com/randoop/grt-replacecall/releases/download/$${LATEST_RELEASE}/ant-replacecall" && \
mv ant-replacecall build/major/bin/

build/checker-framework/checker/dist/checker-qual.jar:
mkdir -p build
CFVER=3.50.0 && \
cd build && wget "https://github.com/typetools/checker-framework/releases/download/checker-framework-$${CFVER}/checker-framework-$${CFVER}.zip" && \
unzip -o checker-framework-$${CFVER}.zip && \
rm -rf checker-framework && \
mv checker-framework-$${CFVER} checker-framework

build/defects4j:
mkdir -p build
cd build && git clone https://github.com/rjust/defects4j && cd defects4j && cpanm --installdeps . && ./init.sh
Expand Down
4 changes: 2 additions & 2 deletions scripts/mutation-evosuite.sh
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ echo
SRC_BASE_DIR="$(realpath "$SCRIPT_DIR/../subject-programs/src/$SUBJECT_PROGRAM")"

# Path to the jar file of the subject program.
SRC_JAR=$(realpath "$SCRIPT_DIR/../subject-programs/$SUBJECT_PROGRAM.jar")
SRC_JAR=$(realpath "$SCRIPT_DIR/../subject-programs/jars/$SUBJECT_PROGRAM.jar")

# Number of classes in given jar file.
NUM_CLASSES=$(jar -tf "$SRC_JAR" | grep -c '.class')
Expand Down Expand Up @@ -318,7 +318,7 @@ case "$SUBJECT_PROGRAM" in
"$SRC_BASE_DIR/lib/jaxen-core.jar" \
"$SRC_BASE_DIR/lib/jaxen-jdom.jar" \
"$SRC_BASE_DIR/lib/saxpath.jar" \
"$SCRIPT_DIR/../subject-programs/jaxen-1.1.6.jar"
"$SCRIPT_DIR/../subject-programs/jars/jaxen-1.1.6.jar"
;;

"joda-time-2.3")
Expand Down
25 changes: 16 additions & 9 deletions scripts/mutation-randoop.sh
Original file line number Diff line number Diff line change
Expand Up @@ -56,12 +56,12 @@ set -o pipefail
Generator=Randoop
generator=randoop
SCRIPT_DIR="$(CDPATH='' cd -- "$(dirname -- "$0")" && pwd -P)"
SCRIPT_NAME=$(basename -- "$0")
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
JACOCO_AGENT_JAR=$(realpath "${SCRIPT_DIR}/build/jacocoagent.jar") # For Bloodhound
JACOCO_CLI_JAR=$(realpath "${SCRIPT_DIR}/build/jacococli.jar") # For coverage report generation
REPLACECALL_JAR=$(realpath "${SCRIPT_DIR}/build/replacecall-4.3.4.jar") # For replacing undesired method calls
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
JACOCO_AGENT_JAR=$(realpath "${SCRIPT_DIR}/build/jacocoagent.jar") # For Bloodhound
JACOCO_CLI_JAR=$(realpath "${SCRIPT_DIR}/build/jacococli.jar") # For coverage report generation
REPLACECALL_JAR=$(realpath "${SCRIPT_DIR}/build/replacecall-4.3.4.jar") # For replacing undesired method calls
CHECKER_QUAL_JAR=$(realpath "${SCRIPT_DIR}/build/checker-framework/checker/dist/checker-qual.jar") # For Randoop Impurity

. "$SCRIPT_DIR/defs.sh" # Define shell functions.

Expand All @@ -70,6 +70,7 @@ require_file "$RANDOOP_JAR"
require_file "$JACOCO_AGENT_JAR"
require_file "$JACOCO_CLI_JAR"
require_file "$REPLACECALL_JAR"
require_file "$CHECKER_QUAL_JAR"

usejdk8
JAVA_VER=$(java -version 2>&1 | awk -F '"' '/version/ {print $2}' | awk -F '.' '{sub("^$", "0", $2); print ($1=="1")?$2:$1}')
Expand Down Expand Up @@ -220,7 +221,13 @@ echo
SRC_BASE_DIR="$(realpath "$SCRIPT_DIR/../subject-programs/src/$SUBJECT_PROGRAM")"

# Path to the jar file of the subject program.
SRC_JAR=$(realpath "$SCRIPT_DIR/../subject-programs/$SUBJECT_PROGRAM.jar")
if [[ -n "${FEATURE_FLAGS[GRT_FUZZING]}" ]]; then
# If randoop features contain "GRT_FUZZING", use annotated subject program jar.
SRC_JAR=$(realpath "$SCRIPT_DIR/../subject-programs/annotated-jars/$SUBJECT_PROGRAM.jar")
else
# Else, use the original subject program jar.
SRC_JAR=$(realpath "$SCRIPT_DIR/../subject-programs/jars/$SUBJECT_PROGRAM.jar")
fi

# Number of classes in given jar file.
NUM_CLASSES=$(jar -tf "$SRC_JAR" | grep -c '.class')
Expand Down Expand Up @@ -353,7 +360,7 @@ case "$SUBJECT_PROGRAM" in
"$SRC_BASE_DIR/lib/jaxen-core.jar" \
"$SRC_BASE_DIR/lib/jaxen-jdom.jar" \
"$SRC_BASE_DIR/lib/saxpath.jar" \
"$SCRIPT_DIR/../subject-programs/jaxen-1.1.6.jar"
"$SCRIPT_DIR/../subject-programs/jars/jaxen-1.1.6.jar"
;;

"joda-time-2.3")
Expand Down Expand Up @@ -456,7 +463,7 @@ RANDOOP_BASE_COMMAND=(
-Xbootclasspath/a:"$JACOCO_AGENT_JAR:$REPLACECALL_JAR"
-javaagent:"$JACOCO_AGENT_JAR"
-javaagent:"$REPLACECALL_COMMAND"
-classpath "$RANDOOP_CLASSPATH:$RANDOOP_JAR"
-classpath "$RANDOOP_CLASSPATH:$RANDOOP_JAR:$CHECKER_QUAL_JAR"
randoop.main.Main
gentests
--testjar="$TARGET_JAR"
Expand Down
Binary file not shown.
Binary file added subject-programs/annotated-jars/JSAP-2.1.jar
Binary file not shown.
62 changes: 62 additions & 0 deletions subject-programs/annotated-jars/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
# Annotated Subject Program JARs

This folder holds the subject JARs after we run Checker Framework whole-program
inference and rewrite the sources with purity annotations. Compared to
`subject-programs/jars/`, the compiled bytecode here is the same, but the
underlying Java files now carry `@Pure`, `@SideEffectFree`, `@Impure`, and
related qualifiers from `org.checkerframework.framework.qual`. No other code or
resources are altered.

## Why the annotations matter

The `GRT_FUZZING` feature in `scripts/mutation-randoop.sh` loads these annotated artifacts and, for each method, determines whether it is pure (no state change) or impure (mutates the receiver, its arguments, or global state). During fuzzing, we prioritize impure calls to mutate an object’s state before exercising additional API entry points. This produces many more distinct runtime states than repeatedly calling pure methods, which in turn helps Randoop uncover deeper behaviors and tricky branch conditions.

## Rebuilding an annotated JAR

1. **Fetch sources** – Run `scripts/get-all-subject-src.sh` to populate
`subject-programs/src/<subject-program>/`.
2. **Build the plain JAR** – In the subject directory, run the build command
listed later (also see `subject-programs/README.build`). The result lands in
`subject-programs/jars/` or the subject’s usual build folder.
3. **Set up inference tooling** – Point your environment at the local Checker
Framework build:

```bash
export CHECKERFRAMEWORK=/path/to/grt-testing/scripts/build/checker-framework/checker
export PATH="$CHECKERFRAMEWORK/../annotation-file-utilities/bin:$PATH"
export JAVAC_JAR="$CHECKERFRAMEWORK/dist/javac.jar"
```

4. **Assemble the runtime classpath** – Start with the JAR you just built, then
append any dependencies:
- Ant projects usually ship extra JARs in a local `jars/` or `lib/` folder.
- Maven projects can generate a classpath with
`mvn -q dependency:build-classpath -Dmdep.outputFile=target/wpi-classpath.txt`.
5. **Run inference** – From the subject directory, execute:

```bash
$CHECKERFRAMEWORK/bin/infer-and-annotate.sh \
"org.checkerframework.framework.util.PurityChecker" \
"$RUNTIME_CLASSPATH" \
$(find src -name "*.java")
```

The script rewrites the sources in-place with the inferred annotations.
6. **Rebuild** – Repeat the command from step 2 to produce an annotated JAR.

### Worked example (a4j-1.0b)

```bash
cd subject-programs/src/a4j-1.0b
ant createJar # build the baseline JAR
export CHECKERFRAMEWORK=... # reuse the env vars above
export PATH="$CHECKERFRAMEWORK/../annotation-file-utilities/bin:$PATH"
export JAVAC_JAR="$CHECKERFRAMEWORK/dist/javac.jar"
RUNTIME_CLASSPATH="../../jars/a4j-1.0b.jar:jars/jox116.jar:jars/log4j-1.2.4.jar"
$CHECKERFRAMEWORK/bin/infer-and-annotate.sh \
"org.checkerframework.framework.util.PurityChecker" \
"$RUNTIME_CLASSPATH" \
$(find src -name "*.java")
ant createJar # rebuild with annotations
cp dist/a4j.jar ../../annotated-jars/a4j-1.0b.jar
```
Binary file added subject-programs/annotated-jars/a4j-1.0b.jar
Binary file not shown.
Binary file added subject-programs/annotated-jars/asm-5.0.1.jar
Binary file not shown.
Binary file added subject-programs/annotated-jars/bcel-5.2.jar
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added subject-programs/annotated-jars/easymock-3.2.jar
Binary file not shown.
Binary file not shown.
Binary file added subject-programs/annotated-jars/guava-16.0.1.jar
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added subject-programs/annotated-jars/jaxen-1.1.6.jar
Binary file not shown.
Binary file not shown.
Binary file added subject-programs/annotated-jars/jdom-1.0.jar
Binary file not shown.
Binary file not shown.
Binary file added subject-programs/annotated-jars/jvc-1.1.jar
Binary file not shown.
Binary file added subject-programs/annotated-jars/nekomud-r16.jar
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added subject-programs/annotated-jars/tiny-sql-2.26.jar
Binary file not shown.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.