summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRomain Forlot <romain.forlot@iot.bzh>2018-10-03 16:56:50 +0200
committerRomain Forlot <romain.forlot@iot.bzh>2018-10-03 16:56:50 +0200
commit02881ee1864b7f5211ffd804e5c9181a30919c66 (patch)
tree488d2b3e38ed69c1b1d91a7040be4b07395778fb
parent8de7f11cf8c20c39c936791ac0401d03e1d5bb46 (diff)
Avoid to kill anything when no config file found
Display an error and exit if no JSON test configuration file found. Else it would kill your user session. Change-Id: Ica934cfda02baca3844d15d2134d295055c372da Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
-rw-r--r--afm-test.native.sh3
1 files changed, 3 insertions, 0 deletions
diff --git a/afm-test.native.sh b/afm-test.native.sh
index e117ada..15be083 100644
--- a/afm-test.native.sh
+++ b/afm-test.native.sh
@@ -68,6 +68,9 @@ fi
TESTCFGFILE=$(find "${TESTPACKAGEDIR}" -name "aft-*.json" -print | head -n1)
TESTPROCNAME=$(grep '\"api\"' "${TESTCFGFILE}" | cut -d'"' -f4)
+[ -z "${TESTPROCNAME}" ] && \
+echo "Can't find 'api' key from your test configuration file: ${TESTCFGFILE}.\n Either configuration file doesn't exist either it is incorrect." && \
+cleanNexit 4
API=$(grep "provided-api" "${SERVICEPACKAGEDIR}/config.xml" -A1 2> /dev/null | sed -r -e '1d' -e 's:.*"(.*)" v.*:\1:' 2> /dev/null)
if [ -z "$API" ] && [ "$MODE" = "SERVICE" ]