new(test): run_regression_tests.sh -h

Signed-off-by: Leonardo Di Donato <leodidonato@gmail.com>
This commit is contained in:
Leonardo Di Donato 2020-07-14 17:33:39 +00:00 committed by poiana
parent e618f005b6
commit a83b91fc53
2 changed files with 44 additions and 5 deletions

View File

@ -107,11 +107,15 @@ OPT_ONLY_PREPARE="false"
OPT_VERBOSE="false" OPT_VERBOSE="false"
OPT_BUILD_DIR="$(dirname "$SCRIPTDIR")/build" OPT_BUILD_DIR="$(dirname "$SCRIPTDIR")/build"
OPT_BRANCH="none" OPT_BRANCH="none"
while getopts ':p :v :b: :d:' 'OPTKEY'; do while getopts ':p :h :v :b: :d:' 'OPTKEY'; do
case ${OPTKEY} in case ${OPTKEY} in
'p') 'p')
OPT_ONLY_PREPARE="true" OPT_ONLY_PREPARE="true"
;; ;;
'h')
/bin/bash usage
exit 0
;;
'v') 'v')
OPT_VERBOSE="true" OPT_VERBOSE="true"
;; ;;
@ -122,15 +126,18 @@ while getopts ':p :v :b: :d:' 'OPTKEY'; do
OPT_BRANCH=${OPTARG} OPT_BRANCH=${OPTARG}
;; ;;
'?') '?')
echo "Invalid option -- ${OPTARG}" >&2 echo "Invalid option: ${OPTARG}." >&2
/bin/bash usage
exit 1 exit 1
;; ;;
':') ':')
echo "Missing argument for option -- ${OPTARG}" >&2 echo "Missing argument for option: ${OPTARG}." >&2
/bin/bash usage
exit 1 exit 1
;; ;;
*) *)
echo "Unimplemented option -- ${OPTKEY}" >&2 echo "Unimplemented option: ${OPTKEY}." >&2
/bin/bash usage
exit 1 exit 1
;; ;;
esac esac
@ -140,7 +147,7 @@ TRACE_DIR=$OPT_BUILD_DIR/test
if ${OPT_VERBOSE}; then if ${OPT_VERBOSE}; then
echo "Build directory = $OPT_BUILD_DIR" echo "Build directory = $OPT_BUILD_DIR"
echo "Trace directory = $TRACE_DIR (creating...)" echo "Trace directory = $TRACE_DIR"
echo "Custom branch = $OPT_BRANCH" echo "Custom branch = $OPT_BRANCH"
fi fi

32
test/usage Executable file
View File

@ -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 <<EOF
Hello, this is Falco integration tests runner.
SYNOPSIS
bash run_regression_tests.sh [-h] [-v] [-p] [-d=<build directory>] [-b=<custom branch>]
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