This is an automated email from the ASF dual-hosted git repository.

heybales pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/geode-benchmarks.git


The following commit(s) were added to refs/heads/develop by this push:
     new 646825b  GEODE-6480: Just Do It Day: Use long cli options (#63)
646825b is described below

commit 646825bed430a48737f777fbb07cfdd5866fac32
Author: Helena Bales <[email protected]>
AuthorDate: Wed Mar 6 15:11:32 2019 -0800

    GEODE-6480: Just Do It Day: Use long cli options (#63)
    
    Add long CLI options for scripts to run benchmarks on AWS instances.
    Backwards compatible with previous short CLI options.
    
    Signed-off-by: Robert Houghton <[email protected]>
---
 geode-benchmarks/build.gradle                      |   3 +
 infrastructure/scripts/aws/run_against_baseline.sh | 132 ++++++++++++++-------
 infrastructure/scripts/aws/run_tests.sh            | 123 +++++++++++++------
 3 files changed, 174 insertions(+), 84 deletions(-)

diff --git a/geode-benchmarks/build.gradle b/geode-benchmarks/build.gradle
index 450878a..8858295 100644
--- a/geode-benchmarks/build.gradle
+++ b/geode-benchmarks/build.gradle
@@ -44,6 +44,9 @@ dependencies {
     compile(group: 'org.slf4j', name: 'slf4j-simple', version: 
project.'slf4j-simple.version')
     compile(project(':harness'))
 
+    // Required for missing dependency on geode-core.
+    runtime(group: 'org.eclipse.jetty', name: 'jetty-webapp', version: 
'9.4.12.v20180830')
+
     testCompile(group: 'org.mockito', name: 'mockito-all', version: 
project.'mockito-all.version')
     testCompile(group: 'org.assertj', name: 'assertj-core', version: 
project.'assertj-core.version')
 }
diff --git a/infrastructure/scripts/aws/run_against_baseline.sh 
b/infrastructure/scripts/aws/run_against_baseline.sh
index 1f12b77..db3fd17 100755
--- a/infrastructure/scripts/aws/run_against_baseline.sh
+++ b/infrastructure/scripts/aws/run_against_baseline.sh
@@ -34,68 +34,112 @@ BASELINE_REPO=${DEFAULT_BASELINE_REPO}
 DEFAULT_BASELINE_VERSION=1.8.0
 BASELINE_VERSION=${DEFAULT_BASELINE_VERSION}
 
-while getopts ":t:r:b:v:p:e:R:B:V:m:o:h" opt; do
-  case ${opt} in
-    t )
-      TAG=$OPTARG
+TAG=
+METADATA=
+OUTPUT=
+
+while :; do
+  case $1 in
+    -t|--tag )
+      if [ "$2" ]; then
+        TAG=$2
+        shift
+      else
+        echo 'ERROR: "--tag" requires a non-empty option argument.'
+        exit 1
+      fi
       ;;
-    p )
-      BENCHMARK_REPO=$OPTARG
+    -p|--br|--benchmark-repo )
+      if [ "$2" ]; then
+        BENCHMARK_REPO=$2
+        shift
+      fi
       ;;
-    e )
-      BENCHMARK_BRANCH=$OPTARG
+    -e|--bb|--benchmark-branch )
+      if [ "$2" ]; then
+        BENCHMARK_BRANCH=$2
+        shift
+      fi
       ;;
-    m )
-      METADATA=$OPTARG
+    -m|--metadata )
+      if [ "$2" ]; then
+        METADATA=$2
+        shift
+      fi
       ;;
-    o )
-      OUTPUT=$OPTARG
+    -o|--output )
+      if [ "$2" ]; then
+        OUTPUT=$2
+        shift
+      fi
       ;;
-    r )
-      REPO=$OPTARG
+    -r|--gr|--repo|--geode-repo )
+      if [ "$2" ]; then
+        REPO=$2
+        shift
+      fi
       ;;
-    b )
-      BRANCH=$OPTARG
+    -b|--gb|--branch|--geode-branch )
+      if [ "$2" ]; then
+        BRANCH=$2
+        shift
+      fi
       ;;
-    v )
-      VERSION=$OPTARG
+    -v|--version|--geode-version )
+      if [ "$2" ]; then
+        VERSION=$2
+        shift
+      fi
       ;;
-    R )
-      BASELINE_REPO=$OPTARG
+    -R|--bgr|--baseline-repo|--baseline-geode-repo )
+      if [ "$2" ]; then
+        BASELINE_REPO=$2
+        shift
+      fi
       ;;
-    B )
-      BASELINE_BRANCH=$OPTARG
+    -B|--bgb|--baseline-branch|--baseline-geode-branch )
+      if [ "$2" ]; then
+        BASELINE_BRANCH=$2
+        shift
+      fi
       ;;
-    V )
-      BASELINE_VERSION=$OPTARG
+    -V|--bv|--baseline-version|--baseline-geode-version )
+      if [ "$2" ]; then
+        BASELINE_VERSION=$2
+        shift
+      fi
       ;;
-    h )
+    -h|--help|-\? )
       echo "Usage: $(basename "$0") -t tag [options ...] [-- arguments ...]"
       echo "Options:"
-      echo "-t : Cluster tag"
-      echo "-p : Benchmark repo (default: ${DEFAULT_BENCHMARK_REPO})"
-      echo "-e : Benchmark branch (default: ${DEFAULT_BENCHMARK_BRANCH})"
-      echo "-o : Output directory (defaults: ./output-<date>-<tag>)"
-      echo "-v : Geode version"
-      echo "-r : Geode repo (default: ${DEFAULT_REPO})"
-      echo "-b : Geode branch (default: ${DEFAULT_BRANCH})"
-      echo "-V : Geode baseline version (default: ${DEFAULT_BASELINE_VERSION})"
-      echo "-R : Geode baseline repo (default: ${DEFAULT_BASELINE_REPO})"
-      echo "-B : Geode baseline branch"
-      echo "-m : Test metadata to output to file, comma-delimited"
+      echo "-t|--tag : Cluster tag"
+      echo "-p|--benchmark-repo : Benchmark repo (default: 
${DEFAULT_BENCHMARK_REPO})"
+      echo "-e|--benchmark-branch : Benchmark branch (default: 
${DEFAULT_BENCHMARK_BRANCH})"
+      echo "-o|--output : Output directory (defaults: ./output-<date>-<tag>)"
+      echo "-v|--geode-version : Geode version"
+      echo "-r|--geode-repo : Geode repo (default: ${DEFAULT_REPO})"
+      echo "-b|--geode-branch : Geode branch (default: ${DEFAULT_BRANCH})"
+      echo "-V|--baseline-geode-version : Geode baseline version (default: 
${DEFAULT_BASELINE_VERSION})"
+      echo "-R|--baseline-geode-repo : Geode baseline repo (default: 
${DEFAULT_BASELINE_REPO})"
+      echo "-B|--baseline-geode-branch : Geode baseline branch"
+      echo "-m|--metadata : Test metadata to output to file, comma-delimited"
       echo "-- : All subsequent arguments are passed to the benchmark task as 
arguments."
-      echo "-h : This help message"
+      echo "-h|--help|-? : This help message"
       exit 1
       ;;
-    \? )
-      echo "Invalid option: $OPTARG" 1>&2
+    -- )
+      shift
+      break
       ;;
-    : )
-      echo "Invalid option: $OPTARG requires an argument" 1>&2
+    -?* )
+      printf 'Invalid option: %s\n' "$1" >&2
+      break
       ;;
+    * )
+      break
   esac
+  shift
 done
-shift $((OPTIND -1))
 
 DATE=$(date '+%m-%d-%Y-%H-%M-%S')
 
@@ -104,10 +148,6 @@ if [ -z "${TAG}" ]; then
   exit 1
 fi
 
-if [[ -z "${METADATA}" ]]; then
-  METADATA="'geode branch':'${BRANCH}','geode version':'${VERSION}','baseline 
branch':'${BASELINE_BRANCH}','baseline 
version':'${BASELINE_VERSION}','benchmark branch':'${BENCHMARK_BRANCH}'"
-fi
-
 OUTPUT=${OUTPUT:-output-${DATE}-${TAG}}
 
 set -x
diff --git a/infrastructure/scripts/aws/run_tests.sh 
b/infrastructure/scripts/aws/run_tests.sh
index ab118cd..7a8bbfc 100755
--- a/infrastructure/scripts/aws/run_tests.sh
+++ b/infrastructure/scripts/aws/run_tests.sh
@@ -27,59 +27,94 @@ BENCHMARK_BRANCH=${DEFAULT_BENCHMARK_BRANCH}
 DEFAULT_REPO='https://github.com/apache/geode'
 REPO=${DEFAULT_REPO}
 DEFAULT_BRANCH='develop'
-BRANCH=${DEFAULT_BRANCH}
-
-
-while getopts ":t:r:b:v:p:e:R:B:V:m:o:h" opt; do
-  case ${opt} in
-    t )
-      TAG=$OPTARG
+BRANCH=${DEAULT_BRANCH}
+
+TAG=
+METADATA=
+OUTPUT=
+VERSION=
+
+while :; do
+  case $1 in
+    -t|--tag )
+      if [ "$2" ]; then
+        TAG=$2
+        shift
+      else
+        echo 'ERROR: "--tag" requires a non-empty option argument.'
+        exit 1
+      fi
       ;;
-    p )
-      BENCHMARK_REPO=$OPTARG
+    -p|--br|--benchmark-repo )
+      if [ "$2" ]; then
+        BENCHMARK_REPO=$2
+        shift
+      fi
       ;;
-    e )
-      BENCHMARK_BRANCH=$OPTARG
+    -e|--bb|--benchmark-branch )
+      if [ "$2" ]; then
+        BENCHMARK_BRANCH=$2
+        shift
+      fi
       ;;
-    m )
-      METADATA=$OPTARG
+    -m|--metadata )
+      if [ "$2" ]; then
+        METADATA=$2
+        shift
+      fi
       ;;
-    o )
-      OUTPUT=$OPTARG
+    -o|--output )
+      if [ "$2" ]; then
+        OUTPUT=$2
+        shift
+      fi
       ;;
-    r )
-      REPO=$OPTARG
+    -r|--gr|--repo|--geode-repo )
+      if [ "$2" ]; then
+        REPO=$2
+        shift
+      fi
       ;;
-    b )
-      BRANCH=$OPTARG
+    -b|--gb|--branch|--geode-branch )
+      if [ "$2" ]; then
+        BRANCH=$2
+        shift
+      fi
       ;;
-    v )
-      VERSION=$OPTARG
+    -v|--version|--geode-version )
+      if [ "$2" ]; then
+        VERSION=$2
+        shift
+      fi
       ;;
-    h )
+    -h|--help|-\? )
       echo "Usage: $(basename "$0") -t tag [options ...] [-- arguments ...]"
       echo "Options:"
-      echo "-t : Cluster tag"
-      echo "-p : Benchmark repo (default: ${DEFAULT_BENCHMARK_REPO})"
-      echo "-e : Benchmark branch (default: ${DEFAULT_BENCHMARK_BRANCH})"
-      echo "-o : Output directory (defaults: ./output-<date>-<tag>)"
-      echo "-v : Geode version"
-      echo "-r : Geode repo (default: ${DEFAULT_REPO})"
-      echo "-b : Geode branch (default: ${DEFAULT_BRANCH})"
-      echo "-m : Test metadata to output to file, comma-delimited (optional)"
+      echo "-t|--tag : Cluster tag"
+      echo "-p|--benchmark-repo : Benchmark repo (default: 
${DEFAULT_BENCHMARK_REPO})"
+      echo "-e|--benchmark-branch : Benchmark branch (default: 
${DEFAULT_BENCHMARK_BRANCH})"
+      echo "-o|--output : Output directory (defaults: ./output-<date>-<tag>)"
+      echo "-v|--geode-version : Geode version"
+      echo "-r|--geode-repo : Geode repo (default: ${DEFAULT_REPO})"
+      echo "-b|--geode-branch : Geode branch (default: ${DEFAULT_BRANCH})"
+      echo "-m|--metadata : Test metadata to output to file, comma-delimited 
(optional)"
       echo "-- : All subsequent arguments are passed to the benchmark task as 
arguments."
-      echo "-h : This help message"
+      echo "-h|--help : This help message"
       exit 1
       ;;
-    \? )
-      echo "Invalid option: $OPTARG" 1>&2
+    -- )
+      shift
+      break
       ;;
-    : )
-      echo "Invalid option: $OPTARG requires an argument" 1>&2
+    -?* )
+      printf 'Invalid option: %s\n' "$1" >&2
+      break
       ;;
+    * )
+      break
   esac
+  shift
 done
-shift $((OPTIND -1))
 
 DATE=$(date '+%m-%d-%Y-%H-%M-%S')
 
@@ -95,6 +130,19 @@ if [[ -z "${AWS_ACCESS_KEY_ID}" ]]; then
   export AWS_PROFILE="geode-benchmarks"
 fi
 
+fixRepoName() {
+  if [ -z "$1" ]; then
+    return 1
+  elif [ ${1:0:5} = "https" ]; then
+    echo ${1}
+  else
+    echo "https://github.com/${1}";
+  fi
+}
+
+BENCHMARK_REPO=$(fixRepoName ${BENCHMARK_REPO})
+REPO=$(fixRepoName ${REPO})
+
 SSH_OPTIONS="-o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -i 
~/.geode-benchmarks/${TAG}-privkey.pem"
 HOSTS=`aws ec2 describe-instances --query 
'Reservations[*].Instances[*].PrivateIpAddress' --filter 
"Name=tag:geode-benchmarks,Values=${TAG}" --output text`
 HOSTS=$(echo ${HOSTS} | tr ' ' ',')
@@ -138,10 +186,9 @@ if [ -z "${VERSION}" ]; then
 fi
 
 if [ -z "${METADATA}" ]; then
-  METADATA="'geode branch':'${BRANCH}','geode version':'${VERSION}','benchmark 
branch':'${BENCHMARK_BRANCH}'"
+  METADATA="'geode repo':'${GEODE_REPO}','geode branch':'${BRANCH}','geode 
version':'${VERSION}','benchmark repo':'${BENCHMARK_REPO}','benchmark 
branch':'${BENCHMARK_BRANCH}'"
 fi
 
-
 ssh ${SSH_OPTIONS} geode@$FIRST_INSTANCE \
   rm -rf geode-benchmarks '&&' \
   git clone ${BENCHMARK_REPO} --branch ${BENCHMARK_BRANCH} '&&' \

Reply via email to