summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRomain Forlot <romain.forlot@iot.bzh>2018-10-05 20:13:17 +0200
committerStéphane Desneux <stephane.desneux@iot.bzh>2018-10-10 08:16:36 +0000
commitabede0f09cb655271ece0283ae8aab2b3cf4999d (patch)
tree7b9166ae96d87bfe939172eab7676555a205864d
parent1a33ac27fa87b013ca6dc95be53b5b8a40a8f197 (diff)
Improve exit output message
Display the tests results depending on the chosen format or inform the user of the error and displaying in that case the binder(s) log output. Change-Id: I2437d3b59ef5b864c8e41749b16bf3ed738c9caa Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
-rw-r--r--afm-test.native.sh18
-rwxr-xr-xafm-test.target.sh12
2 files changed, 22 insertions, 8 deletions
diff --git a/afm-test.native.sh b/afm-test.native.sh
index 367319e..295102c 100644
--- a/afm-test.native.sh
+++ b/afm-test.native.sh
@@ -20,10 +20,20 @@
trap "cleanNexit 1" SIGHUP SIGINT SIGABRT SIGTERM
cleanNexit() {
- rm -f $SOCKETSERVICE 2> /dev/null
- trap '' EXIT SIGHUP SIGINT SIGABRT SIGTERM
- [ $1 -ne 0 ] && echo "Error: Test launch failed. Code: $1" && cat ${LOGFILETEST} ${LOGFILESERVICE}
- exit $1
+ rm -f $SOCKETSERVICE 2> /dev/null
+ trap '' EXIT SIGHUP SIGINT SIGABRT SIGTERM
+ if [ $1 -ne 0 ]
+ then
+ [ -f ${LOGFILESERVICE} ] && cat ${LOGFILESERVICE}
+ [ -f ${LOGFILETEST} ] && cat ${LOGFILETEST}
+ echo "Error: Test launch failed. Code: $1"
+ else
+ find ${TESTPACKAGEDIR} -maxdepth 1 -name '*.tap' -exec cat {} \;
+ find ${TESTPACKAGEDIR} -maxdepth 1 -name '*.txt' -exec cat {} \;
+ find ${TESTPACKAGEDIR} -maxdepth 1 -name '*.xml' -a ! -name 'config.xml' -exec cat {} \;
+ echo "Tests correctly launched."
+ fi
+ exit $1
}
function usage() {
diff --git a/afm-test.target.sh b/afm-test.target.sh
index f24ca83..5038e74 100755
--- a/afm-test.target.sh
+++ b/afm-test.target.sh
@@ -60,16 +60,20 @@ kill -0 $pid
RUNNING=$?
while [[ $RUNNING -eq 0 ]]
do
- kill -0 $pid
+ kill -0 $pid 2> /dev/null
RUNNING=$?
sleep 0.2
done
# Terminate the App
-afm-util kill $pid >&2
-afm-util remove $APP >&2
+afm-util kill $pid > /dev/null
+afm-util remove $APP > /dev/null
# Little sed script making compliant the output of test results for ptest.
-sed -r -e '/^# (S| +)/d' -e '1d' -e 's:^ok +([0-9]+)\t+(.*):PASS\: \1 \2:' -e 's:^not ok +([0-9]+)\t+(.*):FAIL\: \1 \2:' ${APP_HOME}/test_results.log
+find "${APP_HOME}" -name '*tap' -exec \
+sed -r -e '/^# (S| +)/d' \
+-e '1d' \
+-e 's:^ok +([0-9]+)\t+(.*):PASS\: \1 \2:' \
+-e 's:^not ok +([0-9]+)\t+(.*):FAIL\: \1 \2:' {} \;
info "$APP killed and removed"