#!/bin/bash # shellcheck disable=SC2034 DESCRIPTION="install an older commit, update to the commit under test: same machine as a fresh install" IMAGE=base TIER="nightly" mapfile -t VARIANTS < <(sed 's/#.*//' "$(dirname "${BASH_SOURCE[0]}")/../baselines" | awk 'NF { print $1 }') scenario() { [ -f "$(reference_fingerprint)" ] \ || skip "needs the fingerprint 10-fresh-install saves; run both in the same run" local sha sha="$(git -C "$SMOKETEST_REPO" rev-parse "$VARIANT^{commit}")" upstream_set "$sha" # Older installers can't finish here as they did on a real machine. Install # those baselines with fixes on top, then put the clone back at the baseline # itself, as on a machine installed back then: update pulls --ff-only. # - The source-built herdr pins a zig version Arch has moved on from; # herdr-bin provides herdr, and is what HEAD installs instead # - Plain gext install asks GNOME Shell, which shows a dialog no one clicks; # --filesystem doesn't ask, and is what HEAD does # - voxtype from source no longer links without clang and cmake, which later # commits (and HEAD) install # - install.sh sources install-kickstart-nvim.sh, whose set -u then stops # bitwarden.sh on its unset LINE; without set -u, that line did nothing upstream_commit "Smoketest: fixes to install this baseline in a VM" ' sed -i "s/^\([[:space:]]*\)herdr$/\1herdr-bin/" packages.conf grep -qx "[[:space:]]*clang" packages.conf \ || sed -i "s/^\([[:space:]]*\)voxtype$/\1clang\n\1cmake\n\1voxtype/" packages.conf sed -i "s|gext install|gext --filesystem install|" gnome/gnome-extensions.sh sed -i "s/\"\$LINE\"/\"\${LINE:-}\"/g" bitwarden.sh git diff --quiet && exit 0' # Older installers also run flatpak install as the user, which polkit allows # at the desktop (or asks there) but refuses over SSH. HEAD uses sudo run_in_vm allow-flatpak "printf '%s\n' \ 'polkit.addRule(function(action, subject) {' \ ' if (action.id.indexOf(\"org.freedesktop.Flatpak.\") == 0 && subject.user == \"'\"\$USER\"'\")' \ ' return polkit.Result.YES;' \ '});' | sudo tee /etc/polkit-1/rules.d/00-smoketest-flatpak.rules" assert_status 0 cd_install # voxtype's build from source fails now and then (Vulkan shaders missing at # link time), and the baseline isn't what's under test: try once more, as # someone would. The installer skips what it already installed if [ "$STATUS" -ne 0 ]; then echo "The baseline's install failed; running it once more" cd_install fi assert_status 0 run_in_vm reset "sudo rm /etc/polkit-1/rules.d/00-smoketest-flatpak.rules git -C ~/.local/share/coredesktop reset -q --hard $(q "$sha")" assert_status 0 vm_reboot upstream_set "$SMOKETEST_REF" cd_update assert_status 0 vm_reboot health fingerprint "$SMOKETEST_RESULTS/updated.fingerprint" assert_same_fingerprint "$(reference_fingerprint)" "$SMOKETEST_RESULTS/updated.fingerprint" }