[virt-tools-list] [PATCH v2 virt-manager 4/4] test: add test cases for panic notifier device

Chen Hanxiao chenhanxiao at cn.fujitsu.com
Fri Jan 10 09:37:57 UTC 2014


From: Chen Hanxiao <chenhanxiao at cn.fujitsu.com>

Signed-off-by: Chen Hanxiao <chenhanxiao at cn.fujitsu.com>
---
 tests/testdriver.xml                           |  5 +++
 tests/xmlconfig-xml/boot-many-devices.xml      |  3 ++
 tests/xmlconfig.py                             |  5 +++
 tests/xmlparse-xml/change-panic-device-in.xml  | 62 ++++++++++++++++++++++++++
 tests/xmlparse-xml/change-panic-device-out.xml | 62 ++++++++++++++++++++++++++
 tests/xmlparse.py                              | 10 +++++
 6 files changed, 147 insertions(+)
 create mode 100644 tests/xmlparse-xml/change-panic-device-in.xml
 create mode 100644 tests/xmlparse-xml/change-panic-device-out.xml

diff --git a/tests/testdriver.xml b/tests/testdriver.xml
index 49fa6ef..d9e9910 100644
--- a/tests/testdriver.xml
+++ b/tests/testdriver.xml
@@ -344,6 +344,11 @@
         <source mode='connect' host='1.2.3.4' service='1234'/>
       </backend>
     </rng>
+
+    <!-- panic notifier devices -->
+    <panic>
+      <address type='isa' iobase='0x505'/>
+    </panic>
   </devices>
 </domain>
 
diff --git a/tests/xmlconfig-xml/boot-many-devices.xml b/tests/xmlconfig-xml/boot-many-devices.xml
index 1db17a5..0f01212 100644
--- a/tests/xmlconfig-xml/boot-many-devices.xml
+++ b/tests/xmlconfig-xml/boot-many-devices.xml
@@ -101,6 +101,9 @@
       <source host="foobar.com" service="1234"/>
     </redirdev>
     <memballoon model="virtio"/>
+    <panic>
+      <address type="isa" iobase="0x505"/>
+    </panic>
   </devices>
   <seclabel type="static" model="selinux">
     <label>foolabel</label>
diff --git a/tests/xmlconfig.py b/tests/xmlconfig.py
index 2677b08..98ac0c6 100644
--- a/tests/xmlconfig.py
+++ b/tests/xmlconfig.py
@@ -30,6 +30,7 @@ from virtinst import VirtualVideoDevice
 from virtinst import VirtualController
 from virtinst import VirtualWatchdog
 from virtinst import VirtualMemballoon
+from virtinst import VirtualPanicDevice
 
 from tests import utils
 
@@ -875,6 +876,10 @@ class TestXMLConfig(unittest.TestCase):
         g.add_device(redir1)
         g.add_device(redir2)
 
+        #Panic Notifier device
+        pdev = VirtualPanicDevice(g.conn)
+        g.add_device(pdev)
+
         self._compare(g, "boot-many-devices", False)
 
     def testCpuset(self):
diff --git a/tests/xmlparse-xml/change-panic-device-in.xml b/tests/xmlparse-xml/change-panic-device-in.xml
new file mode 100644
index 0000000..052723a
--- /dev/null
+++ b/tests/xmlparse-xml/change-panic-device-in.xml
@@ -0,0 +1,62 @@
+<domain type='kvm'>
+  <name>Ftest</name>
+  <uuid>9d544d2e-e001-a6b2-4aa7-7768796353ea</uuid>
+  <memory unit='KiB'>1048576</memory>
+  <currentMemory unit='KiB'>1048576</currentMemory>
+  <vcpu placement='static'>1</vcpu>
+  <os>
+    <type arch='i686' machine='pc-i440fx-1.4'>hvm</type>
+    <boot dev='hd'/>
+  </os>
+  <features>
+    <acpi/>
+    <apic/>
+    <pae/>
+  </features>
+  <clock offset='utc'/>
+  <on_poweroff>destroy</on_poweroff>
+  <on_reboot>restart</on_reboot>
+  <on_crash>restart</on_crash>
+  <devices>
+    <emulator>/usr/local/bin/qemu-system-x86_64</emulator>
+    <disk type='file' device='disk'>
+      <driver name='qemu' type='raw'/>
+      <source file='/home/IMG/F19_test.img'/>
+      <target dev='hda' bus='ide'/>
+    </disk>
+    <controller type='usb' index='0'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/>
+    </controller>
+    <controller type='pci' index='0' model='pci-root'/>
+    <controller type='ide' index='0'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/>
+    </controller>
+    <controller type='virtio-serial' index='0'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
+    </controller>
+    <interface type='network'>
+      <mac address='52:54:00:93:45:ce'/>
+      <source network='default'/>
+      <model type='rtl8139'/>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
+    </interface>
+    <serial type='pty'>
+      <target port='0'/>
+    </serial>
+    <console type='pty'>
+      <target type='serial' port='0'/>
+    </console>
+    <input type='mouse' bus='ps2'/>
+    <graphics type='vnc' port='-1' autoport='yes'/>
+    <video>
+      <model type='vga' vram='9216' heads='1'/>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
+    </video>
+    <memballoon model='virtio'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x0'/>
+    </memballoon>
+    <panic>
+      <address type='isa' iobase='0x505'/>
+    </panic>
+  </devices>
+</domain>
diff --git a/tests/xmlparse-xml/change-panic-device-out.xml b/tests/xmlparse-xml/change-panic-device-out.xml
new file mode 100644
index 0000000..7aa732c
--- /dev/null
+++ b/tests/xmlparse-xml/change-panic-device-out.xml
@@ -0,0 +1,62 @@
+<domain type="kvm">
+  <name>Ftest</name>
+  <uuid>9d544d2e-e001-a6b2-4aa7-7768796353ea</uuid>
+  <memory unit="KiB">1048576</memory>
+  <currentMemory unit="KiB">1048576</currentMemory>
+  <vcpu placement="static">1</vcpu>
+  <os>
+    <type arch="i686" machine="pc-i440fx-1.4">hvm</type>
+    <boot dev="hd"/>
+  </os>
+  <features>
+    <acpi/>
+    <apic/>
+    <pae/>
+  </features>
+  <clock offset="utc"/>
+  <on_poweroff>destroy</on_poweroff>
+  <on_reboot>restart</on_reboot>
+  <on_crash>restart</on_crash>
+  <devices>
+    <emulator>/usr/local/bin/qemu-system-x86_64</emulator>
+    <disk type="file" device="disk">
+      <driver name="qemu" type="raw"/>
+      <source file="/home/IMG/F19_test.img"/>
+      <target dev="hda" bus="ide"/>
+    </disk>
+    <controller type="usb" index="0">
+      <address type="pci" domain="0x0000" bus="0x00" slot="0x01" function="0x2"/>
+    </controller>
+    <controller type="pci" index="0" model="pci-root"/>
+    <controller type="ide" index="0">
+      <address type="pci" domain="0x0000" bus="0x00" slot="0x01" function="0x1"/>
+    </controller>
+    <controller type="virtio-serial" index="0">
+      <address type="pci" domain="0x0000" bus="0x00" slot="0x04" function="0x0"/>
+    </controller>
+    <interface type="network">
+      <mac address="52:54:00:93:45:ce"/>
+      <source network="default"/>
+      <model type="rtl8139"/>
+      <address type="pci" domain="0x0000" bus="0x00" slot="0x03" function="0x0"/>
+    </interface>
+    <serial type="pty">
+      <target port="0"/>
+    </serial>
+    <console type="pty">
+      <target type="serial" port="0"/>
+    </console>
+    <input type="mouse" bus="ps2"/>
+    <graphics type="vnc" port="-1" autoport="yes"/>
+    <video>
+      <model type="vga" vram="9216" heads="1"/>
+      <address type="pci" domain="0x0000" bus="0x00" slot="0x02" function="0x0"/>
+    </video>
+    <memballoon model="virtio">
+      <address type="pci" domain="0x0000" bus="0x00" slot="0x05" function="0x0"/>
+    </memballoon>
+    <panic>
+      <address type="isa" iobase="0x506"/>
+    </panic>
+  </devices>
+</domain>
diff --git a/tests/xmlparse.py b/tests/xmlparse.py
index 7cfdbbb..4567bb8 100644
--- a/tests/xmlparse.py
+++ b/tests/xmlparse.py
@@ -781,6 +781,16 @@ class XMLParseTest(unittest.TestCase):
 
         self._alter_compare(guest.get_xml_config(), outfile)
 
+    def testPanicDevice(self):
+        guest, outfile = self._get_test_content("change-panic-device")
+
+        dev1 = guest.get_devices("panic")[0]
+
+        check = self._make_checker(dev1)
+        check("type", "isa", "isa")
+        check("iobase", "0x505", "0x506")
+        self._alter_compare(guest.get_xml_config(), outfile)
+
     def testAddRemoveDevices(self):
         guest, outfile = self._get_test_content("add-devices")
 
-- 
1.8.2.1




More information about the virt-tools-list mailing list