mirror of
https://github.com/virt-manager/virt-manager.git
synced 2024-12-23 17:34:21 +03:00
tests: xmlparse: Add qemu xmlns tests
Since reproducing via manual clitest is hard since it requires XML on stdin
This commit is contained in:
parent
2bea4ecbf6
commit
bc94666778
21
tests/xmlparse-xml/change-xmlns-qemu-in.xml
Normal file
21
tests/xmlparse-xml/change-xmlns-qemu-in.xml
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
<domain type='test' xmlns:qemu="http://libvirt.org/schemas/domain/qemu/1.0">
|
||||||
|
<name>test-xmlns</name>
|
||||||
|
<memory unit='KiB'>8388608</memory>
|
||||||
|
<currentMemory unit='KiB'>2097152</currentMemory>
|
||||||
|
<vcpu placement='static'>2</vcpu>
|
||||||
|
<os>
|
||||||
|
<type arch='i686'>hvm</type>
|
||||||
|
<boot dev='hd'/>
|
||||||
|
</os>
|
||||||
|
<clock offset='utc'/>
|
||||||
|
<on_poweroff>destroy</on_poweroff>
|
||||||
|
<on_reboot>restart</on_reboot>
|
||||||
|
<on_crash>destroy</on_crash>
|
||||||
|
<devices>
|
||||||
|
</devices>
|
||||||
|
<qemu:commandline>
|
||||||
|
<qemu:env name="SOMEENV" value="foo=bar baz,foo"/>
|
||||||
|
<qemu:arg value="-somearg"/>
|
||||||
|
<qemu:arg value="bar,baz=wib wob"/>
|
||||||
|
</qemu:commandline>
|
||||||
|
</domain>
|
22
tests/xmlparse-xml/change-xmlns-qemu-out.xml
Normal file
22
tests/xmlparse-xml/change-xmlns-qemu-out.xml
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
<domain xmlns:qemu="http://libvirt.org/schemas/domain/qemu/1.0" type="test">
|
||||||
|
<name>test-xmlns</name>
|
||||||
|
<memory unit="KiB">8388608</memory>
|
||||||
|
<currentMemory unit="KiB">2097152</currentMemory>
|
||||||
|
<vcpu placement="static">2</vcpu>
|
||||||
|
<os>
|
||||||
|
<type arch="i686">hvm</type>
|
||||||
|
<boot dev="hd"/>
|
||||||
|
</os>
|
||||||
|
<clock offset="utc"/>
|
||||||
|
<on_poweroff>destroy</on_poweroff>
|
||||||
|
<on_reboot>restart</on_reboot>
|
||||||
|
<on_crash>destroy</on_crash>
|
||||||
|
<devices>
|
||||||
|
</devices>
|
||||||
|
<qemu:commandline>
|
||||||
|
<qemu:env name="SOMEENV" value="foo=bar baz,foo"/>
|
||||||
|
<qemu:arg value="testval"/>
|
||||||
|
<qemu:arg value="additional-arg"/>
|
||||||
|
<qemu:env name="DISPLAY" value="1:2"/>
|
||||||
|
</qemu:commandline>
|
||||||
|
</domain>
|
@ -960,6 +960,28 @@ class XMLParseTest(unittest.TestCase):
|
|||||||
check("iobase", "0x505", None, "0x506")
|
check("iobase", "0x505", None, "0x506")
|
||||||
self._alter_compare(guest.get_xml_config(), outfile)
|
self._alter_compare(guest.get_xml_config(), outfile)
|
||||||
|
|
||||||
|
def testQEMUXMLNS(self):
|
||||||
|
basename = "change-xmlns-qemu"
|
||||||
|
infile = "tests/xmlparse-xml/%s-in.xml" % basename
|
||||||
|
outfile = "tests/xmlparse-xml/%s-out.xml" % basename
|
||||||
|
guest = virtinst.Guest(kvmconn, parsexml=open(infile).read())
|
||||||
|
|
||||||
|
check = self._make_checker(guest.xmlns_qemu.args[0])
|
||||||
|
check("value", "-somearg", "-somenewarg")
|
||||||
|
check = self._make_checker(guest.xmlns_qemu.args[1])
|
||||||
|
check("value", "bar,baz=wib wob", "testval")
|
||||||
|
guest.xmlns_qemu.args.add_new().value = "additional-arg"
|
||||||
|
guest.xmlns_qemu.remove_child(guest.xmlns_qemu.args[0])
|
||||||
|
|
||||||
|
check = self._make_checker(guest.xmlns_qemu.envs[0])
|
||||||
|
check("name", "SOMEENV")
|
||||||
|
check("value", "foo=bar baz,foo")
|
||||||
|
env = guest.xmlns_qemu.envs.add_new()
|
||||||
|
env.name = "DISPLAY"
|
||||||
|
env.value = "1:2"
|
||||||
|
|
||||||
|
self._alter_compare(guest.get_xml_config(), outfile)
|
||||||
|
|
||||||
def testAddRemoveDevices(self):
|
def testAddRemoveDevices(self):
|
||||||
guest, outfile = self._get_test_content("add-devices")
|
guest, outfile = self._get_test_content("add-devices")
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user