release_check.sh 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324
  1. #!/bin/bash
  2. # release_check.sh [--vm name]... [--candidate dir] [--app dir|.deb] [--no-overlay] - the release gate of
  3. # RELEASE_TESTING.md: every VM with a profile (a lane runs its VMs one after the other, the gate uses 4 lanes with `--vm`; every VM takes one of MAXVMS=5 slots from vm_slots.sh first), each from its golden disk (a throwaway overlay, see
  4. # `linuxvm.sh golden`), with guest_test.sh's checks (wallpapers, hotswap, pause on fullscreen, SIGKILL cleanup), the
  5. # frame checks, the desktop icons check (desktop_icons_check.sh, we_manager's overlay on Plasma), we_manager's install/launch/autostart (wem_check.sh), the overlay's auto mode (desktop_icons_auto_check.sh), the video optimizer (video_optimize_check.sh) and update flow (update_check.sh). A failed check
  6. # is retried once. Writes reports/<date>/summary.md plus the screenshots and logs of every VM, exit code 1 when anything
  7. # failed. VMs are powered off afterwards, the overlay is thrown away (KEEP_VM=1 leaves the VM running to look at it).
  8. # --vm name only this profile (repeatable); default: every file in profiles/
  9. # --candidate dir folder with lwe-hints/ (the engine under test) copied over ~/lwe/lwe-hints in the guest
  10. # --app path we_manager's dist/linux-unpacked or a .deb; without it the we_manager checks are skipped
  11. # --engine-tarball the candidate's portable tarball, served to we_manager as the new engine release (update_check.sh)
  12. # --flatpak bundle the CI .flatpak bundle: profiles with FLATPAK=1 install it and run flatpak_check.sh and wem_features_check.sh inside it (a full run without it fails, --quick, --wem-only and a coverage run with COLLECT_GCOV skip the step)
  13. # --no-overlay run on the VM's disk as it is (a VM without a golden disk is run like this anyway)
  14. # --wem-only only we_manager's checks (clean install, update and downgrade, install/launch): boot, candidate, then wem.txt
  15. # COLLECT_GCOV=dir copies the guest's /tmp/lwe-gcov (profile data of a coverage candidate) to dir/<vm>,
  16. # COVERAGE_STEP=cmd runs `cmd <vm>` before that
  17. # --quick for daily runs: the engine level groups (video, automute) only on profiles with FULL_ENGINE=1, the hotswap
  18. # cycle only its first 3 swaps elsewhere; the release candidate gets the full run
  19. # A profile (profiles/<vm>.sh) sets: VM, SCREEN (as --screen-root names it), SHOT_CMD (command with $SHOT_FILE, or
  20. # host), FULLSCREEN_CMD / MAXIMIZE_CMD (open a fullscreen / maximized window), WEM (deb | app | none, how we_manager is installed), WEM_FLAGS,
  21. # FLATPAK (1 = also run the Flatpak checks with --flatpak), WEM_LAUNCH (prefix of the we_manager start line, e.g. `systemd-run --user --scope -q` where an ssh session's end kills the app), LOGIN_PASSWORD (typed at a greeter without autologin), BOOT_PREP (guest command run as soon as ssh answers, before the session is awaited: Zorin's Xorg profile switches GDM there), PREP (guest command run once the session is up, e.g. keeps the screen from locking), EXTRA (function name run last,
  22. # gets the VM name; prints PASS/FAIL lines).
  23. HERE=$(cd "$(dirname "$0")" && pwd)
  24. LINUXVM=${LINUXVM:-$HOME/.local/share/linuxvm}
  25. vms=() candidate="" app="" flatpak="" overlay=1 tarball="" quick=0 wemonly=0
  26. while [ $# -gt 0 ]; do
  27. case $1 in
  28. --vm) vms+=("$2"); shift ;;
  29. --candidate) candidate=$2; shift ;;
  30. --app) app=$2; shift ;;
  31. --engine-tarball) tarball=$2; shift ;;
  32. --flatpak) flatpak=$2; shift ;;
  33. --no-overlay) overlay=0 ;;
  34. --quick) quick=1 ;;
  35. --wem-only) wemonly=1 ;;
  36. *) sed -n '2,20p' "$0"; exit 2 ;;
  37. esac
  38. shift
  39. done
  40. [ ${#vms[@]} -gt 0 ] || for f in "$HERE"/profiles/*.sh; do vms+=("$(basename "$f" .sh)"); done
  41. report=${REPORT_DIR:-$HERE/reports/$(date +%F)}
  42. mkdir -p "$report"
  43. summary=$report/summary.md
  44. echo "# Release check $(date '+%F %H:%M')" > "$summary"
  45. [ -n "$candidate" ] && echo "Engine candidate: \`$candidate\`" >> "$summary"
  46. [ -n "$app" ] && echo "we_manager: \`$app\`" >> "$summary"
  47. total_status=0
  48. . "$HERE/vm_slots.sh"
  49. lv() { "$HERE/linuxvm.sh" "$@"; }
  50. once_more() {
  51. local out status
  52. out=$("$@" 2>&1)
  53. status=$?
  54. if [ $status != 0 ] || grep -q '^FAIL' <<<"$out"; then
  55. sed 's/^/first run: /' <<<"$out"
  56. "$@" 2>&1
  57. status=$?
  58. [ $status = 0 ] || echo "FAIL $(basename "$1"): exited with status $status"
  59. else
  60. echo "$out"
  61. fi
  62. }
  63. sshv() { lv ssh "$VM" "$@" </dev/null; }
  64. wait_off() {
  65. for _ in $(seq 45); do
  66. [ -f "$LINUXVM/vms/$VM/qemu.pid" ] && kill -0 "$(cat "$LINUXVM/vms/$VM/qemu.pid")" 2>/dev/null || return 0
  67. sleep 2
  68. done
  69. lv kill "$VM"; sleep 2
  70. }
  71. # the guest_test.sh group a result line belongs to, empty when unknown (the whole run is repeated then)
  72. group_of() {
  73. case $1 in
  74. "TIME "*) set -- $1; echo "$2" ;;
  75. *"hotswap cycle"*|*"/shot-cycle-"*) echo cycle ;;
  76. *"hotswap video"*) echo video ;;
  77. *"multi monitor"*|*"first monitor"*|*"second monitor"*) echo multi ;;
  78. *"dpms pause"*) echo dpms ;;
  79. *"automute ignore"*) echo automuteignore ;;
  80. *transition*) echo transition ;;
  81. *automute*) echo automute ;;
  82. *"behavior:"*|*"hotswap:"*|*"fullscreen pause"*|*"maximized pause"*|*SIGKILL*|*"/hot-before.png"*|*"/hot-after.png"*) echo behavior ;;
  83. *"baseline screenshot"*|*"/shot-"[0-9]*".png"*) echo wallpapers ;;
  84. *) if [[ $1 =~ ^(PASS|FAIL|SKIP)\ [0-9]{8,10}: ]]; then echo wallpapers; fi ;;
  85. esac
  86. }
  87. tmark() { echo "$1 $((SECONDS - T_LAST))" >> "$report/$VM/timing.txt"; T_LAST=$SECONDS; }
  88. runs() { [ -z "$ONLY" ] || [[ " $ONLY " == *" $1 "* ]]; }
  89. run_checks() {
  90. local out=/tmp/lwe-test
  91. lv scp "$VM" "$HERE/guest_test.sh" lwe/guest_test.sh
  92. lv scp "$VM" "$HERE/fullscreen_window.py" lwe/fullscreen_window.py
  93. lv scp "$VM" "$HERE/maximize_kde.sh" lwe/maximize_kde.sh
  94. [ -n "$HIDE" ] && lv scp "$VM" "$HERE/hide_steam_kde.sh" lwe/hide_steam_kde.sh
  95. sshv "rm -rf $out; mkdir -p $out"
  96. local shots=""
  97. if [ "$SHOT_CMD" = host ]; then "$HERE/host_shots.sh" "$VM" "$out" 900 >/dev/null 2>&1 & shots=$!; fi
  98. sshv ". ~/sessenv; BEHAVIOR=1 AUTOMUTE_IGNORE='${AUTOMUTE_IGNORE:-}' CYCLE_UPTO='${CYCLE_UPTO:-}' ${RETRY_WALLPAPERS:+WALLPAPERS='$RETRY_WALLPAPERS'} ONLY='$ONLY' SETTLE=${SETTLE:-25} LWE_ARGS='--screen-root $SCREEN' SHOT_CMD='$SHOT_CMD' FULLSCREEN_CMD='$FULLSCREEN_CMD' MAXIMIZE_CMD='$MAXIMIZE_CMD' MINIMIZE_CMD='$MINIMIZE_CMD' MULTI_SHOT_CMD='$MULTI_SHOT_CMD' ~/lwe/guest_test.sh"
  99. [ -n "$shots" ] && wait "$shots"
  100. local local_dir=$report/$VM/shots
  101. mkdir -p "$local_dir"
  102. scp -q -r -i "$LINUXVM/id_ed25519" -P "$(cat "$LINUXVM/vms/$VM/port")" -o StrictHostKeyChecking=no \
  103. -o UserKnownHostsFile=/dev/null -o LogLevel=ERROR "lab@127.0.0.1:$out/*" "$local_dir/" 2>/dev/null
  104. local shot
  105. if [ -f "$local_dir/baseline.png" ]; then
  106. if runs wallpapers; then
  107. for shot in "$local_dir"/shot-[0-9]*.png; do [ -f "$shot" ] && python3 -I "$HERE/check_frame.py" --baseline "$local_dir/baseline.png" "$shot"; done
  108. fi
  109. if runs cycle; then
  110. for shot in "$local_dir"/shot-cycle-*.png; do [ -f "$shot" ] && python3 -I "$HERE/check_frame.py" --baseline "$local_dir/baseline.png" "$shot"; done
  111. fi
  112. if runs windowbg; then
  113. for shot in "$local_dir"/shot-windowbg-*.png; do [ -f "$shot" ] && python3 -I "$HERE/check_frame.py" --baseline "$local_dir/baseline.png" "$shot"; done
  114. fi
  115. if runs wallpapers || runs cycle || runs windowbg; then
  116. local id
  117. for shot in "$local_dir"/shot-[0-9]*.png "$local_dir"/shot-cycle-*.png "$local_dir"/shot-windowbg-*.png; do
  118. [ -f "$shot" ] || continue
  119. id=${shot##*-}; id=${id%.png}
  120. [ -f "$HERE/reference/$id.png" ] && python3 -I "$HERE/check_frame.py" --reference "$HERE/reference/$id.png" "$shot"
  121. done
  122. fi
  123. fi
  124. runs video && [ -f "$local_dir/fresh-video.png" ] && [ -f "$local_dir/swap-video.png" ] \
  125. && python3 -I "$HERE/check_frame.py" --similar "$local_dir/fresh-video.png" "$local_dir/swap-video.png" 14 \
  126. | sed 's/^\(PASS\|FAIL\) /\1 hotswap video: /'
  127. if runs multi && [ -f "$local_dir/multi-geometry" ] && [ -f "$local_dir/multi-shot.png" ]; then
  128. read -r w1 w2 < "$local_dir/multi-geometry"
  129. split=$(python3 -c "print($w1 / ($w1 + $w2))")
  130. python3 -I "$HERE/check_frame.py" --crop "0,$split" --baseline "$local_dir/multi-baseline.png" "$local_dir/multi-shot.png" \
  131. | sed 's/^\(PASS\|FAIL\) /\1 first monitor: /'
  132. python3 -I "$HERE/check_frame.py" --crop "$split,1" --baseline "$local_dir/multi-baseline.png" "$local_dir/multi-shot.png" \
  133. | sed 's/^\(PASS\|FAIL\) /\1 second monitor: /'
  134. fi
  135. runs transition && [ -f "$local_dir/tr-half.ppm" ] && [ -f "$local_dir/tr-half-old.ppm" ] && [ -f "$local_dir/tr-half-new.ppm" ] \
  136. && python3 -I "$HERE/check_frame.py" --blend "$local_dir/tr-half-old.ppm" "$local_dir/tr-half-new.ppm" "$local_dir/tr-half.ppm" \
  137. | sed 's/^\(PASS\|FAIL\|SKIP\) /\1 transition: /'
  138. runs behavior && [ -f "$local_dir/hot-before.png" ] && python3 -I "$HERE/check_frame.py" --differ "$local_dir/hot-before.png" "$local_dir/hot-after.png"
  139. return 0
  140. }
  141. for VM in "${vms[@]}"; do
  142. take_slot
  143. unset AUTOMUTE_IGNORE FULL_ENGINE HIDE POINTER POINTER_DOCK_XY WEM_FLAGS WEM_LAUNCH LOGIN_PASSWORD SCREEN SHOT_CMD FULLSCREEN_CMD MAXIMIZE_CMD MINIMIZE_CMD MULTI MULTI_SHOT_CMD WEM WEM_FLAGS PREP BOOT_PREP EXTRA SETTLE ICONS FLATPAK
  144. # shellcheck disable=SC1090
  145. . "$HERE/profiles/$VM.sh" || { echo "no profile for $VM"; release_slot; continue; }
  146. export WEM_FLAGS WEM_LAUNCH # the we_manager scripts add them to its command line (COSMIC)
  147. mkdir -p "$report/$VM"
  148. log=$report/$VM/run.log
  149. echo "== $VM $(date +%T)"
  150. : > "$report/$VM/timing.txt"; T_START=$SECONDS; T_LAST=$SECONDS
  151. {
  152. if [ "$overlay" = 1 ] && [ -f "$LINUXVM/vms/$VM/golden.qcow2" ]; then lv fresh "$VM"; fi
  153. LINUXVM_OUTPUTS=${MULTI:+2} lv start "$VM"
  154. ready=0 logged_in=0
  155. if [ -n "$BOOT_PREP" ]; then
  156. for _ in $(seq 60); do sshv true 2>/dev/null && break; sleep 3; done
  157. sshv "$BOOT_PREP"
  158. fi
  159. for _ in $(seq 60); do
  160. # a greeter without autologin (COSMIC): type the password once the VM answers
  161. if [ -n "$LOGIN_PASSWORD" ] && [ $logged_in = 0 ] && sshv true 2>/dev/null; then
  162. sleep 25; lv type "$VM" "$LOGIN_PASSWORD"; lv keys "$VM" ret; logged_in=1
  163. fi
  164. lv scp "$VM" "$HERE/sessenv.sh" lwe/sessenv.sh 2>/dev/null && sshv "bash ~/lwe/sessenv.sh" >/dev/null 2>&1 && { ready=1; break; }
  165. sleep 5
  166. done
  167. if [ $ready = 0 ]; then echo "FAIL $VM: no desktop session within 5 minutes"; else
  168. # a golden disk keeps what an earlier run left: we_manager's autostart entry and playlist, stray engines
  169. sshv "pkill -x we-manager; pkill -x linux-wallpaper; rm -rf ~/.config/autostart/we-manager.desktop ~/.config/we-manager; true"
  170. [ -n "$HIDE" ] && lv scp "$VM" "$HERE/hide_steam_kde.sh" lwe/hide_steam_kde.sh
  171. [ -n "$PREP" ] && sshv ". ~/sessenv; $PREP"
  172. if [ -n "$candidate" ]; then
  173. sshv "rm -rf ~/lwe/lwe-hints.new"
  174. lv scp "$VM" "$candidate/lwe-hints" lwe/lwe-hints.new && sshv "rm -rf ~/lwe/lwe-hints && mv ~/lwe/lwe-hints.new ~/lwe/lwe-hints"
  175. fi
  176. for wp in wp-3471294034 wp-3818199837 wp-1367456719; do
  177. sshv "[ -d ~/lwe/$wp ]" || lv scp "$VM" "$LINUXVM/payload/$wp" lwe/
  178. done
  179. sleep 20
  180. sshv ". ~/sessenv; pkill -x we-manager; sleep 3; pkill -x we-manager; true"
  181. if [ -n "$HIDE" ]; then lv scp "$VM" "$HERE/hide_steam_kde.sh" lwe/hide_steam_kde.sh; sshv ". ~/sessenv; bash ~/lwe/hide_steam_kde.sh"; fi
  182. tmark boot
  183. first_only="" CYCLE_UPTO=""
  184. if [ $quick = 1 ] && [ "${FULL_ENGINE:-0}" != 1 ]; then first_only="wallpapers behavior cycle transition multi windowbg dpms"; CYCLE_UPTO=3; fi
  185. if [ $wemonly = 1 ]; then : > "$report/$VM/checks.txt"; else
  186. ONLY="$first_only" run_checks > "$report/$VM/checks.txt" 2>&1
  187. fi
  188. CYCLE_UPTO=""
  189. tmark checks
  190. fatal=0
  191. if grep -q '^FATAL' "$report/$VM/checks.txt"; then
  192. fatal=1
  193. echo "FATAL, the rest of the run for $VM is skipped"
  194. elif grep -q '^FAIL' "$report/$VM/checks.txt"; then
  195. retry="" full=0 RETRY_WALLPAPERS="" cycle_upto=0
  196. while IFS= read -r line; do
  197. g=$(group_of "$line")
  198. if [ -z "$g" ]; then full=1; elif [[ " $retry " != *" $g "* ]]; then retry="$retry $g"; fi
  199. case $g in
  200. wallpapers)
  201. id=$(grep -oE '(shot-|^FAIL )[0-9]{8,10}' <<< "$line" | grep -oE '[0-9]{8,10}' | head -1)
  202. if [ -z "$id" ]; then RETRY_WALLPAPERS=all; elif [ "$RETRY_WALLPAPERS" != all ] && [[ " $RETRY_WALLPAPERS " != *" $id "* ]]; then RETRY_WALLPAPERS="$RETRY_WALLPAPERS $id"; fi ;;
  203. cycle)
  204. step=$(grep -oE '(shot-cycle-|hotswap cycle step )[0-9]+' <<< "$line" | grep -oE '[0-9]+$' | head -1)
  205. if [ -z "$step" ]; then cycle_upto=99; elif [ "$step" -gt "$cycle_upto" ]; then cycle_upto=$step; fi ;;
  206. esac
  207. done < <(grep '^FAIL' "$report/$VM/checks.txt")
  208. [ $full = 1 ] && retry=""
  209. [ "$RETRY_WALLPAPERS" = all ] && RETRY_WALLPAPERS=""
  210. RETRY_WALLPAPERS=${RETRY_WALLPAPERS# }
  211. CYCLE_UPTO=""; [ "$cycle_upto" -gt 0 ] && [ "$cycle_upto" -lt 99 ] && CYCLE_UPTO=$cycle_upto
  212. [ -n "$retry" ] && [[ " $retry " != *" wallpapers "* ]] && RETRY_WALLPAPERS=""
  213. echo "retrying the failed checks once (groups:${retry:- all}${RETRY_WALLPAPERS:+, wallpapers $RETRY_WALLPAPERS}${CYCLE_UPTO:+, cycle up to step $CYCLE_UPTO})"
  214. sshv "pkill -f '[l]inux-wallpaperengine' 2>/dev/null; true"; sleep 5
  215. cp "$report/$VM/checks.txt" "$report/$VM/checks-first.txt"
  216. ONLY="${retry# }" run_checks > "$report/$VM/checks-retry.txt" 2>&1
  217. if [ -z "$retry" ]; then cp "$report/$VM/checks-retry.txt" "$report/$VM/checks.txt"; else
  218. while IFS= read -r line; do
  219. g=$(group_of "$line")
  220. if [ -n "$g" ] && [[ " $retry " == *" $g "* ]]; then
  221. replaced=1
  222. case $g in
  223. wallpapers)
  224. if [ -n "$RETRY_WALLPAPERS" ] && [[ $line != TIME* ]]; then
  225. replaced=0
  226. for id in $RETRY_WALLPAPERS; do [[ $line == *"$id"* ]] && replaced=1; done
  227. fi ;;
  228. cycle)
  229. if [ -n "$CYCLE_UPTO" ] && [[ $line != TIME* ]]; then
  230. step=$(grep -oE '(shot-cycle-|hotswap cycle step )[0-9]+' <<< "$line" | grep -oE '[0-9]+$' | head -1)
  231. [ -n "$step" ] && [ "$step" -gt "$CYCLE_UPTO" ] && replaced=0
  232. fi ;;
  233. esac
  234. [ $replaced = 1 ] && continue
  235. fi
  236. echo "$line"
  237. done < "$report/$VM/checks-first.txt" > "$report/$VM/checks.txt"
  238. cat "$report/$VM/checks-retry.txt" >> "$report/$VM/checks.txt"
  239. awk '!seen[$0]++' "$report/$VM/checks.txt" > "$report/$VM/checks.merged" && mv "$report/$VM/checks.merged" "$report/$VM/checks.txt"
  240. fi
  241. RETRY_WALLPAPERS="" CYCLE_UPTO=""
  242. fi
  243. [ -f "$report/$VM/checks-retry.txt" ] && tmark retry
  244. if [ $fatal = 0 ] && [ $wemonly = 0 ] && [ "${POINTER:-1}" = 1 ]; then
  245. POINTER_DOCK_XY=${POINTER_DOCK_XY:-} "$HERE/pointer_check.sh" "$VM" "$SCREEN" "$report/$VM/shots" > "$report/$VM/pointer.txt" 2>&1
  246. if grep -q '^FAIL' "$report/$VM/pointer.txt"; then
  247. cp "$report/$VM/pointer.txt" "$report/$VM/pointer-first.txt"
  248. POINTER_DOCK_XY=${POINTER_DOCK_XY:-} "$HERE/pointer_check.sh" "$VM" "$SCREEN" "$report/$VM/shots" > "$report/$VM/pointer.txt" 2>&1
  249. fi
  250. grep -E '^(PASS|FAIL|SKIP)' "$report/$VM/pointer.txt" >> "$report/$VM/checks.txt"
  251. fi
  252. tmark pointer
  253. if [ $fatal = 0 ] && [ $wemonly = 0 ] && [ "${ICONS:-1}" = 1 ]; then
  254. sshv "pkill -f '[l]inux-wallpaperengine' 2>/dev/null; true"; sleep 3
  255. "$HERE/desktop_icons_check.sh" "$VM" "$SCREEN" > "$report/$VM/icons.txt" 2>&1
  256. if grep -q '^FAIL' "$report/$VM/icons.txt"; then
  257. cp "$report/$VM/icons.txt" "$report/$VM/icons-first.txt"
  258. "$HERE/desktop_icons_check.sh" "$VM" "$SCREEN" > "$report/$VM/icons.txt" 2>&1
  259. fi
  260. grep -E '^(PASS|FAIL|SKIP)' "$report/$VM/icons.txt" >> "$report/$VM/checks.txt"
  261. fi
  262. tmark icons
  263. if [ $fatal = 0 ] && [ -n "$app" ] && [ "${WEM:-none}" != none ]; then
  264. # with the candidate's engine tarball the update check installs it (as a v99 release), we_manager's own
  265. # checks then run on it instead of the last published engine
  266. {
  267. [ -n "$tarball" ] && ENGINE_TARBALL=$tarball "$HERE/clean_install_check.sh" "$VM" "$app"
  268. ENGINE_TARBALL=$tarball "$HERE/update_check.sh" "$VM" "$app"
  269. SKIP_ENGINE_INSTALL=${tarball:+1} "$HERE/wem_check.sh" "$VM" "$app" "$SCREEN"
  270. once_more "$HERE/desktop_icons_auto_check.sh" "$VM" "$app"
  271. once_more "$HERE/video_optimize_check.sh" "$VM" "$app" "$SCREEN"
  272. once_more "$HERE/wem_features_check.sh" "$VM" "$app" "$SCREEN"
  273. } > "$report/$VM/wem.txt" 2>&1
  274. fi
  275. tmark wem
  276. if [ $fatal = 0 ] && [ -z "$flatpak" ] && [ "${FLATPAK:-0}" = 1 ] && [ $quick = 0 ] && [ $wemonly = 0 ] && [ -z "$COLLECT_GCOV" ]; then
  277. echo "FAIL flatpak: no bundle given, the Flatpak checks did not run (build one with build_flatpak_bundle.sh, pass --flatpak)" > "$report/$VM/flatpak.txt"
  278. elif [ $fatal = 0 ] && [ -n "$flatpak" ] && [ "${FLATPAK:-0}" = 1 ]; then
  279. {
  280. once_more "$HERE/flatpak_check.sh" "$VM" "$flatpak" "$SCREEN"
  281. once_more "$HERE/wem_features_check.sh" "$VM" "flatpak:installed" "$SCREEN"
  282. } > "$report/$VM/flatpak.txt" 2>&1
  283. fi
  284. tmark flatpak
  285. [ $fatal = 0 ] && [ $wemonly = 0 ] && [ -n "$EXTRA" ] && $EXTRA "$VM" > "$report/$VM/extra.txt" 2>&1
  286. tmark extra
  287. sshv "cat /tmp/lwe-test/engine-*.log 2>/dev/null | tail -n 200" > "$report/$VM/engine-tail.log" 2>&1
  288. # a coverage candidate (tools/analysis, launcher exports GCOV_PREFIX): an extra step of the run, then the profile data
  289. [ -n "$COVERAGE_STEP" ] && $COVERAGE_STEP "$VM" > "$report/$VM/coverage-step.txt" 2>&1
  290. if [ -n "$COLLECT_GCOV" ]; then
  291. mkdir -p "$COLLECT_GCOV/$VM"
  292. sshv 'tar -C /tmp/lwe-gcov -cf - . 2>/dev/null' | tar -C "$COLLECT_GCOV/$VM" -xf -
  293. fi
  294. fi
  295. if [ -n "$KEEP_VM" ]; then echo "KEEP_VM set: $VM stays up for a look"; else
  296. sshv "sudo systemctl poweroff" >/dev/null 2>&1 || lv stop "$VM" >/dev/null 2>&1; wait_off
  297. [ "$overlay" = 1 ] && [ -f "$LINUXVM/vms/$VM/golden.qcow2" ] && lv fresh "$VM"
  298. fi
  299. tmark shutdown
  300. } > "$log" 2>&1
  301. pass=$(cat "$report/$VM"/{checks,wem,flatpak,extra}.txt 2>/dev/null | grep -c '^PASS')
  302. failed=$(cat "$report/$VM"/{checks,wem,flatpak,extra}.txt 2>/dev/null | grep -E '^(FAIL|FATAL)'; grep -E '^(FAIL|FATAL)' "$log")
  303. {
  304. echo; echo "## $VM"
  305. if [ -z "$failed" ]; then echo "$pass checks passed."; else
  306. echo "$pass checks passed, failed:"; echo; echo "$failed" | sed 's/^/- /'; total_status=1
  307. fi
  308. for f in "$report/$VM"/{checks,wem,flatpak,extra}.txt; do grep -h '^SKIP' "$f" 2>/dev/null | sed 's/^/- /'; done
  309. echo "- time $((SECONDS - T_START)) s: $(awk '{printf "%s%s %d", (NR > 1 ? ", " : ""), $1, $2}' "$report/$VM/timing.txt"); groups: $(grep -h '^TIME' "$report/$VM/checks.txt" 2>/dev/null | awk '{printf "%s%s %d", (NR > 1 ? ", " : ""), $2, $3}')"
  310. } >> "$summary"
  311. echo " $pass passed$([ -n "$failed" ] && echo ", FAILED")"
  312. release_slot
  313. done
  314. echo "report: $summary"
  315. exit $total_status