8 SCRIPTDIR=`dirname $(readlink -f $0)`
9 XDG_RUNTIME_DIR=/run/user/1001
13 echo "No reference image passed"
17 REF_IMAGE=`readlink -f $1`
19 # go to output directory
25 if [ -z "${REF_IMAGE}" ]; then
26 echo "No reference image passed"
30 if [ ! -f "${REF_IMAGE}" ]; then
31 echo "Reference image is not found"
35 # Enable the test picture and disable cursor and any other application from being displayed
36 sed -i '/^\[core\]/a activate-by-default=false' /etc/xdg/weston/weston.ini
37 # setup homescreen env variable
38 sed -i '/^\[core\]/a hide-cursor=true' /etc/xdg/weston/weston.ini
39 # enable red/green/blue test screen
40 echo 'HOMESCREEN_DEMO_CI=1' > /etc/default/homescreen
42 systemctl daemon-reload || true
45 # create initial journal cursor file
46 journalctl /usr/bin/agl-compositor --cursor-file=/tmp/agl-screenshot-cursor > /tmp/first-log 2>&1
48 # stop homescreen (shell) and launcher
49 systemctl stop homescreen.service
50 systemctl stop launcher.service
51 # restart agl-compositor
52 systemctl restart agl-compositor.service
53 systemctl start homescreen.service
55 # e.g. qemu-system-arm takes loooong
57 echo "Waiting for compositor to initialize (+10sec)."
60 while test $LOOP -ge 1 ; do
62 ( mv /tmp/next-log /tmp/prev-log > /dev/null 2>&1 ) || true
63 journalctl /usr/bin/agl-compositor --cursor-file=/tmp/agl-screenshot-cursor > /tmp/next-log 2>&1
64 if ! grep -q 'Usable area:' /tmp/next-log ; then
65 # e.g. qemu-system-arm takes loooong
66 echo "Waiting for compositor to initialize (+60sec). Loop: $LOOP"
78 if ! grep -q 'Usable area:' /tmp/next-log ; then
79 echo "Marker ('Usable area:') not found. Dumping log."
80 echo "##################################"
84 echo "##################################"
86 #echo "CONTINUING ANYWAY !"
89 AGL_SCREENSHOOTER=/usr/bin/agl-screenshooter
92 #su - $AGLDRIVER -c "..."
100 if [ -z "$AGL_SCREENSHOOTER" ]; then
101 echo "Failed to find agl-screenshooter. Compositor too old?"
105 #echo "Found agl-screenshoooter in $AGL_SCREENSHOOTER"
106 rm -rf /home/agl-driver/agl-screenshot-*.png
108 # give it a bit more time to display
111 $AGL_SCREENSHOOTER -l
113 if do_screenshot ; then
114 echo "Screenshot taken"
116 echo "##################################"
117 journalctl --no-pager -a -b /usr/bin/agl-compositor
118 echo "##################################"
124 REF_IMAGE_SHA1SUM=`sha1sum ${REF_IMAGE} | awk -F ' ' '{print $1}'`
129 for SCREENSHOT in agl-screenshot-*.png ; do
130 IMAGE_SHA1SUM=`sha1sum $SCREENSHOT | awk -F ' ' '{print $1}'`
132 if [ "${REF_IMAGE_SHA1SUM}" == "${IMAGE_SHA1SUM}" ]; then
133 echo "A Screenshot matches the reference image"
137 echo "A Screenshot does not match the reference image"
143 if [ $FINALRET != 0 ] ; then
144 for i in agl-screenshot-*.png ; do
145 ${SCRIPTDIR}/./artiproxy-upload.sh $i "$i"
147 journalctl -b --no-pager -a > journal.txt
148 ${SCRIPTDIR}/./artiproxy-upload.sh journal.txt journal.txt
150 echo "#########################"
151 cat /run/platform/display/*.log
152 echo "#########################"
154 echo "#########################"
158 sed -i '/activate-by-default=false/d' /etc/xdg/weston/weston.ini
159 sed -i '/hide-cursor=true/d' /etc/xdg/weston/weston.ini
160 #rm -rf /etc/systemd/system/weston@.service.d
161 rm -rf /etc/default/homescreen
162 systemctl daemon-reload
165 systemctl restart agl-compositor.service
166 systemctl restart homescreen.service
167 systemctl restart launcher.service