aboutsummaryrefslogtreecommitdiffstats
path: root/afm-test.target.sh
blob: f24ca83963692b2a7143c563198a6525a0212d82 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
#!/bin/bash

###########################################################################
# Copyright (C) 2017, 2018 IoT.bzh
#
# Author: Romain Forlot <romain.forlot@iot.bzh>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
###########################################################################

trap cleanup SIGTERM SIGINT SIGABRT SIGHUP

function cleanup() {
	afm-util kill $pid >&2
	afm-util remove $APP >&2
	exit 1
}

 function usage() {
cat >&2 << EOF
Usage: $0 <path>
path: path to the test wgt file
EOF
}

function error() {
	echo "FAIL: $*" >&2
	cleanup
}
function info() {
	echo "PASS: $*" >&2
}

# check application name passed as first arg
WGT=$1
[[ -z "$WGT" ]] && { usage; exit 0;}
[[ ! -f "$WGT" ]] && { usage; exit 0;}

INSTALL=$(afm-util install $WGT)
APP=$(echo $INSTALL | jq -r .added)
[[ "$APP" == "null" ]] && error "Widget contains error. Abort"
APP_HOME=${HOME}/app-data/$(echo ${APP} |cut -d'@' -f1)

# ask appfw to start application
pid=$(afm-util start $APP)
[[ -z "$pid" || ! -e "/proc/$pid" ]] && error "Failed to start application $APP"
info "$APP started with pid=$pid"

kill -0 $pid
RUNNING=$?
while [[ $RUNNING -eq 0 ]]
do
	kill -0 $pid
	RUNNING=$?
	sleep 0.2
done

# Terminate the App
afm-util kill $pid >&2
afm-util remove $APP >&2

# 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

info "$APP killed and removed"
>name="advancedtelematic/meta-updater-qemux86-64" path="external/meta-updater-qemux86-64" remote="github" revision="214e14c4c45625842e542eebd696f903060d488f" upstream="thud"/> <!-- Security layer --> <project name="meta-security" path="external/meta-security" remote="yocto" revision="31dc4e7532fa7a82060e0b50e5eb8d0414aa7e93" upstream="thud"/> <!-- SmartDeviceLink layer --> <project name="phongt/meta-sdl" path="external/meta-sdl" remote="github" revision="ab1e345171e799216b8fcb432943a2de5ff66f5f" upstream="thud"/> <!-- meta-spdxscanner - support for fossology --> <project name="dl9pf/meta-spdxscanner" path="external/meta-spdxscanner" remote="github" revision="2dd8b88071268a5922696db36a9ba8be96a9e0ef" upstream="master"/> <!-- BSPs --> <!-- Renesas Gen3 specific things --> <project name="AGL/meta-renesas-rcar-gen3" path="bsp/meta-renesas-rcar-gen3" /> <project name="CogentEmbedded/meta-rcar" path="bsp/meta-rcar" remote="github" revision="5aecbd92ce06c179efa9dca9127c09219018bc4b" upstream="thud-v3.15.0"/> <!-- MinnowBoard MAX specific things --> <project name="meta-intel" path="bsp/meta-intel" remote="yocto" revision="27dadcfc7bc0de70328b02fecb841608389d22fc" upstream="thud"/> <!-- consolidate on meta-freescale from git.yoctoproject.org --> <project name="meta-freescale" path="bsp/meta-freescale" remote="yocto" revision="f5c932229c31b612cba38c2ed6f3c3ec6b800e92" upstream="thud"/> <!-- Boundary devices bsp layer --> <project name="boundarydevices/meta-boundary" path="bsp/meta-boundary" remote="github" revision="4ea73c57f125ff0b8c3e17e5cc5d07b6168bbd6c" upstream="master"/> <!-- ti vayu / jacinto 6 / DRA7 --> <project name="meta-ti" path="bsp/meta-ti" remote="yocto" revision="2da08ed8b2f4a29fb7d45e769171ea5bb79cf0b2" upstream="thud"/> <!-- rpi 2, 3 and 3 B+ --> <project name="meta-raspberrypi" path="bsp/meta-raspberrypi" remote="yocto" revision="c71d79efc5a06a0c896c278c94f5b14413bb4d69" upstream="thud"/> <!-- DragonBoard 410c specific things --> <project name="meta-qcom" path="bsp/meta-qcom" remote="yocto" revision="8ac86cd465d73da78e24620e4695176138d17fc3" upstream="thud"/> <!-- Altera SOCFPGA platform --> <!-- https://github.com/kraj/meta-altera --> <project name="kraj/meta-altera" path="bsp/meta-altera" remote="github" revision="f07030bb6ff2062031e06efe9831b76c7250b32e" upstream="thud"/> <!-- Sancloud BSP layers --> <project name="SanCloudLtd/meta-sancloud" path="bsp/meta-sancloud" remote="github" revision="430d3da4ee36580e5950d94a76edf88eea753ebb" upstream="thud"/> <project name="EmbeddedAndroid/meta-rtlwifi" path="bsp/meta-rtlwifi" remote="github" revision="fd7ca0ca47c7095ced62a5a7cdef040dff87fb76" upstream="master"/> <!-- meta-synopsys - support for ARC HSDK board --> <project name="foss-for-synopsys-dwc-arc-processors/meta-synopsys" path="bsp/meta-synopsys" remote="github" revision="702a0e826e87796aefa97abc1de0217d3775fd13" upstream="thud-agl"/> </manifest>