From ac9c0037d804b0053fd8efe0f5fe2df7336c9d41 Mon Sep 17 00:00:00 2001 From: Mark Roberts Date: Tue, 3 Sep 2024 12:06:25 -0700 Subject: [PATCH 01/10] Update Randoop to 4.3.3 --- init.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/init.sh b/init.sh index 8f184d106..2c92574cf 100755 --- a/init.sh +++ b/init.sh @@ -167,7 +167,7 @@ cd "$DIR_LIB_RT" && download_url "$EVOSUITE_URL/$EVOSUITE_RT_JAR" # echo echo "Setting up Randoop ... " -RANDOOP_VERSION="4.2.5" +RANDOOP_VERSION="4.3.3" RANDOOP_URL="https://github.com/randoop/randoop/releases/download/v${RANDOOP_VERSION}" RANDOOP_ZIP="randoop-${RANDOOP_VERSION}.zip" RANDOOP_JAR="randoop-all-${RANDOOP_VERSION}.jar" @@ -178,6 +178,7 @@ COVEREDCLASS_JAR="covered-class-${RANDOOP_VERSION}.jar" (cd "$DIR_LIB_GEN" && ln -sf "randoop-${RANDOOP_VERSION}/$RANDOOP_JAR" "randoop-current.jar") (cd "$DIR_LIB_GEN" && ln -sf "randoop-${RANDOOP_VERSION}/$REPLACECALL_JAR" "replacecall-current.jar") (cd "$DIR_LIB_GEN" && ln -sf "randoop-${RANDOOP_VERSION}/$COVEREDCLASS_JAR" "covered-class-current.jar") +(cd "$DIR_LIB_GEN" && ln -sf "randoop-${RANDOOP_VERSION}/jacocoagent.jar" "jacocoagent.jar") ################################################################################ # From e86f814842979912320b3c43049e3d502ed83979 Mon Sep 17 00:00:00 2001 From: Michael Ernst Date: Fri, 6 Sep 2024 15:53:08 -0700 Subject: [PATCH 02/10] Address shellcheck warnings --- .../lib/test_generation/bin/_tool.source | 2 +- framework/test/test_bug_mining.sh | 7 +++--- framework/test/test_cp.sh | 2 +- framework/test/test_d4j_query.sh | 6 ++--- framework/test/test_export_command.sh | 2 +- framework/test/test_fix_test_suite.sh | 2 +- framework/test/test_gen_tests.sh | 2 +- framework/test/test_monitor_test.sh | 6 ++--- framework/test/test_mutation_analysis.sh | 10 ++++---- framework/test/test_mutation_cmd.sh | 24 +++++++++---------- framework/test/test_sanity_check.sh | 2 +- framework/test/test_tutorial.sh | 2 +- framework/test/test_verify_bugs.sh | 8 +++---- 13 files changed, 37 insertions(+), 38 deletions(-) diff --git a/framework/lib/test_generation/bin/_tool.source b/framework/lib/test_generation/bin/_tool.source index 991ac7f3c..3a2f56707 100755 --- a/framework/lib/test_generation/bin/_tool.source +++ b/framework/lib/test_generation/bin/_tool.source @@ -24,7 +24,7 @@ die() { check_env() { local var="$1" local val - val="$(eval echo \$$var)" + val="$(eval echo \$"$var")" [ -z "$val" ] && die "Variable $var not set!" } diff --git a/framework/test/test_bug_mining.sh b/framework/test/test_bug_mining.sh index bfe68a795..7d57f3ac1 100755 --- a/framework/test/test_bug_mining.sh +++ b/framework/test/test_bug_mining.sh @@ -7,7 +7,7 @@ set -e -HERE=$(cd "$(dirname "$0")" && pwd) || (echo "cannot cd to $(dirname "$0")" && exit 1) +HERE="$(cd "$(dirname "$0")" && pwd)" || (echo "cannot cd to $(dirname "$0")" && exit 1) # Import helper subroutines and variables, and init Defects4J source "$HERE/test.include" || exit 1 @@ -16,7 +16,6 @@ init BUG_MINING_FRAMEWORK_DIR="$BASE_DIR/framework/bug-mining" [ -d "$BUG_MINING_FRAMEWORK_DIR" ] || die "$BUG_MINING_FRAMEWORK_DIR does not exist" -RESOURCES_INPUT_DIR="$HERE/resources/input/bug-mining" RESOURCES_OUTPUT_DIR="$HERE/resources/output/bug-mining" _check_output() { @@ -233,8 +232,8 @@ test_analyze_project() { [ -s "$work_dir/$failing_tests" ] || die "No failing test cases has been reported" # Same number of failing tests - local actual_num_failing_tests; actual_num_failing_tests=$(grep -a "^--- " "$work_dir/$failing_tests" | wc -l) - local expected_num_failing_tests; expected_num_failing_tests=$(grep -a "^--- " "$RESOURCES_OUTPUT_DIR/$failing_tests" | wc -l) + local actual_num_failing_tests; actual_num_failing_tests=$(grep -c -a "^--- " "$work_dir/$failing_tests") + local expected_num_failing_tests; expected_num_failing_tests=$(grep -c -a "^--- " "$RESOURCES_OUTPUT_DIR/$failing_tests") if [ "$actual_num_failing_tests" -ne "$expected_num_failing_tests" ]; then echo "Expected failing tests:" grep -a "^--- " "$RESOURCES_OUTPUT_DIR/$failing_tests" diff --git a/framework/test/test_cp.sh b/framework/test/test_cp.sh index f91c3ae26..b65cb8573 100755 --- a/framework/test/test_cp.sh +++ b/framework/test/test_cp.sh @@ -5,7 +5,7 @@ # ################################################################################ -HERE=$(cd "$(dirname "$0")" && pwd) || (echo "cannot cd to $(dirname "$0")" && exit 1) +HERE="$(cd "$(dirname "$0")" && pwd)" || (echo "cannot cd to $(dirname "$0")" && exit 1) # Import helper subroutines and variables, and init Defects4J source "$HERE/test.include" || exit 1 diff --git a/framework/test/test_d4j_query.sh b/framework/test/test_d4j_query.sh index ccc5d43ac..9e5a5a1f4 100755 --- a/framework/test/test_d4j_query.sh +++ b/framework/test/test_d4j_query.sh @@ -5,14 +5,14 @@ # ################################################################################ -HERE=$(cd "$(dirname "$0")" && pwd) || (echo "cannot cd to $(dirname "$0")" && exit 1) +HERE="$(cd "$(dirname "$0")" && pwd)" || (echo "cannot cd to $(dirname "$0")" && exit 1) # Import helper subroutines and variables, and init Defects4J source "$HERE/test.include" || exit 1 init -$BASE_DIR/framework/bin/defects4j query -p Collections -H >> $HERE"/temp" -result=`diff $HERE/temp $HERE/resources/output/d4j-query/1` +"$BASE_DIR"/framework/bin/defects4j query -p Collections -H >> "$HERE"/temp +result=$(diff "$HERE"/temp "$HERE"/resources/output/d4j-query/1) [ "$result" == "" ] || die "query \"-p Collections\" -H failed: $result" diff --git a/framework/test/test_export_command.sh b/framework/test/test_export_command.sh index ab36b358e..ed3daee86 100755 --- a/framework/test/test_export_command.sh +++ b/framework/test/test_export_command.sh @@ -10,7 +10,7 @@ # ################################################################################ -HERE=$(cd "$(dirname "$0")" && pwd) || (echo "cannot cd to $(dirname "$0")" && exit 1) +HERE="$(cd "$(dirname "$0")" && pwd)" || (echo "cannot cd to $(dirname "$0")" && exit 1) # Import helper subroutines and variables, and init Defects4J source "$HERE/test.include" || exit 1 diff --git a/framework/test/test_fix_test_suite.sh b/framework/test/test_fix_test_suite.sh index 9960c7a40..44f11440f 100755 --- a/framework/test/test_fix_test_suite.sh +++ b/framework/test/test_fix_test_suite.sh @@ -5,7 +5,7 @@ # ################################################################################ -HERE=$(cd "$(dirname "$0")" && pwd) || (echo "cannot cd to $(dirname "$0")" && exit 1) +HERE="$(cd "$(dirname "$0")" && pwd)" || (echo "cannot cd to $(dirname "$0")" && exit 1) # Import helper subroutines and variables, and init Defects4J source "$HERE/test.include" || exit 1 diff --git a/framework/test/test_gen_tests.sh b/framework/test/test_gen_tests.sh index 1a43e66d1..04ada7eef 100755 --- a/framework/test/test_gen_tests.sh +++ b/framework/test/test_gen_tests.sh @@ -12,7 +12,7 @@ # ################################################################################ -HERE=$(cd `dirname $0` && pwd) +HERE="$(cd "$(dirname "$0")" && pwd)" || (echo "cannot cd to $(dirname "$0")" && exit 1) # Import helper subroutines and variables, and init Defects4J source "$HERE/test.include" || exit 1 diff --git a/framework/test/test_monitor_test.sh b/framework/test/test_monitor_test.sh index 3843b3079..fef880bb2 100755 --- a/framework/test/test_monitor_test.sh +++ b/framework/test/test_monitor_test.sh @@ -6,7 +6,7 @@ # ################################################################################ -HERE=$(cd `dirname $0` && pwd) +HERE="$(cd "$(dirname "$0")" && pwd)" || (echo "cannot cd to $(dirname "$0")" && exit 1) # Import helper subroutines and variables, and init Defects4J source "$HERE/test.include" || exit 1 @@ -18,11 +18,11 @@ vid=${bid}f work_dir=$TMP_DIR/$pid-$vid # Checkout buggy version -defects4j checkout -p $pid -v $vid -w $work_dir || die "checkout program version $pid-$vid" +defects4j checkout -p $pid -v $vid -w "$work_dir" || die "checkout program version $pid-$vid" actual="$(mktemp)" expected="resources/monitor.test.expected" # Compile buggy version -defects4j monitor.test -t org.apache.commons.codec.binary.HexTest -w $work_dir > "$actual" || die "compile program version $pid-$vid" +defects4j monitor.test -t org.apache.commons.codec.binary.HexTest -w "$work_dir" > "$actual" || die "compile program version $pid-$vid" cmp "$actual" "$expected" || die "compare actual vs. expected output: $actual vs. $expected" diff --git a/framework/test/test_mutation_analysis.sh b/framework/test/test_mutation_analysis.sh index d2579711c..b42c8a316 100755 --- a/framework/test/test_mutation_analysis.sh +++ b/framework/test/test_mutation_analysis.sh @@ -7,7 +7,7 @@ # TODO: There is some code duplication in this test script, which we can avoid # by extracting the mutation analysis workflow into a parameterized function. -HERE=$(cd "$(dirname "$0")" && pwd) || (echo "cannot cd to $(dirname "$0")" && exit 1) +HERE="$(cd "$(dirname "$0")" && pwd)" || (echo "cannot cd to $(dirname "$0")" && exit 1) # Import helper subroutines and variables, and init Defects4J source "$HERE/test.include" || exit 1 @@ -56,10 +56,10 @@ _check_mutation_result() { # Columns of summary (csv) file: # MutantsGenerated,MutantsRetained,MutantsCovered,MutantsKilled,MutantsLive,RuntimePreprocSeconds,RuntimeAnalysisSeconds - local act_mut_gen=$(tail -n1 "$summary_file" | cut -f1 -d',') - local act_mut_ret=$(tail -n1 "$summary_file" | cut -f2 -d',') - local act_mut_cov=$(tail -n1 "$summary_file" | cut -f3 -d',') - local act_mut_kill=$(tail -n1 "$summary_file" | cut -f4 -d',') + local act_mut_gen; act_mut_gen=$(tail -n1 "$summary_file" | cut -f1 -d',') + local act_mut_ret; act_mut_ret=$(tail -n1 "$summary_file" | cut -f2 -d',') + local act_mut_cov; act_mut_cov=$(tail -n1 "$summary_file" | cut -f3 -d',') + local act_mut_kill; act_mut_kill=$(tail -n1 "$summary_file" | cut -f4 -d',') [ "$act_mut_gen" -eq "$exp_mut_gen" ] || die "Unexpected number of mutants generated (expected: $exp_mut_gen, actual: $act_mut_gen)!" [ "$act_mut_ret" -eq "$exp_mut_ret" ] || die "Unexpected number of mutants retained (expected: $exp_mut_ret, actual: $act_mut_ret)!" diff --git a/framework/test/test_mutation_cmd.sh b/framework/test/test_mutation_cmd.sh index df0e0c83c..33e0446aa 100755 --- a/framework/test/test_mutation_cmd.sh +++ b/framework/test/test_mutation_cmd.sh @@ -16,7 +16,7 @@ source test.include # Print usage message and exit usage() { - local known_pids=$(defects4j pids) + local known_pids; known_pids=$(defects4j pids) echo "usage: $0 -p [-b ... | -b ... ]" echo "Project ids:" for pid in $known_pids; do @@ -31,9 +31,9 @@ while getopts ":p:b:" opt; do p) PID="$OPTARG" ;; b) if [[ "$OPTARG" =~ ^[0-9]*\.\.[0-9]*$ ]]; then - BUGS="$BUGS $(eval echo {$OPTARG})" + BUGS="$BUGS $(eval echo \{"$OPTARG"\})" else - BUGS="$BUGS $OPTARG" + BUGS="$BUGS $OPTARG" fi ;; \?) @@ -59,20 +59,20 @@ init # Run all bugs, unless otherwise specified if [ "$BUGS" == "" ]; then - BUGS="$(get_bug_ids $BASE_DIR/framework/projects/$PID/$BUGS_CSV_ACTIVE)" + BUGS="$(get_bug_ids "$BASE_DIR/framework/projects/$PID/$BUGS_CSV_ACTIVE")" fi # Create log file -script_name=$(echo $script | sed 's/\.sh$//') -LOG="$TEST_DIR/${script_name}$(printf '_%s_%s' $PID $$).log" -OUT_DIR="$TEST_DIR/${script_name}$(printf '_%s_%s' $PID $$).mutation_summary" -mkdir -p $OUT_DIR +script_name_without_sh=${script//.sh/} +LOG="$TEST_DIR/${script_name_without_sh}$(printf '_%s_%s' "$PID" $$).log" +OUT_DIR="$TEST_DIR/${script_name_without_sh}$(printf '_%s_%s' "$PID" $$).mutation_summary" +mkdir -p "$OUT_DIR" # Reproduce all bugs (and log all results), regardless of whether errors occur HALT_ON_ERROR=0 test_dir=$(mktemp -d) -for bid in $(echo $BUGS); do +for bid in $BUGS; do # Skip all bug ids that do not exist in the active-bugs csv if ! grep -q "^$bid," "$BASE_DIR/framework/projects/$PID/$BUGS_CSV_ACTIVE"; then warn "Skipping bug ID that is not listed in active-bugs csv: $PID-$bid" @@ -82,12 +82,12 @@ for bid in $(echo $BUGS); do # Test mutation analysis for the fixed version only. vid="${bid}f" work_dir="$test_dir/$PID-$vid" - defects4j checkout -p $PID -v "$vid" -w "$work_dir" || die "checkout: $PID-$vid" + defects4j checkout -p "$PID" -v "$vid" -w "$work_dir" || die "checkout: $PID-$vid" defects4j mutation -w "$work_dir" || die "mutation: $PID-$vid" cat "$work_dir/summary.csv" > "$OUT_DIR/$bid" done -rm -rf $test_dir +rm -rf "$test_dir" HALT_ON_ERROR=1 # Print a summary of what went wrong @@ -95,7 +95,7 @@ if [ $ERROR != 0 ]; then printf '=%.s' $(seq 1 80) 1>&2 echo 1>&2 echo "The following errors occurred:" 1>&2 - cat $LOG 1>&2 + cat "$LOG" 1>&2 fi # Indicate whether an error occurred diff --git a/framework/test/test_sanity_check.sh b/framework/test/test_sanity_check.sh index 71b6f8a15..49c4dd3be 100755 --- a/framework/test/test_sanity_check.sh +++ b/framework/test/test_sanity_check.sh @@ -5,7 +5,7 @@ # ################################################################################ -HERE=$(cd `dirname $0` && pwd) +HERE="$(cd "$(dirname "$0")" && pwd)" || (echo "cannot cd to $(dirname "$0")" && exit 1) # Import helper subroutines and variables, and init Defects4J source "$HERE/test.include" || exit 1 diff --git a/framework/test/test_tutorial.sh b/framework/test/test_tutorial.sh index 06fa6fb49..81007047b 100755 --- a/framework/test/test_tutorial.sh +++ b/framework/test/test_tutorial.sh @@ -5,7 +5,7 @@ # ################################################################################ -HERE=$(cd `dirname $0` && pwd) +HERE="$(cd "$(dirname "$0")" && pwd)" || (echo "cannot cd to $(dirname "$0")" && exit 1) # Import helper subroutines and variables, and init Defects4J source "$HERE/test.include" || exit 1 diff --git a/framework/test/test_verify_bugs.sh b/framework/test/test_verify_bugs.sh index 65e94946f..46b5d50a6 100755 --- a/framework/test/test_verify_bugs.sh +++ b/framework/test/test_verify_bugs.sh @@ -17,7 +17,7 @@ # ################################################################################ -HERE=$(cd `dirname $0` && pwd) +HERE="$(cd "$(dirname "$0")" && pwd)" || (echo "cannot cd to $(dirname "$0")" && exit 1) # Import helper subroutines and variables, and init Defects4J source "$HERE/test.include" || exit 1 @@ -25,7 +25,7 @@ init # Print usage message and exit usage() { - local known_pids=$(defects4j pids) + local known_pids; known_pids=$(defects4j pids) echo "usage: $0 -p [-b ... | -b ... ] [-D]" echo "Project ids:" for pid in $known_pids; do @@ -115,7 +115,7 @@ for bid in $BUGS ; do vid=${bid}$v defects4j checkout -p "$PID" -v "$vid" -w "$work_dir" || die "checkout: $PID-$vid" defects4j compile -w "$work_dir" || die "compile: $PID-$vid" - defects4j test $TEST_FLAG -w "$work_dir" || die "run relevant tests: $PID-$vid" + defects4j test "$TEST_FLAG" -w "$work_dir" || die "run relevant tests: $PID-$vid" cat "$work_dir/failing_tests" > "$DIR_FAILING/$vid" @@ -143,7 +143,7 @@ for bid in $BUGS ; do done if [ "$DEBUG" != "-D" ]; then - rm -rf $TMP_DIR + rm -rf "$TMP_DIR" fi HALT_ON_ERROR=1 From 95c679b34bdc98c6f777af4de93ee991d1ba7c56 Mon Sep 17 00:00:00 2001 From: Michael Ernst Date: Fri, 6 Sep 2024 15:54:31 -0700 Subject: [PATCH 03/10] Install checkbashisms --- .github/workflows/ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 8b42759e4..b5fecdc6f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -30,8 +30,8 @@ jobs: export JAVA_HOME=$HOME/.java/$JDK_DIR echo "JAVA_HOME=$JAVA_HOME" >> $GITHUB_ENV echo "$JAVA_HOME/bin" >> $GITHUB_PATH - - name: Install diffstat - run: sudo apt-get install diffstat + - name: Install diffstat and checkbashisms + run: sudo apt-get -y install diffstat devscripts - name: Install Carton uses: perl-actions/install-with-cpanm@v1 with: From 0b45378899e7c9573ab059f13a67b46e649dad42 Mon Sep 17 00:00:00 2001 From: Michael Ernst Date: Fri, 6 Sep 2024 17:22:29 -0700 Subject: [PATCH 04/10] Undo a change --- framework/lib/test_generation/bin/_tool.source | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/framework/lib/test_generation/bin/_tool.source b/framework/lib/test_generation/bin/_tool.source index 3a2f56707..eba018413 100755 --- a/framework/lib/test_generation/bin/_tool.source +++ b/framework/lib/test_generation/bin/_tool.source @@ -24,7 +24,8 @@ die() { check_env() { local var="$1" local val - val="$(eval echo \$"$var")" + # shellcheck disable=SC2086 + val="$(eval echo \$$var)" [ -z "$val" ] && die "Variable $var not set!" } From fdcce34fdc4a899391b248403a3cdd5246a084b2 Mon Sep 17 00:00:00 2001 From: Michael Ernst Date: Sat, 7 Sep 2024 03:37:16 -0700 Subject: [PATCH 05/10] Undo a change --- framework/test/test_mutation_cmd.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/framework/test/test_mutation_cmd.sh b/framework/test/test_mutation_cmd.sh index 33e0446aa..de0eb9b5b 100755 --- a/framework/test/test_mutation_cmd.sh +++ b/framework/test/test_mutation_cmd.sh @@ -31,7 +31,8 @@ while getopts ":p:b:" opt; do p) PID="$OPTARG" ;; b) if [[ "$OPTARG" =~ ^[0-9]*\.\.[0-9]*$ ]]; then - BUGS="$BUGS $(eval echo \{"$OPTARG"\})" + # shellcheck disable=SC1083,2086 + BUGS="$BUGS $(eval echo {$OPTARG})" else BUGS="$BUGS $OPTARG" fi From 373f7ca516222dc1061e2e44621c7ffd6146ed3f Mon Sep 17 00:00:00 2001 From: Michael Ernst Date: Sat, 7 Sep 2024 04:24:52 -0700 Subject: [PATCH 06/10] Undo a change --- framework/test/test_verify_bugs.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/framework/test/test_verify_bugs.sh b/framework/test/test_verify_bugs.sh index 46b5d50a6..1e24fad0d 100755 --- a/framework/test/test_verify_bugs.sh +++ b/framework/test/test_verify_bugs.sh @@ -115,7 +115,7 @@ for bid in $BUGS ; do vid=${bid}$v defects4j checkout -p "$PID" -v "$vid" -w "$work_dir" || die "checkout: $PID-$vid" defects4j compile -w "$work_dir" || die "compile: $PID-$vid" - defects4j test "$TEST_FLAG" -w "$work_dir" || die "run relevant tests: $PID-$vid" + defects4j test $TEST_FLAG -w "$work_dir" || die "run relevant tests: $PID-$vid" cat "$work_dir/failing_tests" > "$DIR_FAILING/$vid" From b0e9557c59cc035133b4166fb1cb4de80e011880 Mon Sep 17 00:00:00 2001 From: Michael Ernst Date: Sat, 7 Sep 2024 04:25:52 -0700 Subject: [PATCH 07/10] Rename variable for clarity --- framework/test/test_verify_bugs.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/framework/test/test_verify_bugs.sh b/framework/test/test_verify_bugs.sh index 1e24fad0d..c84bdc4c0 100755 --- a/framework/test/test_verify_bugs.sh +++ b/framework/test/test_verify_bugs.sh @@ -35,14 +35,14 @@ usage() { } # Run only relevant tests by default -TEST_FLAG="-r" +TEST_FLAG_OR_EMPTY="-r" # Debugging is off by default DEBUG="" # Check arguments while getopts ":p:b:AD" opt; do case $opt in - A) TEST_FLAG="" + A) TEST_FLAG_OR_EMPTY="" ;; D) DEBUG="-D" ;; @@ -115,7 +115,7 @@ for bid in $BUGS ; do vid=${bid}$v defects4j checkout -p "$PID" -v "$vid" -w "$work_dir" || die "checkout: $PID-$vid" defects4j compile -w "$work_dir" || die "compile: $PID-$vid" - defects4j test $TEST_FLAG -w "$work_dir" || die "run relevant tests: $PID-$vid" + defects4j test $TEST_FLAG_OR_EMPTY -w "$work_dir" || die "run relevant tests: $PID-$vid" cat "$work_dir/failing_tests" > "$DIR_FAILING/$vid" From da07d97b1bb0fc20b3f80af783d0c0b17e1a3f19 Mon Sep 17 00:00:00 2001 From: Michael Ernst Date: Sat, 7 Sep 2024 12:22:28 -0700 Subject: [PATCH 08/10] Remove trailing blank line --- framework/test/test_style.sh | 1 - 1 file changed, 1 deletion(-) diff --git a/framework/test/test_style.sh b/framework/test/test_style.sh index 45631b40b..814e45619 100755 --- a/framework/test/test_style.sh +++ b/framework/test/test_style.sh @@ -19,4 +19,3 @@ done for file in "$TOPLEVEL"/init.sh "$TOPLEVEL"/framework/lib/test_generation/bin/_tool.source ; do shellcheck -x -P SCRIPTDIR --format=gcc "$file" done - From 9ccee247b5160170e9ec9e7b97814fb7614deed0 Mon Sep 17 00:00:00 2001 From: Michael Ernst Date: Sat, 7 Sep 2024 12:36:40 -0700 Subject: [PATCH 09/10] Notes about style checking --- README_DEVELOPER.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/README_DEVELOPER.md b/README_DEVELOPER.md index f56b126ed..6397cf40e 100755 --- a/README_DEVELOPER.md +++ b/README_DEVELOPER.md @@ -148,3 +148,9 @@ final data set, if this is still the case. Related, the test patches (.test.patch) stored in the repo are also not used. I think we should remove these as well. Source patches are manually minimized, but test patches are not -- these can be easily regenerated by running a diff between the buggy and fixed revisions. + +#### Style + +Because shell scripts are error-prone, we run a style checker on them. CI will +not pass if the style checker issues warnings. Please address each warning by +either correcting the problem or suppressing the warning. From 22ca1dbf90fda49b779ad4b720e3c1cb15d83947 Mon Sep 17 00:00:00 2001 From: Michael Ernst Date: Sat, 7 Sep 2024 12:53:10 -0700 Subject: [PATCH 10/10] Remove shellcheck disable --- framework/lib/test_generation/bin/randoop.sh | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/framework/lib/test_generation/bin/randoop.sh b/framework/lib/test_generation/bin/randoop.sh index e5562199b..9d7b08663 100755 --- a/framework/lib/test_generation/bin/randoop.sh +++ b/framework/lib/test_generation/bin/randoop.sh @@ -65,8 +65,7 @@ ERR_BASE_NAME=ErrorTest #shellcheck disable=SC2153 # D4J_DIR_TESTGEN_LIB is not a typo of D4J_DIR_TESTGEN_BIN version=$(java -cp "$D4J_DIR_TESTGEN_LIB/randoop-current.jar" randoop.main.Main | head -1) printf "\n(%s)" "$version" >&2 -# shellcheck disable=SC1083 -printf ".%.0s" {1..expr 73 - length "$version"} >&2 +printf ".%.0s" \{1..expr 73 - length "$version"\} >&2 printf " " >&2 # The most common package in file $D4J_FILE_TARGET_CLASSES.