8 XDG_RUNTIME_DIR=/run/user/1001
16 if [ -z "${REF_IMAGE}" ]; then
17 echo "No reference image passed"
21 if [ ! -f "${REF_IMAGE}" ]; then
22 echo "Reference image is not found"
26 # Enable the test picture and disable cursor and any other application from being displayed
27 sed -i '/^\[core\]/a activate-by-default=false' /etc/xdg/weston/weston.ini
28 # setup homescreen env variable
29 sed -i '/^\[core\]/a hide-cursor=true' /etc/xdg/weston/weston.ini
30 # enable red/green/blue test screen
31 echo 'HOMESCREEN_DEMO_CI=1' > /etc/default/homescreen
33 systemctl daemon-reload
36 # create initial journal cursor file
37 journalctl /usr/bin/agl-compositor --cursor-file=/tmp/agl-screenshot-cursor > /tmp/first-log 2>&1
39 # restart weston@display
40 #systemctl restart weston.service
41 systemctl restart agl-session@agl-driver.service
43 # e.g. qemu-system-arm takes loooong
45 echo "Waiting for compositor to initialize (+10sec)."
48 while test $LOOP -ge 1 ; do
50 ( mv /tmp/next-log /tmp/prev-log > /dev/null 2>&1 ) || true
51 journalctl /usr/bin/agl-compositor --cursor-file=/tmp/agl-screenshot-cursor > /tmp/next-log 2>&1
52 if ! grep -q 'Usable area:' /tmp/next-log ; then
53 # e.g. qemu-system-arm takes loooong
54 echo "Waiting for compositor to initialize (+60sec). Loop: $LOOP"
66 if ! grep -q 'Usable area:' /tmp/next-log ; then
67 echo "Marker ('Usable area:') not found. Dumping log."
68 echo "##################################"
72 echo "##################################"
74 #echo "CONTINUING ANYWAY !"
77 AGL_SCREENSHOOTER=/usr/bin/agl-screenshooter
79 #su - $AGLDRIVER -c "..."
82 su - $AGLDRIVER -c "XDG_RUNTIME_DIR=/run/user/1001 $AGL_SCREENSHOOTER"
87 if [ -z "$AGL_SCREENSHOOTER" ]; then
88 echo "Failed to find agl-screenshooter. Compositor too old?"
92 #echo "Found agl-screenshoooter in $AGL_SCREENSHOOTER"
93 rm -rf /home/agl-driver/agl-screenshot-*.png
95 # give it a bit more time to display
98 if do_screenshot ; then
99 echo "Screenshot taken"
101 echo "##################################"
102 journalctl --no-pager -a -b /usr/bin/agl-compositor
103 echo "##################################"
107 REF_IMAGE_SHA1SUM=`sha1sum ${REF_IMAGE} | awk -F ' ' '{print $1}'`
108 IMAGE_SHA1SUM=`sha1sum /home/agl-driver/agl-screenshot-*.png | awk -F ' ' '{print $1}'`
110 if [ "${REF_IMAGE_SHA1SUM}" == "${IMAGE_SHA1SUM}" ]; then
111 echo "Screenshot matches the reference image"
114 echo "Screenshot does not match the reference image"
116 for i in agl-screenshot-*.png ; do
118 echo "################################################################"
119 ( curl --upload-file "$i" https://transfer.sh/$(basename "$i") && echo "" ) || true
120 echo "################################################################"
123 echo "#########################"
124 cat /run/platform/display/*.log
125 echo "#########################"
126 journalctl -b --no-pager -a
127 echo "#########################"
132 sed -i '/activate-by-default=false/d' /etc/xdg/weston/weston.ini
133 sed -i '/hide-cursor=true/d' /etc/xdg/weston/weston.ini
134 #rm -rf /etc/systemd/system/weston@.service.d
135 rm -rf /etc/default/homescreen
136 systemctl daemon-reload
139 systemctl restart agl-session@agl-driver.service