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>
52 lines
1.7 KiB
Bash
52 lines
1.7 KiB
Bash
#!/usr/bin/env bats
|
|
|
|
load test_helper
|
|
|
|
HOOK_MARKER="# Installed by coredesktop-dev; remove with: coredesktop-dev hooks remove"
|
|
|
|
@test "update installs the packages and links the command, without asking anything" {
|
|
run bash "$PROJECT/update.sh" < /dev/null
|
|
[ "$status" -eq 0 ]
|
|
called install_packages shellcheck bats tea qemu-base libisoburn
|
|
[ "$(readlink "$HOME/.local/bin/coredesktop-dev")" = "$PROJECT/bin/coredesktop-dev" ]
|
|
}
|
|
|
|
@test "update fixes a link that points somewhere else" {
|
|
mkdir -p "$HOME/.local/bin"
|
|
ln -s /nowhere "$HOME/.local/bin/coredesktop-dev"
|
|
|
|
run bash "$PROJECT/update.sh" < /dev/null
|
|
[ "$status" -eq 0 ]
|
|
[ "$(readlink "$HOME/.local/bin/coredesktop-dev")" = "$PROJECT/bin/coredesktop-dev" ]
|
|
}
|
|
|
|
@test "update leaves an unchanged pre-push hook alone" {
|
|
make_working_copy
|
|
cp "$PROJECT/hooks/pre-push" "$WC/.git/hooks/pre-push"
|
|
touch -d '2020-01-01' "$WC/.git/hooks/pre-push"
|
|
|
|
run bash "$PROJECT/update.sh" < /dev/null
|
|
[ "$status" -eq 0 ]
|
|
[ "$(date -r "$WC/.git/hooks/pre-push" +%Y)" = 2020 ]
|
|
[[ "$output" != *"Updated the pre-push hook"* ]]
|
|
}
|
|
|
|
@test "update refreshes our pre-push hook when it has changed" {
|
|
make_working_copy
|
|
printf '%s\n' '#!/bin/bash' "$HOOK_MARKER" 'old version' > "$WC/.git/hooks/pre-push"
|
|
|
|
run bash "$PROJECT/update.sh" < /dev/null
|
|
[ "$status" -eq 0 ]
|
|
cmp "$PROJECT/hooks/pre-push" "$WC/.git/hooks/pre-push"
|
|
[[ "$output" == *"Updated the pre-push hook"* ]]
|
|
}
|
|
|
|
@test "update doesn't touch someone else's pre-push hook" {
|
|
make_working_copy
|
|
printf '%s\n' '#!/bin/bash' 'mine' > "$WC/.git/hooks/pre-push"
|
|
|
|
run bash "$PROJECT/update.sh" < /dev/null
|
|
[ "$status" -eq 0 ]
|
|
[ "$(tail -n 1 "$WC/.git/hooks/pre-push")" = mine ]
|
|
}
|