Files
davidandClaude Opus 5.5 9e4b78bb88 Use QEMU's standard VGA instead of virtio-vga
On Arch, -vga virtio needs qemu-hw-display-virtio-vga and also
qemu-hw-display-virtio-gpu, which that package doesn't depend on; with only
the first, QEMU segfaults at start without a message. The smoketest's VMs
are headless (or VNC), so -vga std, which qemu-base has, is enough. This
reverts 2207208's extra package and checks.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-04 20:13:13 -07:00

82 lines
2.7 KiB
Bash

#!/usr/bin/env bats
load test_helper
config() {
cat "$HOME/.config/coredesktop-dev/config"
}
@test "install refuses the deployed copy, then takes a working copy" {
git clone -q "$UPSTREAM" "$WC"
run bash "$PROJECT/install.sh" <<< "$(printf '%s\n' "$DEPLOYED" "$WC" n)"
[ "$status" -eq 0 ]
[[ "$output" == *"is the deployed copy"* ]]
[ "$(config)" = "WORKING_COPY=$(printf '%q' "$WC")" ]
[ "$(readlink "$HOME/.local/bin/coredesktop-dev")" = "$PROJECT/bin/coredesktop-dev" ]
called install_packages shellcheck bats tea qemu-base libisoburn
}
@test "install refuses the deployed copy however it's spelled" {
git clone -q "$UPSTREAM" "$WC"
run bash "$PROJECT/install.sh" <<< "$(printf '%s\n' '~/.local/share/coredesktop/' "$WC" n)"
[ "$status" -eq 0 ]
[[ "$output" == *"is the deployed copy"* ]]
[ "$(config)" = "WORKING_COPY=$(printf '%q' "$WC")" ]
}
@test "install offers to clone the working copy from the deployed copy's origin" {
run bash "$PROJECT/install.sh" <<< "$(printf '%s\n' "" y n)"
[ "$status" -eq 0 ]
[ "$(git -C "$WC" remote get-url origin)" = "$UPSTREAM" ]
[ "$(config)" = "WORKING_COPY=$(printf '%q' "$WC")" ]
}
@test "install won't use a folder that isn't a clone and isn't empty" {
mkdir -p "$HOME/other"
touch "$HOME/other/file"
git clone -q "$UPSTREAM" "$WC"
run bash "$PROJECT/install.sh" <<< "$(printf '%s\n' "$HOME/other" "$WC" n)"
[ "$status" -eq 0 ]
[[ "$output" == *"isn't a clone of CoreDesktop, and isn't empty"* ]]
[ "$(config)" = "WORKING_COPY=$(printf '%q' "$WC")" ]
}
@test "install is safe to re-run, and Enter keeps the saved working copy" {
# Somewhere other than the default, ~/Projects/coredesktop
other="$HOME/work/coredesktop"
git clone -q "$UPSTREAM" "$other"
run bash "$PROJECT/install.sh" <<< "$(printf '%s\n' "$other" n)"
[ "$status" -eq 0 ]
run bash "$PROJECT/install.sh" <<< "$(printf '%s\n' "" n)"
[ "$status" -eq 0 ]
[ "$(config)" = "WORKING_COPY=$(printf '%q' "$other")" ]
[ ! -e "$WC" ]
}
@test "install stops without an answer instead of looping" {
run bash "$PROJECT/install.sh" < /dev/null
[ "$status" -eq 1 ]
[[ "$output" == *"No answer"* ]]
[ ! -f "$HOME/.config/coredesktop-dev/config" ]
}
@test "install offers the pre-push hook, and installs it on yes" {
git clone -q "$UPSTREAM" "$WC"
run bash "$PROJECT/install.sh" <<< "$(printf '%s\n' "$WC" y)"
[ "$status" -eq 0 ]
grep -qxF "# Installed by coredesktop-dev; remove with: coredesktop-dev hooks remove" \
"$WC/.git/hooks/pre-push"
}
@test "install stops if CoreDesktop isn't installed" {
rm -rf "$DEPLOYED"
run bash "$PROJECT/install.sh" <<< ""
[ "$status" -eq 1 ]
[[ "$output" == *"CoreDesktop isn't installed"* ]]
}