When executing the lifecycle test, we need to take into account if
the service or app runs in platform or user scope.
Bug-AGL: SPEC-2903
.
Signed-off-by: Jan-Simon Moeller <jsmoeller@linuxfoundation.org>
Change-Id: I49a53a5a2b14666757b65b0f8203eb73ed2c7b45
+SERVICE_PLATFORM=0
+SERVICE_USER=0
+APPLICATION_USER=0
+AGLDRIVER=agl-driver
+
while [ $# -ge 1 ]
do
case $1 in
while [ $# -ge 1 ]
do
case $1 in
else
echo "DEBUG: not hidden package"
fi
else
echo "DEBUG: not hidden package"
fi
+ # a service sets urn:AGL:widget:provided-api
+ if $(grep "urn:AGL:widget:provided-api" config.xml) ; then
+ # we are a service, now determine the scope ...
+ if $(grep "urn:AGL:permission::partner:scope-platform" config.xml) ; then
+ SERVICE_PLATFORM=1
+ else
+ SERVICE_USER=1
+ fi
+ else
+ # we are an application
+ APPLICATION_USER=1
+ # no other type known (yet)
+ fi
else
echo "DEBUG: fail to unzip"
fi
else
echo "DEBUG: fail to unzip"
fi
echo "DEBUG: check if we see the package with systemctl -a (before start)"
systemctl -a |grep "afm.*$WGTNAME"
echo "DEBUG: check if we see the package with systemctl -a (before start)"
systemctl -a |grep "afm.*$WGTNAME"
+ # here we need to differ between SERVICE_PLATFORM, SERVICE_USER and APPLICATION_USER
+ if test x"1" = x"$SERVICE_PLATFORM" ; then
+ PRE_CMD="su -c"
+ fi
+ if test x"1" = x"$SERVICE_USER" ; then
+ PRE_CMD="su $AGLDRIVER -c"
+ fi
+ if test x"1" = x"$APPLICATION_USER" ; then
+ PRE_CMD="su $AGLDRIVER -c"
+ fi
+
+ # construct the command to call
+ CMD=( "$PRE_CMD" )
+ CMD+=( " ' " )
+ CMD+=( "afm-util start $NAMEID" )
+ CMD+=( " ' " )
echo "DEBUG: start $NAMEID"
echo "DEBUG: start $NAMEID"
- afm-util start $NAMEID > "rid"
+ exec "${CMD[@]}" > "rid"
if [ $? -ne 0 ];then
echo "ERROR: afm-util start"
lava-test-case afm-util-start-$WGTNAME --result fail
if [ $? -ne 0 ];then
echo "ERROR: afm-util start"
lava-test-case afm-util-start-$WGTNAME --result fail
fi
echo "DEBUG: start2 $NAMEID"
fi
echo "DEBUG: start2 $NAMEID"
if [ $? -ne 0 ];then
echo "ERROR: afm-util start2"
lava-test-case afm-util-start2-$WGTNAME --result fail
if [ $? -ne 0 ];then
echo "ERROR: afm-util start2"
lava-test-case afm-util-start2-$WGTNAME --result fail