diff options
Diffstat (limited to 'afm-test.native.sh')
-rw-r--r-- | afm-test.native.sh | 57 |
1 files changed, 40 insertions, 17 deletions
diff --git a/afm-test.native.sh b/afm-test.native.sh index 9f9d6ca..ffdb869 100644 --- a/afm-test.native.sh +++ b/afm-test.native.sh @@ -38,11 +38,12 @@ cleanNexit() { function usage() { cat >&2 << EOF -Usage: $0 <binding-wgt-rootdir> <test-wgt-rootdir> [mode] [timeout] +Usage: $0 <binding-wgt-rootdir> <test-wgt-rootdir> [-m|--mode <SOLO|SERVICE>] [-t|--timeout <X>] [-l|--lavaoutput] binding-wgt-rootdir: path to the test wgt file test-wgt-rootdir: path to the test folder file -mode: SOLO (1 binder) or SERVICE (2 binders) -timeout: default 3 seconds +-m|--mode: SOLO (1 binder) or SERVICE (2 binders) (Default: SOLO) +-t|--timeout: timeout in second. (Default 3 seconds) +-l|--lavaoutput: Flags indicating the binding to add Lava special test markers. EOF } @@ -52,6 +53,34 @@ PORT=1234 PORTSERVICE=$((PORT+1)) TOKEN= +POSITIONAL=() +while [[ $# -gt 0 ]] +do +key="$1" + +case $key in + -l|--lavaoutput) + LAVAOUTPUT="TRUE" + shift # past argument + ;; + -m|--mode) + MODE="$2" + shift # past argument + shift # past value + ;; + -t|--timeout) + TIMEOUT="$2" + shift # past argument + shift # past value + ;; + *) + POSITIONAL+=("$1") # save it in an array for later + shift # past argument + ;; +esac +done +set -- "${POSITIONAL[@]}" # restore positional parameters + if [ "$1" ] && [ "$2" ] then SERVICEPACKAGEDIR="$(readlink -f $1)" @@ -62,19 +91,8 @@ else cleanNexit 1 fi -if [ "$3" ] -then - MODE="$3" -else - MODE="SOLO" -fi - -if [ "$4" ] -then - TIMEOUT=$4 -else - TIMEOUT=3 -fi +[ -z "$MODE" ] && MODE="SOLO" +[ -z "$TIMEOUT" ] && TIMEOUT=3 TESTCFGFILE=$(find "${TESTPACKAGEDIR}" -name "aft-*.json" -print | head -n1) TESTAPINAME=$(grep '\"api\"' "${TESTCFGFILE}" | cut -d'"' -f4) @@ -116,7 +134,12 @@ LOGFILETEST="test.log" testVerbLength=${#testVerb[@]} for (( idx=0; idx<testVerbLength; idx++ )) do - testVerbCalls="--call=${TESTAPINAME}/${testVerb[$idx]}:'{}' ${testVerbCalls}" + if [ "${LAVAOUTPUT}" ] + then + testVerbCalls="--call=${TESTAPINAME}/${testVerb[$idx]}:{\"lavaOutput\":true} ${testVerbCalls}" + else + testVerbCalls="--call=${TESTAPINAME}/${testVerb[$idx]}:{} ${testVerbCalls}" + fi done if [ ${MODE} = "SOLO" ] |