diff --git a/test/run_regression_tests.sh b/test/run_regression_tests.sh index 9b2b66fe..cfebacda 100755 --- a/test/run_regression_tests.sh +++ b/test/run_regression_tests.sh @@ -107,11 +107,15 @@ OPT_ONLY_PREPARE="false" OPT_VERBOSE="false" OPT_BUILD_DIR="$(dirname "$SCRIPTDIR")/build" OPT_BRANCH="none" -while getopts ':p :v :b: :d:' 'OPTKEY'; do +while getopts ':p :h :v :b: :d:' 'OPTKEY'; do case ${OPTKEY} in 'p') OPT_ONLY_PREPARE="true" ;; + 'h') + /bin/bash usage + exit 0 + ;; 'v') OPT_VERBOSE="true" ;; @@ -122,15 +126,18 @@ while getopts ':p :v :b: :d:' 'OPTKEY'; do OPT_BRANCH=${OPTARG} ;; '?') - echo "Invalid option -- ${OPTARG}" >&2 + echo "Invalid option: ${OPTARG}." >&2 + /bin/bash usage exit 1 ;; ':') - echo "Missing argument for option -- ${OPTARG}" >&2 + echo "Missing argument for option: ${OPTARG}." >&2 + /bin/bash usage exit 1 ;; *) - echo "Unimplemented option -- ${OPTKEY}" >&2 + echo "Unimplemented option: ${OPTKEY}." >&2 + /bin/bash usage exit 1 ;; esac @@ -140,7 +147,7 @@ TRACE_DIR=$OPT_BUILD_DIR/test if ${OPT_VERBOSE}; then echo "Build directory = $OPT_BUILD_DIR" - echo "Trace directory = $TRACE_DIR (creating...)" + echo "Trace directory = $TRACE_DIR" echo "Custom branch = $OPT_BRANCH" fi diff --git a/test/usage b/test/usage new file mode 100755 index 00000000..9a97def0 --- /dev/null +++ b/test/usage @@ -0,0 +1,32 @@ +#!/usr/bin/env bash +# +# Copyright (C) 2020 The Falco Authors. +# +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +cat <] [-b=] + +DESCRIPTION + + -h Display usage instructions + -v Verbose output + -p Prepare the falco_traces integration test suite + -b=CUSTOM_BRANCH Specify a custom branch for downloading falco_traces fixtures (defaults to "none") + -d=BUILD_DIRECTORY Specify the build directory where Falco has been built (defaults to $SCRIPTDIR/../build) +EOF