From 021609cd6bafc542629c67e5385d890acb751d13 Mon Sep 17 00:00:00 2001 From: Romain Forlot Date: Mon, 22 Oct 2018 17:17:35 +0200 Subject: 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 --- afm-test.native.sh | 57 ++++++++++++++++++++++++++++++++++++++---------------- 1 file changed, 40 insertions(+), 17 deletions(-) (limited to 'afm-test.native.sh') 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 [mode] [timeout] +Usage: $0 [-m|--mode ] [-t|--timeout ] [-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