pointer_check.sh 3.4 KB

123456789101112131415161718192021222324252627282930313233343536
  1. #!/bin/bash
  2. # pointer_check.sh <vm> [screen] [shot dir] - which way does the pointer's y go on this VM's output? Runs workshop item
  3. # 3599498791 (its calendar enlarges the weekday under the pointer, hover zones driven by the engine's cursor hit test), puts the
  4. # pointer on the Monday row and on the Sunday row of the calendar and checks the enlarged label with hover_check.py, and with the pointer on the dock and at the top that the dock icons magnify (the scripts' cursor world position). The two
  5. # screenshots stay in <shot dir> (default /tmp/pointer-check-<vm>). Prints PASS|FAIL lines.
  6. # Needs the VM running with the session up (sessenv), the wallpaper and the engine in ~/lwe (prep_guest.sh, release_check.sh),
  7. # a 1920x1080 display, and the pointer reachable through QMP (usb-tablet).
  8. HERE=$(cd "$(dirname "$0")" && pwd)
  9. vm=$1 screen=${2:-Virtual-1} out=${3:-/tmp/pointer-check-$vm}
  10. mkdir -p "$out"
  11. lv() { "$HERE/linuxvm.sh" "$@"; }
  12. sshv() { lv ssh "$vm" "$@" </dev/null; }
  13. if ! sshv '[ -d ~/lwe/wp-3599498791 ]'; then lv scp "$vm" "${LINUXVM:-$HOME/.local/share/linuxvm}/payload/wp-3599498791" lwe/; fi
  14. sshv 'pkill -f "[l]inux-wallpaperengine.bin"; pkill -x we-manager; true'
  15. sshv 'pkill -f "[x]fce4-display-settings"; pkill -f "[u]pdate-manager"; pkill -f "[r]elease-upgrader"; pkill -f "[u]pdate-notifier"; pkill -x cachyos-hello; pkill -f "[e]os-welcome|[m]x-welcome|[g]aruda-welcome|[m]anjaro-hello|[m]int-welcome|[z]orin-welcome|[p]op-welcome|[m]intupdate|[m]intUpdate|[m]intreport|[m]intwelcome"; true'
  16. # SteamOS starts Steam's sign-in window at login
  17. sshv 'pkill -x steam; pkill -f "[s]teamwebhelper"; true'
  18. sshv ". ~/sessenv; (setsid ${WEM_LAUNCH:-} nohup ~/lwe/lwe-hints/linux-wallpaperengine --assets-dir ~/lwe/assets $LWE_ARGS_EXTRA --screen-root $screen ~/lwe/wp-3599498791 > /tmp/pointer-check.log 2>&1 < /dev/null &); sleep 6"
  19. for _ in $(seq 60); do sshv 'grep -q "drawing at scale" /tmp/pointer-check.log' && break; sleep 2; done
  20. sleep 30
  21. # welcome apps start late on some distributions, once more now that the engine runs
  22. sshv 'pkill -f "[x]fce4-display-settings"; pkill -f "[u]pdate-manager"; pkill -f "[r]elease-upgrader"; pkill -f "[u]pdate-notifier"; pkill -x cachyos-hello; pkill -f "[e]os-welcome|[m]x-welcome|[g]aruda-welcome|[m]anjaro-hello|[m]int-welcome|[z]orin-welcome|[p]op-welcome|[m]intupdate|[m]intUpdate|[m]intreport|[m]intwelcome"; true'
  23. # a welcome window that survives its process name (EndeavourOS): close it by title
  24. sshv '. ~/sessenv; wmctrl -c "Welcome" 2>/dev/null; wmctrl -c "Plugin loading failure" 2>/dev/null; for w in $(xdotool search --name "^Welcome" 2>/dev/null); do xdotool windowclose $w; done; true'
  25. if ! sshv 'pgrep -f "[l]inux-wallpaperengine.bin" >/dev/null'; then echo "FAIL weekday hover: the engine did not stay running on 3599498791"; exit 1; fi
  26. for spot in mon:713,451 sun:714,625 dock:${POINTER_DOCK_XY:-960,1010} top:960,60; do
  27. name=${spot%%:*} xy=${spot#*:}
  28. sshv '. ~/sessenv; wmctrl -c "Welcome" 2>/dev/null; wmctrl -c "Plugin loading failure" 2>/dev/null; for w in $(xdotool search --name "^Welcome" 2>/dev/null); do xdotool windowclose $w; done; true'
  29. lv pointer "$vm" "${xy%,*}" "${xy#*,}" >/dev/null 2>&1
  30. sleep 1
  31. lv pointer "$vm" "$(( ${xy%,*} + 2 ))" "$(( ${xy#*,} + 1 ))" >/dev/null 2>&1
  32. sleep 10
  33. lv shot "$vm" "$out/hover-$name.png"
  34. done
  35. sshv 'pkill -f "[l]inux-wallpaperengine.bin"; true'
  36. python3 -I "$HERE/hover_check.py" "$out/hover-mon.png" "$out/hover-sun.png" "$out/hover-dock.png" "$out/hover-top.png"