diff --git a/scripts/benchmark.sh b/scripts/benchmark.sh index 911b9ebf9..6c9d18abf 100755 --- a/scripts/benchmark.sh +++ b/scripts/benchmark.sh @@ -316,63 +316,65 @@ parse_arguments() ;; "-o" | "--output-directory") + if [ $# -eq 1 ] ; then + stderr_echo "Missing output directory!" + echo + return 1 + fi eval ${SWITCH_OUT_DIR_OUT}="$2" shift 2 ;; "-c" | "--test-config") - shift - local ARG="$1" - if [ -z "${ARG}" ] ; then - stderr_echo "Test configuration is not set!" + if [ $# -eq 1 ] ; then + stderr_echo "Missing test configuration!" echo return 1 fi - eval ${SWITCH_TEST_CONFIG_OUT}="${ARG}" - shift + eval ${SWITCH_TEST_CONFIG_OUT}="$2" + shift 2 ;; "-d" | "--datasets-directory") + if [ $# -eq 1 ] ; then + stderr_echo "Missing dataset directory!" + echo + return 1 + fi eval ${SWITCH_DATASETS_DIR_OUT}="$2" shift 2 ;; "-n" | "--num-iterations") - shift - local ARG="$1" - if [ -z "${ARG}" ] ; then - stderr_echo "Number of iterations is not set!" + if [ $# -eq 1 ] ; then + stderr_echo "Missing number of iterations!" echo return 1 fi - eval ${SWITCH_NUM_ITERATIONS_OUT}="${ARG}" - shift + eval ${SWITCH_NUM_ITERATIONS_OUT}="$2" + shift 2 ;; "-i" | "--include") - shift - local ARG="$1" - if [ -z "${ARG}" ] ; then - stderr_echo "Include pattern is not set!" + if [ $# -eq 1 ] ; then + stderr_echo "Missing include pattern!" echo return 1 fi - eval ${SWITCH_BENCHMARKS_PATTERN_ARRAY_OUT}[${NUM_PATTERNS}]="i:${ARG}" + eval ${SWITCH_BENCHMARKS_PATTERN_ARRAY_OUT}[${NUM_PATTERNS}]="i:$2" NUM_PATTERNS=$((NUM_PATTERNS + 1)) - shift + shift 2 ;; "-x" | "--exclude") - shift - local ARG="$1" - if [ -z "${ARG}" ] ; then - stderr_echo "Exclude pattern is not set!" + if [ $# -eq 1 ] ; then + stderr_echo "Missing exclude pattern!" echo return 1 fi - eval ${SWITCH_BENCHMARKS_PATTERN_ARRAY_OUT}[${NUM_PATTERNS}]="x:${ARG}" + eval ${SWITCH_BENCHMARKS_PATTERN_ARRAY_OUT}[${NUM_PATTERNS}]="x:$2" NUM_PATTERNS=$((NUM_PATTERNS + 1)) - shift + shift 2 ;; "-"*) diff --git a/scripts/build.sh b/scripts/build.sh index 62ef342ad..125b36834 100755 --- a/scripts/build.sh +++ b/scripts/build.sh @@ -299,6 +299,11 @@ parse_arguments() ;; "-o" | "--output-directory") + if [ $# -eq 1 ] ; then + stderr_echo "Missing output directory!" + echo + return 1 + fi eval ${PARAM_OUT_DIR_OUT}="$2" shift 2 ;; diff --git a/scripts/release.sh b/scripts/release.sh index 820ec5401..5cf13d2fc 100755 --- a/scripts/release.sh +++ b/scripts/release.sh @@ -738,6 +738,11 @@ parse_arguments() ;; "-o" | "--output-directory") + if [ $# -eq 1 ] ; then + stderr_echo "Missing output directory!" + echo + return 1 + fi eval ${PARAM_OUT_DIR_OUT}="$2" shift 2 ;; diff --git a/scripts/show_parser_tree.sh b/scripts/show_parser_tree.sh index 08de9d406..b9f478810 100755 --- a/scripts/show_parser_tree.sh +++ b/scripts/show_parser_tree.sh @@ -145,11 +145,21 @@ parse_arguments() ;; "-o" | "--output-directory") + if [ $# -eq 1 ] ; then + stderr_echo "Missing output directory!" + echo + return 1 + fi eval ${PARAM_OUT_DIR_OUT}="$2" shift 2 ;; "-r" | "--parser-rule") + if [ $# -eq 1 ] ; then + stderr_echo "Missing parser rule!" + echo + return 1 + fi eval ${PARAM_PARSER_RULE_OUT}="$2" shift 2 ;; diff --git a/scripts/test.sh b/scripts/test.sh index 3575123f9..2e14d4796 100755 --- a/scripts/test.sh +++ b/scripts/test.sh @@ -650,34 +650,35 @@ parse_arguments() ;; "-o" | "--output-directory") + if [ $# -eq 1 ] ; then + stderr_echo "Missing output directory!" + echo + return 1 + fi eval ${PARAM_OUT_DIR_OUT}="$2" shift 2 ;; "-i" | "--include") - shift - local ARG="$1" - if [ -z "${ARG}" ] ; then - stderr_echo "Test include pattern is not set!" + if [ $# -eq 1 ] ; then + stderr_echo "Missing test include pattern!" echo return 1 fi - eval ${SWITCH_TEST_SUITES_ARRAY_OUT}[${NUM_PATTERNS}]="i:${ARG}" + eval ${SWITCH_TEST_SUITES_ARRAY_OUT}[${NUM_PATTERNS}]="i:$2" NUM_PATTERNS=$((NUM_PATTERNS + 1)) - shift + shift 2 ;; "-x" | "--exclude") - shift - local ARG="$1" - if [ -z "${ARG}" ] ; then - stderr_echo "Test exclude pattern is not set!" + if [ $# -eq 1 ] ; then + stderr_echo "Missing test exclude pattern!" echo return 1 fi - eval ${SWITCH_TEST_SUITES_ARRAY_OUT}[${NUM_PATTERNS}]="x:${ARG}" + eval ${SWITCH_TEST_SUITES_ARRAY_OUT}[${NUM_PATTERNS}]="x:$2" NUM_PATTERNS=$((NUM_PATTERNS + 1)) - shift + shift 2 ;; "-"*) diff --git a/scripts/test_compat_api.sh b/scripts/test_compat_api.sh index 3dfbd0d80..db7821a23 100755 --- a/scripts/test_compat_api.sh +++ b/scripts/test_compat_api.sh @@ -183,11 +183,21 @@ parse_arguments() ;; "-o" | "--output-directory") + if [ $# -eq 1 ] ; then + stderr_echo "Missing output directory!" + echo + return 1 + fi eval ${PARAM_OUT_DIR_OUT}="$2" shift 2 ;; "-b" | "--old-version-branch") + if [ $# -eq 1 ] ; then + stderr_echo "Missing old version branch!" + echo + return 1 + fi eval ${PARAM_OLD_VERSION_BRANCH_OUT}="$2" shift 2 ;; diff --git a/scripts/test_gen.sh b/scripts/test_gen.sh index 7b44a71a1..575d7c903 100755 --- a/scripts/test_gen.sh +++ b/scripts/test_gen.sh @@ -462,6 +462,11 @@ parse_arguments() ;; "-o" | "--output-directory") + if [ $# -eq 1 ] ; then + stderr_echo "Missing output directory!" + echo + return 1 + fi eval ${PARAM_OUT_DIR_OUT}="$2" shift 2 ;; diff --git a/scripts/test_perf.sh b/scripts/test_perf.sh index 2c8ed9a7e..f6526195c 100755 --- a/scripts/test_perf.sh +++ b/scripts/test_perf.sh @@ -1151,104 +1151,94 @@ parse_arguments() ;; "-o" | "--output-directory") + if [ $# -eq 1 ] ; then + stderr_echo "Missing output directory!" + echo + return 1 + fi eval ${SWITCH_OUT_DIR_OUT}="$2" shift 2 ;; "-d" | "--source-dir") - shift - local ARG="$1" - if [ -z "${ARG}" ] ; then - stderr_echo "Directory with zserio sources is not set!" + if [ $# -eq 1 ] ; then + stderr_echo "Missing directory with zserio sources!" echo return 1 fi - eval ${SWITCH_DIRECTORY_OUT}="${ARG}" - shift + eval ${SWITCH_DIRECTORY_OUT}="$2" + shift 2 ;; "-s" | "--source") - shift - local ARG="$1" - if [ -z "${ARG}" ] ; then - stderr_echo "Main zserio source is not set!" + if [ $# -eq 1 ] ; then + stderr_echo "Missing main zserio source!" echo return 1 fi - eval ${SWITCH_SOURCE_OUT}="${ARG}" shift + eval ${SWITCH_SOURCE_OUT}="$2" + shift 2 ;; "-t" | "--test-name") - shift - local ARG="$1" - if [ -z "${ARG}" ] ; then - stderr_echo "Test name is not set!" + if [ $# -eq 1 ] ; then + stderr_echo "Missing test name!" echo return 1 fi - eval ${SWITCH_TEST_NAME_OUT}="${ARG}" - shift + eval ${SWITCH_TEST_NAME_OUT}="$2" + shift 2 ;; "-b" | "--blob-name") - shift - local ARG="$1" - if [ -z "${ARG}" ] ; then - stderr_echo "BLOB name is not set!" + if [ $# -eq 1 ] ; then + stderr_echo "Missing blob name!" echo return 1 fi - eval ${SWITCH_BLOB_NAME_OUT}="${ARG}" - shift + eval ${SWITCH_BLOB_NAME_OUT}="$2" + shift 2 ;; "-j" | "--json-file") - shift - local ARG="$1" - if [ -z "${ARG}" ] ; then - stderr_echo "JSON filename is not set!" + if [ $# -eq 1 ] ; then + stderr_echo "Missing JSON file name!" echo return 1 fi - eval ${SWITCH_JSON_FILE_OUT}="${ARG}" - shift + eval ${SWITCH_JSON_FILE_OUT}="$2" + shift 2 ;; "-f" | "--blob-file") - shift - local ARG="$1" - if [ -z "${ARG}" ] ; then - stderr_echo "BLOB filename is not set!" + if [ $# -eq 1 ] ; then + stderr_echo "Missing BLOB file name!" echo return 1 fi - eval ${SWITCH_BLOB_FILE_OUT}="${ARG}" - shift + eval ${SWITCH_BLOB_FILE_OUT}="$2" + shift 2 ;; "-n" | "--num-iterations") - shift - local ARG="$1" - if [ -z "${ARG}" ] ; then - stderr_echo "Number of iterations is not set!" + if [ $# -eq 1 ] ; then + stderr_echo "Missing number of iterations!" echo return 1 fi - eval ${SWITCH_NUM_ITERATIONS_OUT}="${ARG}" - shift + eval ${SWITCH_NUM_ITERATIONS_OUT}="$2" + shift 2 ;; "-c" | "--test-config") - shift - local ARG="$1" - if [ -z "${ARG}" ] ; then - stderr_echo "Test configuration is not set!" + if [ $# -eq 1 ] ; then + stderr_echo "Missing test configuration!" echo return 1 fi - eval ${SWITCH_TEST_CONFIG_OUT}="${ARG}" - shift + eval ${SWITCH_TEST_CONFIG_OUT}="$2" + shift 2 ;; "-r" | "--run-only") diff --git a/scripts/test_zs.sh b/scripts/test_zs.sh index 1f5b1c575..9a05ff0cc 100755 --- a/scripts/test_zs.sh +++ b/scripts/test_zs.sh @@ -521,44 +521,43 @@ parse_arguments() ;; "-o" | "--output-directory") + if [ $# -eq 1 ] ; then + stderr_echo "Missing output directory!" + echo + return 1 + fi eval ${PARAM_OUT_DIR_OUT}="$2" shift 2 ;; "-d" | "--directory") - shift - local ARG="$1" - if [ -z "${ARG}" ] ; then - stderr_echo "Directory with zserio sources is not set!" + if [ $# -eq 1 ] ; then + stderr_echo "Missing directory with zserio sources!" echo return 1 fi - eval ${SWITCH_DIRECTORY_OUT}="${ARG}" - shift + eval ${SWITCH_DIRECTORY_OUT}="$2" + shift 2 ;; "-s" | "--source") - shift - local ARG="$1" - if [ -z "${ARG}" ] ; then - stderr_echo "Main zserio source is not set!" + if [ $# -eq 1 ] ; then + stderr_echo "Missing main zserio source!" echo return 1 fi - eval ${SWITCH_SOURCE_OUT}="${ARG}" - shift + eval ${SWITCH_SOURCE_OUT}="$2" + shift 2 ;; "-t" | "--test-name") - shift - local ARG="$1" - if [ -z "${ARG}" ] ; then - stderr_echo "Test name is not set!" + if [ $# -eq 1 ] ; then + stderr_echo "Missing test name!" echo return 1 fi - eval ${SWITCH_TEST_NAME_OUT}="${ARG}" - shift + eval ${SWITCH_TEST_NAME_OUT}="$2" + shift 2 ;; "-w" | "--werror") diff --git a/scripts/update_test_objects.sh b/scripts/update_test_objects.sh index 895bdc949..02f56fab5 100755 --- a/scripts/update_test_objects.sh +++ b/scripts/update_test_objects.sh @@ -185,6 +185,11 @@ parse_arguments() ;; "-o" | "--output-directory") + if [ $# -eq 1 ] ; then + stderr_echo "Missing output directory!" + echo + return 1 + fi eval ${PARAM_OUT_DIR_OUT}="$2" shift 2 ;;