diff options
author | Romain Forlot <romain.forlot@iot.bzh> | 2018-10-15 17:55:29 +0200 |
---|---|---|
committer | Romain Forlot <romain.forlot@iot.bzh> | 2018-10-23 20:54:23 +0200 |
commit | e1896191f8c10ea7d02d97b52184f99dfb2307f5 (patch) | |
tree | d0ea77be05624535fb2e19bc4e03ef11b38e292a /test-wgt | |
parent | e9ca3c535672f26a455781ccfb076ec6efc88bf4 (diff) |
Improved test widget launcher script
Improved test widget launcher script which calls verb
synchronously and therefore we can correctly detect the end
of the test session and exit.
Change-Id: I66e404cfe1a25f1986bc722572efa93979d43bc2
Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
Diffstat (limited to 'test-wgt')
-rw-r--r-- | test-wgt/launcher.sh.in | 24 |
1 files changed, 7 insertions, 17 deletions
diff --git a/test-wgt/launcher.sh.in b/test-wgt/launcher.sh.in index 005c433..7414a7b 100644 --- a/test-wgt/launcher.sh.in +++ b/test-wgt/launcher.sh.in @@ -34,27 +34,17 @@ declare -a testVerb if [[ $(jq '.testVerb|type' $CFGFILE) == "array" ]] then - testVerbLength=$(jq '.testVerb | length') - for (( idx=0; idx<testVerbLength; idx++ )) do - testVerb[$idx]=$(jq -r ".testVerb[$idx].uid" ${CFGFILE}) - done + testVerbLength=$(jq '.testVerb | length') + for (( idx=0; idx<testVerbLength; idx++ )) do + testVerb[$idx]=$(jq -r ".testVerb[$idx].uid" ${CFGFILE}) + done else - testVerb[0]=$(jq -r ".testVerb.uid" ${CFGFILE}) + testVerb[0]=$(jq -r ".testVerb.uid" ${CFGFILE}) fi -tail -f $AFBCLIENTIN | afb-client-demo ws://localhost:${PORT}/api?token=${TOKEN} > $AFBCLIENTOUT 2>&1 & -CLIENTPID=$! - testVerbLength=${#testVerb[@]} for (( idx=0; idx<testVerbLength; idx++ )) do - echo "$API ${testVerb[$idx]}" > $AFBCLIENTIN + afb-client-demo -s ws://localhost:${PORT}/api?token=${TOKEN} "$API" "${testVerb[$idx]}" done -while read -r line -do - [ "$(echo "${line}" | grep -E 'Ran [[:digit:]]+ tests in')" ] && break -done < $AFBCLIENTOUT - -rm -f $AFBCLIENTIN -rm -f $AFBCLIENTOUT -kill $CLIENTPID +afb-client-demo ws://localhost:${PORT}/api?token=${TOKEN} "$API" "exit" |