X-Git-Url: https://gerrit.automotivelinux.org/gerrit/gitweb?a=blobdiff_plain;f=common%2Fscripts%2Fagl-screenshot-test.sh;h=0d58f040ad4fa0602c6a90e655ac6cd406089a06;hb=611748f8a416db6a79550286d1b7f5093f9a3273;hp=cdd536a14fd1b33d114be6fd277259d5912d5f3a;hpb=d22dd67991f33efb38295cf2b9fe392a27178005;p=src%2Fqa-testdefinitions.git diff --git a/common/scripts/agl-screenshot-test.sh b/common/scripts/agl-screenshot-test.sh index cdd536a..0d58f04 100755 --- a/common/scripts/agl-screenshot-test.sh +++ b/common/scripts/agl-screenshot-test.sh @@ -5,6 +5,7 @@ set -x export TERM=dumb export COLUMNS=1000 +SCRIPTDIR=`dirname $(readlink -f $0)` XDG_RUNTIME_DIR=/run/user/1001 AGLDRIVER=agl-driver @@ -37,9 +38,12 @@ sleep 2 # create initial journal cursor file journalctl /usr/bin/agl-compositor --cursor-file=/tmp/agl-screenshot-cursor > /tmp/first-log 2>&1 -# restart weston@display -#systemctl restart weston.service -systemctl restart agl-session@agl-driver.service +# stop homescreen (shell) and launcher +su $AGLDRIVER -c 'XDG_RUNTIME_DIR=/run/user/1001/ DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/1001/bus systemctl --user stop homescreen' +su $AGLDRIVER -c 'XDG_RUNTIME_DIR=/run/user/1001/ DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/1001/bus systemctl --user stop launcher' +# restart agl-compositor +su $AGLDRIVER -c 'XDG_RUNTIME_DIR=/run/user/1001/ DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/1001/bus systemctl --user restart agl-compositor' +su $AGLDRIVER -c 'XDG_RUNTIME_DIR=/run/user/1001/ DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/1001/bus systemctl --user start homescreen' # e.g. qemu-system-arm takes loooong sleep 10 @@ -77,10 +81,11 @@ fi AGL_SCREENSHOOTER=/usr/bin/agl-screenshooter + #su - $AGLDRIVER -c "..." do_screenshot() { - su - $AGLDRIVER -c "XDG_RUNTIME_DIR=/run/user/1001 $AGL_SCREENSHOOTER" + su - $AGLDRIVER -c "XDG_RUNTIME_DIR=/run/user/1001 $AGL_SCREENSHOOTER -a" return $? } @@ -96,6 +101,8 @@ rm -rf /home/agl-driver/agl-screenshot-*.png # give it a bit more time to display #sleep 60 +su - $AGLDRIVER -c "XDG_RUNTIME_DIR=/run/user/1001 $AGL_SCREENSHOOTER -l" + if do_screenshot ; then echo "Screenshot taken" else @@ -105,29 +112,40 @@ else exit 127 fi +ls /home/agl-driver/agl-screenshot* + REF_IMAGE_SHA1SUM=`sha1sum ${REF_IMAGE} | awk -F ' ' '{print $1}'` -IMAGE_SHA1SUM=`sha1sum /home/agl-driver/agl-screenshot-*.png | awk -F ' ' '{print $1}'` -if [ "${REF_IMAGE_SHA1SUM}" == "${IMAGE_SHA1SUM}" ]; then - echo "Screenshot matches the reference image" +FINALRET=1 + + +for SCREENSHOT in /home/agl-driver/agl-screenshot-*.png ; do + IMAGE_SHA1SUM=`sha1sum $SCREENSHOT | awk -F ' ' '{print $1}'` + + if [ "${REF_IMAGE_SHA1SUM}" == "${IMAGE_SHA1SUM}" ]; then + echo "A Screenshot matches the reference image" FINALRET=0 -else - echo "Screenshot does not match the reference image" + break + else + echo "A Screenshot does not match the reference image" FINALRET=127 - for i in agl-screenshot-*.png ; do - #set +x - echo "################################################################" - ( curl --upload-file "$i" https://transfer.sh/$(basename "$i") && echo "" ) || true - echo "################################################################" - #set -x - done - echo "#########################" - cat /run/platform/display/*.log - echo "#########################" - journalctl -b --no-pager -a - echo "#########################" -fi + fi +done + +if [ $FINALRET != 0 ] ; then + for i in /home/agl-driver/agl-screenshot-*.png ; do + ${SCRIPTDIR}/./artiproxy-upload.sh $i "$i" + done + journalctl -b --no-pager -a > journal.txt + ${SCRIPTDIR}/./artiproxy-upload.sh journal.txt journal.txt + + echo "#########################" + cat /run/platform/display/*.log + echo "#########################" + set + echo "#########################" +fi # cleanup sed -i '/activate-by-default=false/d' /etc/xdg/weston/weston.ini