summaryrefslogtreecommitdiffstats
path: root/afm-test.native.sh
diff options
context:
space:
mode:
authorRomain Forlot <romain.forlot@iot.bzh>2018-10-05 17:16:14 +0200
committerRomain Forlot <romain.forlot@iot.bzh>2018-10-09 15:31:19 +0000
commit52f416b5d9e98ac741bf53dad12378d0d3e9c567 (patch)
tree7abd170ae363d3920b17190ea5efc443948ca262 /afm-test.native.sh
parent25903e6eaaa0c068b9b51bdc93e659d257be6f4d (diff)
Unify test launch between target and native
On a target, the binder process name is taken from the widget "id", now the native launcher script also launches the binder using the widget "id". As the controller searches its configuration file using the binder process middle name we need to differentiate between both "id" otherwise the wrong configuration file is used. The commit renames configuration file according to the new "id". Change-Id: Icd01abe21ddee562518c7f822baca8b098bbb55e Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
Diffstat (limited to 'afm-test.native.sh')
-rw-r--r--afm-test.native.sh44
1 files changed, 21 insertions, 23 deletions
diff --git a/afm-test.native.sh b/afm-test.native.sh
index 15be083..367319e 100644
--- a/afm-test.native.sh
+++ b/afm-test.native.sh
@@ -47,7 +47,7 @@ then
SERVICEPACKAGEDIR="$(readlink -f $1)"
TESTPACKAGEDIR="$(readlink -f $2)"
else
- echo "Error: you doesn't specified either the binding folder location either test widget folder location."
+ echo "Error: you did not specify either the binding folder location or test widget folder location."
usage
cleanNexit 1
fi
@@ -67,25 +67,24 @@ else
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
+TESTAPINAME=$(grep '\"api\"' "${TESTCFGFILE}" | cut -d'"' -f4)
+[ ! -f "${TESTPACKAGEDIR}/config.xml" ] && \
+ echo "Error: you don't have the config.xml file. Please call 'make widget'" && \
+ cleanNexit 5
+TESTPROCNAME="afbd-$(grep -Eo 'id=".*" ' ${TESTPACKAGEDIR}/config.xml | cut -d'=' -f2 | tr -d '" '| tr '[:upper:]' '[:lower:]')"
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" ]
-then
- echo "Error: you doesn't have the config.xml file. Please call 'make widget'"
+[ -z "$API" ] && [ "$MODE" = "SERVICE" ] && \
+ echo "Error: you doesn't have the config.xml file. Please call 'make widget'" && \
cleanNexit 2
-else
- ENV_API=$(echo ${API} | sed 's:[^a-zA-Z0-9_]:_:g')
- declare AFT_${ENV_API}_CONFIG_PATH="${SERVICEPACKAGEDIR}"
- declare AFT_$(echo ${ENV_API} | sed 's:[^a-zA-Z0-9_]:_:g')_PLUGIN_PATH="${SERVICEPACKAGEDIR}"
- export AFT_${ENV_API}_CONFIG_PATH
- export AFT_${ENV_API}_PLUGIN_PATH
- PROCNAME="afbd-${API}"
- SOCKETSERVICE="/tmp/$API"
-fi
+
+ENV_API=$(echo ${API} | sed 's:[^a-zA-Z0-9_]:_:g')
+declare AFT_${ENV_API}_CONFIG_PATH="${SERVICEPACKAGEDIR}"
+declare AFT_$(echo ${ENV_API} | sed 's:[^a-zA-Z0-9_]:_:g')_PLUGIN_PATH="${SERVICEPACKAGEDIR}"
+export AFT_${ENV_API}_CONFIG_PATH
+export AFT_${ENV_API}_PLUGIN_PATH
+PROCNAME="afbd-$(grep -Eo 'id=".*" ' ${SERVICEPACKAGEDIR}/config.xml | cut -d'=' -f2 | tr -d '" '| tr '[:upper:]' '[:lower:]')"
+SOCKETSERVICE="/tmp/$API"
export AFT_CONFIG_PATH="${TESTPACKAGEDIR}"
export AFT_PLUGIN_PATH="${TESTPACKAGEDIR}"
@@ -106,15 +105,15 @@ then
--workdir="${TESTPACKAGEDIR}" \
--ldpaths=${SERVICEPACKAGEDIR} \
--binding="${AFBTEST}" \
- --call="${TESTPROCNAME}/launch_all_tests:{}" \
- --call="${TESTPROCNAME}/exit:{}" \
+ --call="${TESTAPINAME}/launch_all_tests:{}" \
+ --call="${TESTAPINAME}/exit:{}" \
-vvv &> ${LOGFILETEST}
elif [ ${MODE} = "SERVICE" ]
then
pkill "$TESTPROCNAME"
pkill "$PROCNAME"
- timeout -s 9 ${TIMEOUT} ${BINDER} --name=${PROCNAME} \
+ timeout -s 9 ${TIMEOUT} ${BINDER} --name="${PROCNAME}" \
--workdir="${SERVICEPACKAGEDIR}" \
--port=${PORTSERVICE} \
--ldpaths=. \
@@ -131,10 +130,9 @@ then
--workdir="${TESTPACKAGEDIR}" \
--binding="${AFBTEST}" \
--ws-client=unix:${SOCKETSERVICE} \
- --call="${TESTPROCNAME}/launch_all_tests:{}" \
- --call="${TESTPROCNAME}/exit:{}" \
+ --call="${TESTAPINAME}/launch_all_tests:{}" \
+ --call="${TESTAPINAME}/exit:{}" \
-vvv &> ${LOGFILETEST}
-
else
echo "Error: No mode selected. Choose between SOLO or SERVICE"
usage