Skip to content

Commit

Permalink
Updated git bisect scripts to accept more arguments
Browse files Browse the repository at this point in the history
Update git bisect runner arguments order
  • Loading branch information
wtrzas2 committed Nov 15, 2024
1 parent 93a91de commit f81bc44
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 21 deletions.
47 changes: 28 additions & 19 deletions auto-check-fix-commit/git-bisect-runner.sh
Original file line number Diff line number Diff line change
@@ -1,26 +1,35 @@
#!/bin/bash

for arg in "$@"; do
shift
case "$arg" in
'--flaky') set -- "$@" '-f' ;;
'--fixed') set -- "$@" '-x' ;;
'--module') set -- "$@" '-m' ;;
'--test') set -- "$@" '-t' ;;
*) set -- "$@" "$arg" ;;
mvn_options=""
nondex_version=""
flaky_commit=""
fixed_commit=""
test_module=""
test_case=""

while [[ $# -gt 0 ]]; do
case "$1" in
'--flaky') flaky_commit="$2"; shift 2 ;;
'--fixed') fixed_commit="$2"; shift 2 ;;
'--module') test_module="$2"; shift 2 ;;
'--test') test_case="$2"; shift 2 ;;
'--nondex-version') nondex_version="$2"; shift 2 ;;
'--mvn-install') mvn_options="$2"; shift 2 ;;
*) echo "Unknown argument: $1"; exit 1 ;;
esac
done

OPTIND=1
while getopts "f:x:m:t:" opt; do
case "$opt" in
'f') flaky_commit=$OPTARG ;;
'x') fixed_commit=$OPTARG ;;
'm') test_module=$OPTARG ;;
't') test_case=$OPTARG ;;
esac
done
shift $(expr $OPTIND - 1)
echo "Flaky Commit: $flaky_commit"
echo "Fixed Commit: $fixed_commit"
echo "Test Module: $test_module"
echo "Test Case: $test_case"
echo "NonDex Version: $nondex_version"
echo "Maven Options: $mvn_options"

if [[ -z "$flaky_commit" || -z "$fixed_commit" || -z "$test_module" || -z "$test_case" || -z "$nondex_version" ]]; then
echo "Error: Missing required argument(s)."
exit 1
fi

git checkout $fixed_commit

Expand All @@ -32,4 +41,4 @@ git checkout $flaky_commit

git bisect good

git bisect run ./git-bisect-script.sh $test_module $test_case
git bisect run ./git-bisect-script.sh $test_module $test_case "$nondex_version" "$mvn_options"
6 changes: 4 additions & 2 deletions auto-check-fix-commit/git-bisect-script.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,16 @@ echo "Started Execution"

test_module=$1
test_case=$2
nondex_version=$3
mvn_options=$4

echo "Started Build"
mvn clean install -pl $test_module -am -DskipTests -Dlicense.skip
mvn clean install -pl $test_module -am -DskipTests -Dlicense.skip $mvn_options
if [[ "$?" -ne 0 ]]; then
echo "Build Failed"
exit 1
else
mvn -pl $test_module edu.illinois:nondex-maven-plugin:1.1.2:nondex -Dtest=$test_case -DnondexRuns=5 -Dlicense.skip=true
mvn -pl $test_module edu.illinois:nondex-maven-plugin:$nondex_version:nondex -Dtest=$test_case -DnondexRuns=5 -Dlicense.skip=true
if [[ "$?" -ne 0 ]]; then
echo "NonDex Test Failed"
exit 0
Expand Down

0 comments on commit f81bc44

Please sign in to comment.