gerlowskija commented on code in PR #124:
URL: https://github.com/apache/solr-sandbox/pull/124#discussion_r2407660974
##########
scripts/gatling/run-benchmark-on-commits.sh:
##########
@@ -0,0 +1,102 @@
+#!/bin/bash -x
+
+set -eu
+
+SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
+LIB_DIR="$SCRIPT_DIR/lib"
+SANDBOX_CHECKOUT_ROOT="$SCRIPT_DIR/../../"
+source $LIB_DIR/env-state.sh
+source $LIB_DIR/git.sh
+source $LIB_DIR/solr.sh
+source $LIB_DIR/gatling.sh
+
+###########################
+# "Main" - begin arg parsing
+COMMIT_HASHES=""
+START_HASH=""
+END_HASH=""
+BRANCH="main"
+
+if [ $# -gt 0 ]; then
+ while [ $# -gt 0 ]; do
+ case "${1:-}" in
+ # Inclusive
+ -s|--start-hash)
+ START_HASH=${2}
+ shift 2
+ ;;
+ # Inclusive
+ -e|--end-hash)
+ END_HASH=${2}
+ shift 2
+ ;;
+ -b|--branch)
+ BRANCH=${2}
+ shift 2
+ ;;
+ -c|--commit-hashes)
+ COMMIT_HASHES=${2}
+ shift 2
+ ;;
+ *)
+ shift
+ ;;
+ esac
+ done
+fi
+
+###############################################
+# Identify the branch and the commits to run on
+env_state_bootstrap
+
+pushd $BENCH_SOLR_CHECKOUT_DIR
+ if [[ -n "${COMMIT_HASHES}" ]]; then
+ COMMIT_HASHES="$(echo "$COMMIT_HASHES" | sed 's/,/\n/g')"
+ else # [[ -z "${COMMIT_HASHES}" ]]; then
+ if [[ -z "${START_HASH}" ]]; then
+ >&2 echo "Either '-c' or '-s'/'-e' argument must be provided"
+ exit 1
+ else
+ git_update_checkout $BRANCH
+ COMMIT_HASHES="$(git_list_commits_since $START_HASH $END_HASH)"
+ fi
+ fi
+popd
+
+####################################################
+# Download any benchmark-data needed for simulations
+pushd $SANDBOX_CHECKOUT_ROOT
+ gatling_download_wiki_data
+popd
+
+######################################################
+# Iterate over commits, building and benchmarking each
+pushd $BENCH_SOLR_CHECKOUT_DIR
+ for commit in $(echo "$COMMIT_HASHES") ; do
+ echo "Processing commit: [$commit]"
+
+ # Build and start Solr
+ git_checkout "$commit"
+ solr_kill_all
+ solr_build_package
+ package_dir="$(solr_get_package_directory)"
+ pushd $package_dir
+ export START_SOLR_OPTS=" -m 4g "
Review Comment:
Fixed; good catch!
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]