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>
This commit is contained in:
2026-11-04 20:13:13 -07:00
co-authored by Claude Opus 5.5
parent 2207208326
commit 9e4b78bb88
9 changed files with 6 additions and 46 deletions
-6
View File
@@ -62,12 +62,6 @@ in_flatpak() {
[ -f /.flatpak-info ] || [ -n "${FLATPAK_ID:-}" ] [ -f /.flatpak-info ] || [ -n "${FLATPAK_ID:-}" ]
} }
# Whether QEMU has the display the smoketest's VMs start with (-vga virtio).
# Arch packages it apart from qemu-base, as qemu-hw-display-virtio-vga.
qemu_has_virtio_vga() {
[[ "$(qemu-system-x86_64 -device help 2> /dev/null)" == *'name "virtio-vga"'* ]]
}
# This project's folder # This project's folder
sibling_dir() { sibling_dir() {
cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd
-9
View File
@@ -50,15 +50,6 @@ cmd_doctor() {
problem "not installed: ${missing[*]}" "fix: bash $(sibling_dir)/update.sh" problem "not installed: ${missing[*]}" "fix: bash $(sibling_dir)/update.sh"
fi fi
if command -v qemu-system-x86_64 &> /dev/null; then
if qemu_has_virtio_vga; then
ok "QEMU has the virtio-vga display the smoketest's VMs use"
else
problem "QEMU has no virtio-vga display, so the smoketest's VMs won't start" \
"fix: bash $(sibling_dir)/update.sh"
fi
fi
if [ -r /dev/kvm ] && [ -w /dev/kvm ]; then if [ -r /dev/kvm ] && [ -w /dev/kvm ]; then
ok "KVM is available for the smoketest's virtual machines" ok "KVM is available for the smoketest's virtual machines"
else else
-2
View File
@@ -56,8 +56,6 @@ require_vm_tools() {
command -v "$tool" &> /dev/null \ command -v "$tool" &> /dev/null \
|| die "$tool isn't installed. Install coredesktop-dev's packages: bash $(sibling_dir)/update.sh" || die "$tool isn't installed. Install coredesktop-dev's packages: bash $(sibling_dir)/update.sh"
done done
qemu_has_virtio_vga \
|| die "QEMU has no virtio-vga display. Install coredesktop-dev's packages: bash $(sibling_dir)/update.sh"
[ -r "$KVM_DEVICE" ] && [ -w "$KVM_DEVICE" ] \ [ -r "$KVM_DEVICE" ] && [ -w "$KVM_DEVICE" ] \
|| die "Can't use $KVM_DEVICE. Turn on virtualization (VT-x/AMD-V) in the firmware settings." || die "Can't use $KVM_DEVICE. Turn on virtualization (VT-x/AMD-V) in the firmware settings."
} }
+1 -1
View File
@@ -76,7 +76,7 @@ vm_start() {
-drive "file=$disk,if=virtio,format=qcow2,discard=unmap" \ -drive "file=$disk,if=virtio,format=qcow2,discard=unmap" \
-nic "user,model=virtio-net-pci,hostfwd=tcp:127.0.0.1:$VM_PORT-:22" \ -nic "user,model=virtio-net-pci,hostfwd=tcp:127.0.0.1:$VM_PORT-:22" \
-virtfs "local,path=$PKG_CACHE,mount_tag=pkgcache,security_model=mapped-xattr" \ -virtfs "local,path=$PKG_CACHE,mount_tag=pkgcache,security_model=mapped-xattr" \
-vga virtio \ -vga std \
"${display[@]}" \ "${display[@]}" \
-serial "file:$VM_DIR/serial.log" \ -serial "file:$VM_DIR/serial.log" \
-pidfile "$VM_DIR/qemu.pid" \ -pidfile "$VM_DIR/qemu.pid" \
-12
View File
@@ -71,15 +71,3 @@ load test_helper
[[ "$output" == *"Usage: coredesktop-dev doctor"* ]] [[ "$output" == *"Usage: coredesktop-dev doctor"* ]]
not_called flatpak-spawn not_called flatpak-spawn
} }
@test "doctor reports QEMU without the virtio-vga display" {
make_working_copy
stub qemu-system-x86_64 'echo "name \"VGA\", bus PCI"'
run cdd doctor
[ "$status" -eq 1 ]
[[ "$output" == *"PROBLEM QEMU has no virtio-vga display"* ]]
stub qemu-system-x86_64 'echo "name \"virtio-vga\", bus PCI"'
run cdd doctor
[[ "$output" == *"ok QEMU has the virtio-vga display"* ]]
}
+1 -1
View File
@@ -14,7 +14,7 @@ config() {
[[ "$output" == *"is the deployed copy"* ]] [[ "$output" == *"is the deployed copy"* ]]
[ "$(config)" = "WORKING_COPY=$(printf '%q' "$WC")" ] [ "$(config)" = "WORKING_COPY=$(printf '%q' "$WC")" ]
[ "$(readlink "$HOME/.local/bin/coredesktop-dev")" = "$PROJECT/bin/coredesktop-dev" ] [ "$(readlink "$HOME/.local/bin/coredesktop-dev")" = "$PROJECT/bin/coredesktop-dev" ]
called install_packages shellcheck bats tea qemu-base qemu-hw-display-virtio-vga libisoburn called install_packages shellcheck bats tea qemu-base libisoburn
} }
@test "install refuses the deployed copy however it's spelled" { @test "install refuses the deployed copy however it's spelled" {
+3 -13
View File
@@ -18,8 +18,7 @@ setup() {
git -C "$WC" rev-parse HEAD > "$STATE/images/installed.ref" git -C "$WC" rev-parse HEAD > "$STATE/images/installed.ref"
# A VM is a sleep that lets go of bats' output pipes # A VM is a sleep that lets go of bats' output pipes
stub qemu-system-x86_64 '[ "$*" = "-device help" ] && { echo "name \"virtio-vga\", bus PCI"; exit; } stub qemu-system-x86_64 'while [ $# -gt 0 ]; do [ "$1" = -pidfile ] && pidfile="$2"; shift; done
while [ $# -gt 0 ]; do [ "$1" = -pidfile ] && pidfile="$2"; shift; done
/usr/bin/sleep 300 > /dev/null 2>&1 3>&- & /usr/bin/sleep 300 > /dev/null 2>&1 3>&- &
echo $! > "$pidfile"' echo $! > "$pidfile"'
stub qemu-img 'touch "${@: -1}"' stub qemu-img 'touch "${@: -1}"'
@@ -99,16 +98,7 @@ last_run() {
run cdd smoketest run 10 nosuch run cdd smoketest run 10 nosuch
[ "$status" -eq 1 ] [ "$status" -eq 1 ]
[[ "$output" == *"No scenario called nosuch"* ]] [[ "$output" == *"No scenario called nosuch"* ]]
# Only the check for the virtio-vga display, no VM not_called qemu-system-x86_64
[ -z "$(grep '^qemu-system-x86_64 ' "$STUB_LOG" | grep -v -- '-device help')" ]
}
@test "run stops before any VM when QEMU has no virtio-vga display" {
stub qemu-system-x86_64 'echo "name \"VGA\", bus PCI"'
run cdd smoketest run 10
[ "$status" -eq 1 ]
[[ "$output" == *"QEMU has no virtio-vga display"* ]]
[ "$(grep -c '^qemu-system-x86_64 ' "$STUB_LOG")" -eq 1 ]
} }
@test "each variant runs in its own VM" { @test "each variant runs in its own VM" {
@@ -116,7 +106,7 @@ last_run() {
[ "$status" -eq 0 ] [ "$status" -eq 0 ]
[[ "$output" == *"PASS 30-variants @ one"* ]] [[ "$output" == *"PASS 30-variants @ one"* ]]
[[ "$output" == *"PASS 30-variants @ two"* ]] [[ "$output" == *"PASS 30-variants @ two"* ]]
[ "$(grep '^qemu-system-x86_64 ' "$STUB_LOG" | grep -vc -- '-device help')" -eq 2 ] [ "$(grep -c '^qemu-system-x86_64 ' "$STUB_LOG")" -eq 2 ]
grep -q "variant two" "$(last_run)/30-variants@two/scenario.log" grep -q "variant two" "$(last_run)/30-variants@two/scenario.log"
} }
+1 -1
View File
@@ -7,7 +7,7 @@ HOOK_MARKER="# Installed by coredesktop-dev; remove with: coredesktop-dev hooks
@test "update installs the packages and links the command, without asking anything" { @test "update installs the packages and links the command, without asking anything" {
run bash "$PROJECT/update.sh" < /dev/null run bash "$PROJECT/update.sh" < /dev/null
[ "$status" -eq 0 ] [ "$status" -eq 0 ]
called install_packages shellcheck bats tea qemu-base qemu-hw-display-virtio-vga libisoburn called install_packages shellcheck bats tea qemu-base libisoburn
[ "$(readlink "$HOME/.local/bin/coredesktop-dev")" = "$PROJECT/bin/coredesktop-dev" ] [ "$(readlink "$HOME/.local/bin/coredesktop-dev")" = "$PROJECT/bin/coredesktop-dev" ]
} }
-1
View File
@@ -16,7 +16,6 @@ PACKAGES=(
bats # make test bats # make test
tea # Gitea's CLI, for pull requests tea # Gitea's CLI, for pull requests
qemu-base # the smoketest's virtual machines qemu-base # the smoketest's virtual machines
qemu-hw-display-virtio-vga # the VM's -vga virtio (qemu-base leaves it out)
libisoburn # xorriso, for the smoketest VM's cloud-init disk libisoburn # xorriso, for the smoketest VM's cloud-init disk
) )