mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-22 05:35:25 +00:00
qemuxmlconftest: Adapt XMLs from 'virsh-cpuset' and 'virsh-define-dev-segfault' cases
Rather than using 'virsh define' for the tests use the XML (or idea what the XML is testing) and use them as 'qemuxmlconftest' cases. Signed-off-by: Peter Krempa <pkrempa@redhat.com> Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
parent
c96ac614a8
commit
630b229bc9
@ -692,8 +692,6 @@ if conf.has('WITH_LIBVIRTD')
|
|||||||
'libvirtd-pool',
|
'libvirtd-pool',
|
||||||
'virsh-auth',
|
'virsh-auth',
|
||||||
'virsh-checkpoint',
|
'virsh-checkpoint',
|
||||||
'virsh-cpuset',
|
|
||||||
'virsh-define-dev-segfault',
|
|
||||||
'virsh-int-overflow',
|
'virsh-int-overflow',
|
||||||
'virsh-read-bufsiz',
|
'virsh-read-bufsiz',
|
||||||
'virsh-read-non-seekable',
|
'virsh-read-non-seekable',
|
||||||
|
@ -0,0 +1,46 @@
|
|||||||
|
LC_ALL=C \
|
||||||
|
PATH=/bin \
|
||||||
|
HOME=/var/lib/libvirt/qemu/domain--1-D \
|
||||||
|
USER=test \
|
||||||
|
LOGNAME=test \
|
||||||
|
XDG_DATA_HOME=/var/lib/libvirt/qemu/domain--1-D/.local/share \
|
||||||
|
XDG_CACHE_HOME=/var/lib/libvirt/qemu/domain--1-D/.cache \
|
||||||
|
XDG_CONFIG_HOME=/var/lib/libvirt/qemu/domain--1-D/.config \
|
||||||
|
/usr/bin/qemu-system-x86_64 \
|
||||||
|
-name guest=D,debug-threads=on \
|
||||||
|
-S \
|
||||||
|
-object '{"qom-type":"secret","id":"masterKey0","format":"raw","file":"/var/lib/libvirt/qemu/domain--1-D/master-key.aes"}' \
|
||||||
|
-machine pc,usb=off,dump-guest-core=off,memory-backend=pc.ram,pcspk-audiodev=audio1,acpi=on \
|
||||||
|
-accel kvm \
|
||||||
|
-cpu qemu64 \
|
||||||
|
-m size=262144k \
|
||||||
|
-object '{"qom-type":"memory-backend-ram","id":"pc.ram","size":268435456}' \
|
||||||
|
-overcommit mem-lock=off \
|
||||||
|
-smp 1,sockets=1,cores=1,threads=1 \
|
||||||
|
-uuid aaa3ae22-fed2-bfbd-ac02-3bea3bcfad82 \
|
||||||
|
-display none \
|
||||||
|
-no-user-config \
|
||||||
|
-nodefaults \
|
||||||
|
-chardev socket,id=charmonitor,fd=1729,server=on,wait=off \
|
||||||
|
-mon chardev=charmonitor,id=monitor,mode=control \
|
||||||
|
-rtc base=utc \
|
||||||
|
-no-shutdown \
|
||||||
|
-boot strict=on \
|
||||||
|
-device '{"driver":"piix3-usb-uhci","id":"usb","bus":"pci.0","addr":"0x1.0x2"}' \
|
||||||
|
-chardev pty,id=charserial0 \
|
||||||
|
-device '{"driver":"isa-serial","chardev":"charserial0","id":"serial0","index":0}' \
|
||||||
|
-chardev pty,id=charserial1 \
|
||||||
|
-device '{"driver":"isa-serial","chardev":"charserial1","id":"serial1","index":1}' \
|
||||||
|
-chardev pty,id=charserial2 \
|
||||||
|
-device '{"driver":"isa-serial","chardev":"charserial2","id":"serial2","index":2}' \
|
||||||
|
-chardev pty,id=charparallel0 \
|
||||||
|
-device '{"driver":"isa-parallel","chardev":"charparallel0","id":"parallel0"}' \
|
||||||
|
-chardev pty,id=charparallel1 \
|
||||||
|
-device '{"driver":"isa-parallel","chardev":"charparallel1","id":"parallel1"}' \
|
||||||
|
-chardev pty,id=charparallel2 \
|
||||||
|
-device '{"driver":"isa-parallel","chardev":"charparallel2","id":"parallel2"}' \
|
||||||
|
-audiodev '{"id":"audio1","driver":"none"}' \
|
||||||
|
-device '{"driver":"ES1370","id":"sound1","audiodev":"audio1","bus":"pci.0","addr":"0x2"}' \
|
||||||
|
-device '{"driver":"virtio-balloon-pci","id":"balloon0","bus":"pci.0","addr":"0x3"}' \
|
||||||
|
-sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,resourcecontrol=deny \
|
||||||
|
-msg timestamp=on
|
65
tests/qemuxmlconfdata/console-compat-crash.x86_64-latest.xml
Normal file
65
tests/qemuxmlconfdata/console-compat-crash.x86_64-latest.xml
Normal file
@ -0,0 +1,65 @@
|
|||||||
|
<domain type='kvm'>
|
||||||
|
<name>D</name>
|
||||||
|
<uuid>aaa3ae22-fed2-bfbd-ac02-3bea3bcfad82</uuid>
|
||||||
|
<memory unit='KiB'>262144</memory>
|
||||||
|
<currentMemory unit='KiB'>262144</currentMemory>
|
||||||
|
<vcpu placement='static'>1</vcpu>
|
||||||
|
<os>
|
||||||
|
<type arch='x86_64' machine='pc'>hvm</type>
|
||||||
|
<boot dev='cdrom'/>
|
||||||
|
</os>
|
||||||
|
<features>
|
||||||
|
<acpi/>
|
||||||
|
</features>
|
||||||
|
<cpu mode='custom' match='exact' check='none'>
|
||||||
|
<model fallback='forbid'>qemu64</model>
|
||||||
|
</cpu>
|
||||||
|
<clock offset='utc'/>
|
||||||
|
<on_poweroff>destroy</on_poweroff>
|
||||||
|
<on_reboot>restart</on_reboot>
|
||||||
|
<on_crash>destroy</on_crash>
|
||||||
|
<devices>
|
||||||
|
<emulator>/usr/bin/qemu-system-x86_64</emulator>
|
||||||
|
<controller type='usb' index='0' model='piix3-uhci'>
|
||||||
|
<address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/>
|
||||||
|
</controller>
|
||||||
|
<controller type='pci' index='0' model='pci-root'/>
|
||||||
|
<serial type='pty'>
|
||||||
|
<target type='isa-serial' port='0'>
|
||||||
|
<model name='isa-serial'/>
|
||||||
|
</target>
|
||||||
|
</serial>
|
||||||
|
<serial type='pty'>
|
||||||
|
<target type='isa-serial' port='1'>
|
||||||
|
<model name='isa-serial'/>
|
||||||
|
</target>
|
||||||
|
</serial>
|
||||||
|
<serial type='pty'>
|
||||||
|
<target type='isa-serial' port='2'>
|
||||||
|
<model name='isa-serial'/>
|
||||||
|
</target>
|
||||||
|
</serial>
|
||||||
|
<parallel type='pty'>
|
||||||
|
<target port='0'/>
|
||||||
|
</parallel>
|
||||||
|
<parallel type='pty'>
|
||||||
|
<target port='1'/>
|
||||||
|
</parallel>
|
||||||
|
<parallel type='pty'>
|
||||||
|
<target port='2'/>
|
||||||
|
</parallel>
|
||||||
|
<console type='pty'>
|
||||||
|
<target type='serial' port='0'/>
|
||||||
|
</console>
|
||||||
|
<input type='mouse' bus='ps2'/>
|
||||||
|
<input type='keyboard' bus='ps2'/>
|
||||||
|
<sound model='pcspk'/>
|
||||||
|
<sound model='es1370'>
|
||||||
|
<address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
|
||||||
|
</sound>
|
||||||
|
<audio id='1' type='none'/>
|
||||||
|
<memballoon model='virtio'>
|
||||||
|
<address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
|
||||||
|
</memballoon>
|
||||||
|
</devices>
|
||||||
|
</domain>
|
36
tests/virsh-define-dev-segfault → tests/qemuxmlconfdata/console-compat-crash.xml
Executable file → Normal file
36
tests/virsh-define-dev-segfault → tests/qemuxmlconfdata/console-compat-crash.xml
Executable file → Normal file
@ -1,26 +1,11 @@
|
|||||||
#!/bin/sh
|
<domain type='kvm'>
|
||||||
# Exercise a bug whereby defining a valid domain could kill libvirtd.
|
|
||||||
# The bug can also be exercised with a simple define/dumpxml pair to virsh.
|
|
||||||
|
|
||||||
. "$(dirname $0)/test-lib.sh"
|
|
||||||
|
|
||||||
if test "$VERBOSE" = yes; then
|
|
||||||
set -x
|
|
||||||
$abs_top_builddir/tools/virsh --version
|
|
||||||
fi
|
|
||||||
|
|
||||||
fail=0
|
|
||||||
|
|
||||||
# Domain definition from Cole Robinson.
|
|
||||||
cat <<\EOF > D.xml || fail=1
|
|
||||||
<domain type='test'>
|
|
||||||
<name>D</name>
|
<name>D</name>
|
||||||
<uuid>aaa3ae22-fed2-bfbd-ac02-3bea3bcfad82</uuid>
|
<uuid>aaa3ae22-fed2-bfbd-ac02-3bea3bcfad82</uuid>
|
||||||
<memory unit='KiB'>262144</memory>
|
<memory unit='KiB'>262144</memory>
|
||||||
<currentMemory unit='KiB'>262144</currentMemory>
|
<currentMemory unit='KiB'>262144</currentMemory>
|
||||||
<vcpu placement='static'>1</vcpu>
|
<vcpu placement='static'>1</vcpu>
|
||||||
<os>
|
<os>
|
||||||
<type arch='i686' machine='pc'>hvm</type>
|
<type arch='x86_64' machine='pc'>hvm</type>
|
||||||
<boot dev='cdrom'/>
|
<boot dev='cdrom'/>
|
||||||
</os>
|
</os>
|
||||||
<features>
|
<features>
|
||||||
@ -31,7 +16,7 @@ cat <<\EOF > D.xml || fail=1
|
|||||||
<on_reboot>restart</on_reboot>
|
<on_reboot>restart</on_reboot>
|
||||||
<on_crash>destroy</on_crash>
|
<on_crash>destroy</on_crash>
|
||||||
<devices>
|
<devices>
|
||||||
<emulator>/usr/bin/qemu-system-i386</emulator>
|
<emulator>/usr/bin/qemu-system-x86_64</emulator>
|
||||||
<controller type='usb' index='0'/>
|
<controller type='usb' index='0'/>
|
||||||
<serial type='pty'>
|
<serial type='pty'>
|
||||||
<target port='0'/>
|
<target port='0'/>
|
||||||
@ -59,18 +44,3 @@ cat <<\EOF > D.xml || fail=1
|
|||||||
<memballoon model='virtio'/>
|
<memballoon model='virtio'/>
|
||||||
</devices>
|
</devices>
|
||||||
</domain>
|
</domain>
|
||||||
EOF
|
|
||||||
|
|
||||||
url=test:///default
|
|
||||||
$abs_top_builddir/tools/virsh --connect "$url" 'define D.xml; dumpxml D' > out 2>&1 || fail=1
|
|
||||||
|
|
||||||
cat > exp <<EOF || fail=1
|
|
||||||
Domain 'D' defined from D.xml
|
|
||||||
|
|
||||||
$(cat D.xml)
|
|
||||||
|
|
||||||
EOF
|
|
||||||
|
|
||||||
compare exp out || fail=1
|
|
||||||
|
|
||||||
exit $fail
|
|
1
tests/qemuxmlconfdata/cpuset-invalid.x86_64-latest.err
Normal file
1
tests/qemuxmlconfdata/cpuset-invalid.x86_64-latest.err
Normal file
@ -0,0 +1 @@
|
|||||||
|
invalid argument: Failed to parse bitmap 'aaa'
|
12
tests/qemuxmlconfdata/cpuset-invalid.xml
Normal file
12
tests/qemuxmlconfdata/cpuset-invalid.xml
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
<domain type='qemu'>
|
||||||
|
<name>QEMUGuest1</name>
|
||||||
|
<uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
|
||||||
|
<memory unit='KiB'>219136</memory>
|
||||||
|
<vcpu cpuset='aaa'>2</vcpu>
|
||||||
|
<os>
|
||||||
|
<type arch='x86_64' machine='pc'>hvm</type>
|
||||||
|
</os>
|
||||||
|
<devices>
|
||||||
|
<emulator>/usr/bin/qemu-system-x86_64</emulator>
|
||||||
|
</devices>
|
||||||
|
</domain>
|
@ -1799,6 +1799,7 @@ mymain(void)
|
|||||||
|
|
||||||
DO_TEST_CAPS_LATEST("console-compat");
|
DO_TEST_CAPS_LATEST("console-compat");
|
||||||
DO_TEST_CAPS_LATEST("console-compat-auto");
|
DO_TEST_CAPS_LATEST("console-compat-auto");
|
||||||
|
DO_TEST_CAPS_LATEST("console-compat-crash");
|
||||||
|
|
||||||
DO_TEST_CAPS_LATEST("serial-vc-chardev");
|
DO_TEST_CAPS_LATEST("serial-vc-chardev");
|
||||||
DO_TEST_CAPS_LATEST("serial-pty-chardev");
|
DO_TEST_CAPS_LATEST("serial-pty-chardev");
|
||||||
@ -2287,6 +2288,7 @@ mymain(void)
|
|||||||
DO_TEST_CAPS_LATEST("cputune-numatune");
|
DO_TEST_CAPS_LATEST("cputune-numatune");
|
||||||
DO_TEST_CAPS_LATEST("vcpu-placement-static");
|
DO_TEST_CAPS_LATEST("vcpu-placement-static");
|
||||||
DO_TEST_CAPS_LATEST("cputune-cpuset-big-id");
|
DO_TEST_CAPS_LATEST("cputune-cpuset-big-id");
|
||||||
|
DO_TEST_CAPS_LATEST_PARSE_ERROR("cpuset-invalid");
|
||||||
|
|
||||||
DO_TEST_CAPS_LATEST_PARSE_ERROR("numatune-memory-invalid-nodeset");
|
DO_TEST_CAPS_LATEST_PARSE_ERROR("numatune-memory-invalid-nodeset");
|
||||||
DO_TEST_CAPS_VER("numatune-memnode", "5.2.0");
|
DO_TEST_CAPS_VER("numatune-memnode", "5.2.0");
|
||||||
|
@ -1,46 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
# ensure that defining with an invalid vCPU cpuset elicits a diagnostic
|
|
||||||
|
|
||||||
# Copyright (C) 2008-2009 Red Hat, Inc.
|
|
||||||
|
|
||||||
# This program is free software: you can redistribute it and/or modify
|
|
||||||
# it under the terms of the GNU General Public License as published by
|
|
||||||
# the Free Software Foundation, either version 2 of the License, or
|
|
||||||
# (at your option) any later version.
|
|
||||||
|
|
||||||
# This program is distributed in the hope that it will be useful,
|
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
# GNU General Public License for more details.
|
|
||||||
|
|
||||||
# You should have received a copy of the GNU General Public License
|
|
||||||
# along with this program. If not, see
|
|
||||||
# <http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
. "$(dirname $0)/test-lib.sh"
|
|
||||||
|
|
||||||
if test "$VERBOSE" = yes; then
|
|
||||||
set -x
|
|
||||||
$abs_top_builddir/tools/virsh --version
|
|
||||||
fi
|
|
||||||
|
|
||||||
fail=0
|
|
||||||
|
|
||||||
# generate input
|
|
||||||
$abs_top_builddir/tools/virsh --connect test:///default dumpxml 1 > xml || fail=1
|
|
||||||
|
|
||||||
# require the presence of the string we'll transform
|
|
||||||
grep '<vcpu placement' xml > /dev/null || fail=1
|
|
||||||
|
|
||||||
sed "s/vcpu placement='static'>/vcpu cpuset='aaa'>/" xml > xml-invalid || fail=1
|
|
||||||
|
|
||||||
# Require failure and a diagnostic.
|
|
||||||
$abs_top_builddir/tools/virsh --connect test:///default define xml-invalid > out 2>&1 && fail=1
|
|
||||||
cat <<\EOF > exp || fail=1
|
|
||||||
error: Failed to define domain from xml-invalid
|
|
||||||
error: invalid argument: Failed to parse bitmap 'aaa'
|
|
||||||
|
|
||||||
EOF
|
|
||||||
compare exp out || fail=1
|
|
||||||
|
|
||||||
(exit $fail); exit $fail
|
|
Loading…
Reference in New Issue
Block a user