Fix error return value for no-vga-pic-allocation
[qemu-test.git] / tests / no-vga-pci-allocation.sh
1 #!/bin/sh
2
3 # This test case reproduces an issue discovered in libguestfs that happened due
4 # to a PCI allocation bug in SeaBIOS.
5 #
6 # It only reproduced with libguestfs because libguestfs uses -nodefaults which
7 # prevents a VGA device from being initialized. It also required the presence
8 # of at least a few PCI devices.
9 #
10 # See http://mid.gmane.org/20110930131148.GA4294@amd.home.annexia.org
11
12 in_host() {
13 tmpdisk=$tmpdir/disk-$$.img
14 tmpsock=$tmpdir/channel-$$.sock
15
16 qemu-img create -f qcow2 $tmpdisk 10G
17
18 qemu -drive file=$tmpdisk,if=none,snapshot=on,id=hd0 \
19 -device virtio-balloon-pci,addr=03.0 \
20 -device virtio-blk-pci,addr=04.0,drive=hd0 \
21 -nographic -nodefconfig -m 1G -no-reboot -no-hpet \
22 -device virtio-serial \
23 -chardev socket,path=$tmpsock,id=channel0,server,nowait \
24 -device virtserialport,chardev=channel0,name=org.libguestfs.channel.0 \
25 -nodefaults -serial stdio -enable-kvm
26 rc=$?
27
28 rm -f $tmpdisk $tmpsock
29
30 return $rc
31 }
32
33 in_guest() {
34 :
35 }
36
37 if test $QEMU_TEST; then
38 in_host
39 else
40 in_guest
41 fi