summaryrefslogtreecommitdiffstats
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-24 14:04:10 +0200
commit021609cd6bafc542629c67e5385d890acb751d13 (patch)
treeda934be978f4b402264c74abb2f608546c306627 /afm-test.native.sh
parentd43fec70f9c72367f8ff719f086647a6ae70f99e (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: I52539cd2bef460aacb8d327d5abb34ecfd94f512 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" ]