8 SCRIPTDIR=`dirname $(readlink -f $0)`
9 XDG_RUNTIME_DIR=/run/user/1001
12 # go to output directory
20 if [ -z "${REF_IMAGE}" ]; then
21 echo "No reference image passed"
25 if [ ! -f "${REF_IMAGE}" ]; then
26 echo "Reference image is not found"
30 # Enable the test picture and disable cursor and any other application from being displayed
31 sed -i '/^\[core\]/a activate-by-default=false' /etc/xdg/weston/weston.ini
32 # setup homescreen env variable
33 sed -i '/^\[core\]/a hide-cursor=true' /etc/xdg/weston/weston.ini
34 # enable red/green/blue test screen
35 echo 'HOMESCREEN_DEMO_CI=1' > /etc/default/homescreen
37 systemctl daemon-reload || true
38 su - agl-driver -c 'export DBUS_SESSION_BUS_ADDRESS="unix:path=/run/user/1001/bus" ; systemctl --user daemon-reload' || true
41 # create initial journal cursor file
42 journalctl /usr/bin/agl-compositor --cursor-file=/tmp/agl-screenshot-cursor > /tmp/first-log 2>&1
44 # stop homescreen (shell) and launcher
45 su $AGLDRIVER -c 'XDG_RUNTIME_DIR=/run/user/1001/ DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/1001/bus systemctl --user stop homescreen'
46 su $AGLDRIVER -c 'XDG_RUNTIME_DIR=/run/user/1001/ DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/1001/bus systemctl --user stop launcher'
47 # restart agl-compositor
48 su $AGLDRIVER -c 'XDG_RUNTIME_DIR=/run/user/1001/ DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/1001/bus systemctl --user restart agl-compositor'
49 su $AGLDRIVER -c 'XDG_RUNTIME_DIR=/run/user/1001/ DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/1001/bus systemctl --user start homescreen'
51 # e.g. qemu-system-arm takes loooong
53 echo "Waiting for compositor to initialize (+10sec)."
56 while test $LOOP -ge 1 ; do
58 ( mv /tmp/next-log /tmp/prev-log > /dev/null 2>&1 ) || true
59 journalctl /usr/bin/agl-compositor --cursor-file=/tmp/agl-screenshot-cursor > /tmp/next-log 2>&1
60 if ! grep -q 'Usable area:' /tmp/next-log ; then
61 # e.g. qemu-system-arm takes loooong
62 echo "Waiting for compositor to initialize (+60sec). Loop: $LOOP"
74 if ! grep -q 'Usable area:' /tmp/next-log ; then
75 echo "Marker ('Usable area:') not found. Dumping log."
76 echo "##################################"
80 echo "##################################"
82 #echo "CONTINUING ANYWAY !"
85 AGL_SCREENSHOOTER=/usr/bin/agl-screenshooter
88 #su - $AGLDRIVER -c "..."
91 su - $AGLDRIVER -c "XDG_RUNTIME_DIR=/run/user/1001 $AGL_SCREENSHOOTER -a"
96 if [ -z "$AGL_SCREENSHOOTER" ]; then
97 echo "Failed to find agl-screenshooter. Compositor too old?"
101 #echo "Found agl-screenshoooter in $AGL_SCREENSHOOTER"
102 rm -rf /home/agl-driver/agl-screenshot-*.png
104 # give it a bit more time to display
107 su - $AGLDRIVER -c "XDG_RUNTIME_DIR=/run/user/1001 $AGL_SCREENSHOOTER -l"
109 if do_screenshot ; then
110 echo "Screenshot taken"
112 echo "##################################"
113 journalctl --no-pager -a -b /usr/bin/agl-compositor
114 echo "##################################"
120 REF_IMAGE_SHA1SUM=`sha1sum ${REF_IMAGE} | awk -F ' ' '{print $1}'`
125 for SCREENSHOT in agl-screenshot-*.png ; do
126 IMAGE_SHA1SUM=`sha1sum $SCREENSHOT | awk -F ' ' '{print $1}'`
128 if [ "${REF_IMAGE_SHA1SUM}" == "${IMAGE_SHA1SUM}" ]; then
129 echo "A Screenshot matches the reference image"
133 echo "A Screenshot does not match the reference image"
139 if [ $FINALRET != 0 ] ; then
140 for i in agl-screenshot-*.png ; do
141 ${SCRIPTDIR}/./artiproxy-upload.sh $i "$i"
143 journalctl -b --no-pager -a > journal.txt
144 ${SCRIPTDIR}/./artiproxy-upload.sh journal.txt journal.txt
146 echo "#########################"
147 cat /run/platform/display/*.log
148 echo "#########################"
150 echo "#########################"
154 sed -i '/activate-by-default=false/d' /etc/xdg/weston/weston.ini
155 sed -i '/hide-cursor=true/d' /etc/xdg/weston/weston.ini
156 #rm -rf /etc/systemd/system/weston@.service.d
157 rm -rf /etc/default/homescreen
158 systemctl daemon-reload
161 systemctl restart agl-session@agl-driver.service