Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add randoopBloodhound to supported generators #617

Merged
merged 6 commits into from
Oct 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 1 addition & 1 deletion developer/README_DEVELOPER.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Defects4J for Developers
================
This README provides background and information useful for someone updating
and/or modifing the Defects4J system. See [README.md](README.md) in this directory if
and/or modifing the Defects4J system. See [README.md](../README.md) in the root directory if
your primary interest is in using Defects4J for research.

How a user's Defects4J is initialized
Expand Down
20 changes: 19 additions & 1 deletion framework/lib/test_generation/bin/randoop.sh
Original file line number Diff line number Diff line change
Expand Up @@ -68,16 +68,34 @@ printf "\n(%s)" "$version" >&2
printf ".%.0s" \{1..expr 73 - length "$version"\} >&2
printf " " >&2

# Check to see if called from randoop.Bloodhound.sh and if so,
# modify the arguments to Randoop.
# Set standard arguments:
BOOT_CLASS_PATH_ARG="-Xbootclasspath/a:$D4J_DIR_TESTGEN_LIB/replacecall-current.jar"
EXTRA_JAVA_AGENT_ARG=""
METHOD_SELECTION_ARG=""

me=$(basename "$0")
echo Running $me

if [[ $me == *"Blood"* ]]; then
BOOT_CLASS_PATH_ARG="$BOOT_CLASS_PATH_ARG:$D4J_DIR_TESTGEN_LIB/jacocoagent.jar"
EXTRA_JAVA_AGENT_ARG="-javaagent:$D4J_DIR_TESTGEN_LIB/jacocoagent.jar"
METHOD_SELECTION_ARG="--method-selection=BLOODHOUND"
fi

# The most common package in file $D4J_FILE_TARGET_CLASSES.
# TODO: Determine the set of all distinct packages and invoke Randoop multiple times with different packages.
PACKAGE=$(sed 's/\.[A-Za-z_$][^.]*$//' "$D4J_FILE_TARGET_CLASSES" | uniq -c | sort -rn | sed -E 's/^ *[0-9]+ //g' | head -1)

# Build the test-generation command
cmd="java -ea -classpath $project_cp:$D4J_DIR_TESTGEN_LIB/randoop-current.jar \
-Xbootclasspath/a:$D4J_DIR_TESTGEN_LIB/replacecall-current.jar \
$BOOT_CLASS_PATH_ARG \
-javaagent:$D4J_DIR_TESTGEN_LIB/replacecall-current.jar \
-javaagent:$D4J_DIR_TESTGEN_LIB/covered-class-current.jar \
$EXTRA_JAVA_AGENT_ARG \
randoop.main.Main gentests \
$METHOD_SELECTION_ARG \
--classlist=$D4J_DIR_WORKDIR/classes.randoop \
--require-covered-classes=$D4J_FILE_TARGET_CLASSES \
--junit-package-name=$PACKAGE \
Expand Down
1 change: 1 addition & 0 deletions framework/lib/test_generation/bin/randoopBloodhound.sh