aboutsummaryrefslogtreecommitdiffstats
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
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>
-rw-r--r--afm-test.native.sh44
-rw-r--r--conf.d/controller/etc/aft-afbtest.json (renamed from conf.d/controller/etc/aft-aft.json)0
-rw-r--r--conf.d/wgt/config.xml.in6
-rw-r--r--test/afb-test/etc/aft-aftest-selftest.json (renamed from test/afb-test/etc/aft-selftest.json)0
4 files changed, 24 insertions, 26 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
diff --git a/conf.d/controller/etc/aft-aft.json b/conf.d/controller/etc/aft-afbtest.json
index c541c2b..c541c2b 100644
--- a/conf.d/controller/etc/aft-aft.json
+++ b/conf.d/controller/etc/aft-afbtest.json
diff --git a/conf.d/wgt/config.xml.in b/conf.d/wgt/config.xml.in
index adb4f18..b66ab0c 100644
--- a/conf.d/wgt/config.xml.in
+++ b/conf.d/wgt/config.xml.in
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
-<widget xmlns="http://www.w3.org/ns/widgets" id="@PROJECT_NAME@" version="@PROJECT_VERSION@">
- <name>@PROJECT_NAME@</name>
+<widget xmlns="http://www.w3.org/ns/widgets" id="afbtest" version="@PROJECT_VERSION@">
+ <name>afbtest</name>
<icon src="@PROJECT_ICON@"/>
<content src="@WIDGET_ENTRY_POINT@" type="@WIDGET_TYPE@"/>
<description>@PROJECT_DESCRIPTION@</description>
@@ -13,7 +13,7 @@
</feature>
<feature name="urn:AGL:widget:provided-binding">
- <param name="aft" value="@WIDGET_ENTRY_POINT@" />
+ <param name="@API_NAME@" value="@WIDGET_ENTRY_POINT@" />
</feature>
<feature name="urn:AGL:widget:provided-api">
diff --git a/test/afb-test/etc/aft-selftest.json b/test/afb-test/etc/aft-aftest-selftest.json
index 5a3f1dd..5a3f1dd 100644
--- a/test/afb-test/etc/aft-selftest.json
+++ b/test/afb-test/etc/aft-aftest-selftest.json