#!/bin/bash # coverage_flatpak.sh - the engine of a coverage candidate (~/lwe/lwe-hints in the guest, release_check.sh --candidate) # run inside the Flatpak sandbox of we_manager, which is what makes the compositor's layer shell invisible on Hyprland and # the engine fetch its Wayland connection from the host (Desktop/HostWayland). Needs FLATPAK_BUNDLE (a we_manager .flatpak, only # its sandbox and runtime matter, the engine inside is replaced) and a running session (sessenv). Used as # COVERAGE_STEP by release_check.sh, the profile data of the sandboxed engine goes to $COLLECT_GCOV/-flatpak. # Prints one PASS|FAIL line per step. HERE=$(cd "$(dirname "$0")" && pwd) vm=$1 app=io.github.WallpaperEngineLover.we_manager sshv() { "$HERE/linuxvm.sh" ssh "$vm" "$@" /tmp/fp-install.log 2>&1" \ && echo "PASS the bundle installs" || { echo "FAIL install: $(sshv 'tail -n 3 /tmp/fp-install.log')"; exit 1; } files=$(sshv "flatpak --user info -l $app")/files engine=$files/lib/linux-wallpaperengine-kde sshv "rm -rf '$engine' && cp -a ~/lwe/lwe-hints '$engine' && sed -i 's|^export GCOV_PREFIX=.*|export GCOV_PREFIX=\"\$HOME/.var/app/$app/gcov\" GCOV_PREFIX_STRIP=0|' '$engine/linux-wallpaperengine'" \ && echo "PASS the coverage engine is inside the Flatpak" || { echo "FAIL could not replace the engine"; exit 1; } sshv 'rm -rf ~/.var/app/'$app'/gcov; mkdir -p ~/.var/app/'$app'/gcov' run_engine() { local label=$1 seconds=$2 shift 2 sshv ". ~/sessenv; (setsid nohup flatpak run --command=/app/lib/linux-wallpaperengine-kde/linux-wallpaperengine $app --assets-dir \$HOME/lwe/assets --screen-root \${SCREEN:-Virtual-1} --silent $* > /tmp/fp-$label.log 2>&1 /dev/null" | tar -C "$COLLECT_GCOV/$vm-flatpak" -xf - fi