aboutsummaryrefslogtreecommitdiffstats
path: root/afm-test.native.sh
diff options
context:
space:
mode:
authorRomain Forlot <romain.forlot@iot.bzh>2018-10-22 17:17:35 +0200
committerRomain Forlot <romain.forlot@iot.bzh>2018-10-23 09:48:49 +0200
commit3be1daaa166fd04bf7870040ca77da3ae1ea02b8 (patch)
treec8d231af48e9ac4aef032954d854fcff32e22ddd /afm-test.native.sh
parentee70785b9911e3dad626286277e7c6cdbdc94b79 (diff)
Add Lava markers on output and select test set
The launch scripts now allow you to select a verb from the test api to only launch that verb instead of all. Also using the verb's argument {'lavaOutput':true}, the test framework adds specific Lava markers. Reformat the script to accept options instead of only positionnal arguments Change-Id: I181407ebb192eb67e06d2ed95ee239d6f1a523f3 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
Diffstat (limited to 'afm-test.native.sh')
-rw-r--r--afm-test.native.sh57
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" ]