[PATCH 1/7] tests: Add qemuxml2xml tests for <seclabel> handling

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Signed-off-by: Cole Robinson <crobinso@xxxxxxxxxx>
---
 docs/schemas/domain.rng                            |   13 ++++-
 tests/domainschematest                             |    2 +-
 .../qemuxml2xml-balloon-device-auto-out.xml        |   25 +++++++++
 .../qemuxml2xml-channel-virtio-auto-out.xml        |   54 ++++++++++++++++++++
 .../qemuxml2xml-console-compat-auto-out.xml        |   31 +++++++++++
 .../qemuxml2xml-console-virtio-out.xml             |   29 +++++++++++
 .../qemuxml2xml-disk-scsi-device-auto-out.xml      |   31 +++++++++++
 .../qemuxml2xml-seclabel-dynamic-in.xml            |   24 +++++++++
 .../qemuxml2xml-seclabel-dynamic-out.xml           |   20 +++++++
 .../qemuxml2xml-seclabel-static-in.xml             |   24 +++++++++
 .../qemuxml2xml-seclabel-static-out.xml            |   23 ++++++++
 .../qemuxml2xmlout-balloon-device-auto.xml         |   25 ---------
 .../qemuxml2xmlout-channel-virtio-auto.xml         |   54 --------------------
 .../qemuxml2xmlout-console-compat-auto.xml         |   31 -----------
 .../qemuxml2xmlout-console-virtio.xml              |   29 -----------
 .../qemuxml2xmlout-disk-scsi-device-auto.xml       |   31 -----------
 tests/qemuxml2xmltest.c                            |   25 +++++++---
 17 files changed, 290 insertions(+), 181 deletions(-)
 create mode 100644 tests/qemuxml2xmldata/qemuxml2xml-balloon-device-auto-out.xml
 create mode 100644 tests/qemuxml2xmldata/qemuxml2xml-channel-virtio-auto-out.xml
 create mode 100644 tests/qemuxml2xmldata/qemuxml2xml-console-compat-auto-out.xml
 create mode 100644 tests/qemuxml2xmldata/qemuxml2xml-console-virtio-out.xml
 create mode 100644 tests/qemuxml2xmldata/qemuxml2xml-disk-scsi-device-auto-out.xml
 create mode 100644 tests/qemuxml2xmldata/qemuxml2xml-seclabel-dynamic-in.xml
 create mode 100644 tests/qemuxml2xmldata/qemuxml2xml-seclabel-dynamic-out.xml
 create mode 100644 tests/qemuxml2xmldata/qemuxml2xml-seclabel-static-in.xml
 create mode 100644 tests/qemuxml2xmldata/qemuxml2xml-seclabel-static-out.xml
 delete mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-balloon-device-auto.xml
 delete mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-channel-virtio-auto.xml
 delete mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-console-compat-auto.xml
 delete mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-console-virtio.xml
 delete mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-scsi-device-auto.xml

diff --git a/docs/schemas/domain.rng b/docs/schemas/domain.rng
index a524e4b..9c1e9bb 100644
--- a/docs/schemas/domain.rng
+++ b/docs/schemas/domain.rng
@@ -61,9 +61,16 @@
           <value>static</value>
         </choice>
       </attribute>
-      <element name="label">
-        <text/>
-      </element>
+      <optional>
+        <element name="label">
+          <text/>
+        </element>
+      </optional>
+      <optional>
+        <element name="imagelabel">
+          <text/>
+        </element>
+      </optional>
     </element>
   </define>
   <define name="hvs">
diff --git a/tests/domainschematest b/tests/domainschematest
index 7557cef..085ef93 100755
--- a/tests/domainschematest
+++ b/tests/domainschematest
@@ -4,7 +4,7 @@
 . $srcdir/test-lib.sh
 . $abs_srcdir/schematestutils.sh
 
-DIRS="domainschemadata qemuxml2argvdata sexpr2xmldata xmconfigdata xml2sexprdata qemuxml2xmloutdata"
+DIRS="domainschemadata qemuxml2argvdata sexpr2xmldata xmconfigdata xml2sexprdata qemuxml2xmldata"
 SCHEMA="domain.rng"
 
 check_schema "$DIRS" "$SCHEMA"
diff --git a/tests/qemuxml2xmldata/qemuxml2xml-balloon-device-auto-out.xml b/tests/qemuxml2xmldata/qemuxml2xml-balloon-device-auto-out.xml
new file mode 100644
index 0000000..ed91e37
--- /dev/null
+++ b/tests/qemuxml2xmldata/qemuxml2xml-balloon-device-auto-out.xml
@@ -0,0 +1,25 @@
+<domain type='qemu'>
+  <name>QEMUGuest1</name>
+  <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+  <memory>219200</memory>
+  <currentMemory>219200</currentMemory>
+  <vcpu>1</vcpu>
+  <os>
+    <type arch='i686' machine='pc'>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>
+    <emulator>/usr/bin/qemu</emulator>
+    <disk type='block' device='disk'>
+      <source dev='/dev/HostVG/QEMUGuest1'/>
+      <target dev='hda' bus='ide'/>
+      <address type='drive' controller='0' bus='0' unit='0'/>
+    </disk>
+    <controller type='ide' index='0'/>
+    <memballoon model='virtio'/>
+  </devices>
+</domain>
diff --git a/tests/qemuxml2xmldata/qemuxml2xml-channel-virtio-auto-out.xml b/tests/qemuxml2xmldata/qemuxml2xml-channel-virtio-auto-out.xml
new file mode 100644
index 0000000..7990374
--- /dev/null
+++ b/tests/qemuxml2xmldata/qemuxml2xml-channel-virtio-auto-out.xml
@@ -0,0 +1,54 @@
+<domain type='qemu'>
+  <name>QEMUGuest1</name>
+  <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+  <memory>219200</memory>
+  <currentMemory>219200</currentMemory>
+  <vcpu cpuset='1-4,8-20,525'>1</vcpu>
+  <os>
+    <type arch='i686' machine='pc'>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>
+    <emulator>/usr/bin/qemu</emulator>
+    <disk type='block' device='disk'>
+      <source dev='/dev/HostVG/QEMUGuest1'/>
+      <target dev='hda' bus='ide'/>
+      <address type='drive' controller='0' bus='0' unit='0'/>
+    </disk>
+    <controller type='ide' index='0'/>
+    <controller type='virtio-serial' index='0' ports='16' vectors='4'/>
+    <controller type='virtio-serial' index='1'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x0a' function='0x0'/>
+    </controller>
+    <controller type='virtio-serial' index='2'/>
+    <channel type='pty'>
+      <target type='virtio' name='org.linux-kvm.port.0'/>
+      <address type='virtio-serial' controller='0' bus='0' port='0'/>
+    </channel>
+    <channel type='pty'>
+      <target type='virtio' name='org.linux-kvm.port.foo'/>
+      <address type='virtio-serial' controller='1' bus='0' port='0'/>
+    </channel>
+    <channel type='pty'>
+      <target type='virtio' name='org.linux-kvm.port.bar'/>
+      <address type='virtio-serial' controller='1' bus='0' port='3'/>
+    </channel>
+    <channel type='pty'>
+      <target type='virtio' name='org.linux-kvm.port.wizz'/>
+      <address type='virtio-serial' controller='0' bus='0' port='1'/>
+    </channel>
+    <channel type='pty'>
+      <target type='virtio' name='org.linux-kvm.port.ooh'/>
+      <address type='virtio-serial' controller='1' bus='0' port='4'/>
+    </channel>
+    <channel type='pty'>
+      <target type='virtio' name='org.linux-kvm.port.lla'/>
+      <address type='virtio-serial' controller='2' bus='0' port='0'/>
+    </channel>
+    <memballoon model='virtio'/>
+  </devices>
+</domain>
diff --git a/tests/qemuxml2xmldata/qemuxml2xml-console-compat-auto-out.xml b/tests/qemuxml2xmldata/qemuxml2xml-console-compat-auto-out.xml
new file mode 100644
index 0000000..9591c87
--- /dev/null
+++ b/tests/qemuxml2xmldata/qemuxml2xml-console-compat-auto-out.xml
@@ -0,0 +1,31 @@
+<domain type='qemu'>
+  <name>QEMUGuest1</name>
+  <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+  <memory>219200</memory>
+  <currentMemory>219200</currentMemory>
+  <vcpu>1</vcpu>
+  <os>
+    <type arch='i686' machine='pc'>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>
+    <emulator>/usr/bin/qemu</emulator>
+    <disk type='block' device='disk'>
+      <source dev='/dev/HostVG/QEMUGuest1'/>
+      <target dev='hda' bus='ide'/>
+      <address type='drive' controller='0' bus='0' unit='0'/>
+    </disk>
+    <controller type='ide' index='0'/>
+    <serial type='pty'>
+      <target port='0'/>
+    </serial>
+    <console type='pty'>
+      <target type='serial' port='0'/>
+    </console>
+    <memballoon model='virtio'/>
+  </devices>
+</domain>
diff --git a/tests/qemuxml2xmldata/qemuxml2xml-console-virtio-out.xml b/tests/qemuxml2xmldata/qemuxml2xml-console-virtio-out.xml
new file mode 100644
index 0000000..431dd34
--- /dev/null
+++ b/tests/qemuxml2xmldata/qemuxml2xml-console-virtio-out.xml
@@ -0,0 +1,29 @@
+<domain type='qemu'>
+  <name>QEMUGuest1</name>
+  <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+  <memory>219200</memory>
+  <currentMemory>219200</currentMemory>
+  <vcpu cpuset='1-4,8-20,525'>1</vcpu>
+  <os>
+    <type arch='i686' machine='pc'>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>
+    <emulator>/usr/bin/qemu</emulator>
+    <disk type='block' device='disk'>
+      <source dev='/dev/HostVG/QEMUGuest1'/>
+      <target dev='hda' bus='ide'/>
+      <address type='drive' controller='0' bus='0' unit='0'/>
+    </disk>
+    <controller type='ide' index='0'/>
+    <controller type='virtio-serial' index='0'/>
+    <console type='pty'>
+      <target type='virtio' port='0'/>
+    </console>
+    <memballoon model='virtio'/>
+  </devices>
+</domain>
diff --git a/tests/qemuxml2xmldata/qemuxml2xml-disk-scsi-device-auto-out.xml b/tests/qemuxml2xmldata/qemuxml2xml-disk-scsi-device-auto-out.xml
new file mode 100644
index 0000000..a250940
--- /dev/null
+++ b/tests/qemuxml2xmldata/qemuxml2xml-disk-scsi-device-auto-out.xml
@@ -0,0 +1,31 @@
+<domain type='qemu'>
+  <name>QEMUGuest1</name>
+  <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+  <memory>219200</memory>
+  <currentMemory>219200</currentMemory>
+  <vcpu>1</vcpu>
+  <os>
+    <type arch='i686' machine='pc'>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>
+    <emulator>/usr/bin/qemu</emulator>
+    <disk type='block' device='disk'>
+      <source dev='/dev/HostVG/QEMUGuest1'/>
+      <target dev='hda' bus='ide'/>
+      <address type='drive' controller='0' bus='0' unit='0'/>
+    </disk>
+    <disk type='file' device='disk'>
+      <source file='/tmp/scsidisk.img'/>
+      <target dev='sda' bus='scsi'/>
+      <address type='drive' controller='0' bus='0' unit='0'/>
+    </disk>
+    <controller type='ide' index='0'/>
+    <controller type='scsi' index='0'/>
+    <memballoon model='virtio'/>
+  </devices>
+</domain>
diff --git a/tests/qemuxml2xmldata/qemuxml2xml-seclabel-dynamic-in.xml b/tests/qemuxml2xmldata/qemuxml2xml-seclabel-dynamic-in.xml
new file mode 100644
index 0000000..5cbac90
--- /dev/null
+++ b/tests/qemuxml2xmldata/qemuxml2xml-seclabel-dynamic-in.xml
@@ -0,0 +1,24 @@
+<domain type='qemu'>
+  <name>QEMUGuest1</name>
+  <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+  <memory>219200</memory>
+  <currentMemory>219200</currentMemory>
+  <vcpu>1</vcpu>
+  <os>
+    <type arch='i686' machine='pc'>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>
+    <emulator>/usr/bin/qemu</emulator>
+    <controller type='ide' index='0'/>
+    <memballoon model='virtio'/>
+  </devices>
+  <seclabel type='dynamic' model='selinux'>
+    <label>foolabel</label>
+    <imagelabel>fooimagelabel</imagelabel>
+  </seclabel>
+</domain>
diff --git a/tests/qemuxml2xmldata/qemuxml2xml-seclabel-dynamic-out.xml b/tests/qemuxml2xmldata/qemuxml2xml-seclabel-dynamic-out.xml
new file mode 100644
index 0000000..8b344d7
--- /dev/null
+++ b/tests/qemuxml2xmldata/qemuxml2xml-seclabel-dynamic-out.xml
@@ -0,0 +1,20 @@
+<domain type='qemu'>
+  <name>QEMUGuest1</name>
+  <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+  <memory>219200</memory>
+  <currentMemory>219200</currentMemory>
+  <vcpu>1</vcpu>
+  <os>
+    <type arch='i686' machine='pc'>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>
+    <emulator>/usr/bin/qemu</emulator>
+    <controller type='ide' index='0'/>
+    <memballoon model='virtio'/>
+  </devices>
+</domain>
diff --git a/tests/qemuxml2xmldata/qemuxml2xml-seclabel-static-in.xml b/tests/qemuxml2xmldata/qemuxml2xml-seclabel-static-in.xml
new file mode 100644
index 0000000..0837a68
--- /dev/null
+++ b/tests/qemuxml2xmldata/qemuxml2xml-seclabel-static-in.xml
@@ -0,0 +1,24 @@
+<domain type='qemu'>
+  <name>QEMUGuest1</name>
+  <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+  <memory>219200</memory>
+  <currentMemory>219200</currentMemory>
+  <vcpu>1</vcpu>
+  <os>
+    <type arch='i686' machine='pc'>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>
+    <emulator>/usr/bin/qemu</emulator>
+    <controller type='ide' index='0'/>
+    <memballoon model='virtio'/>
+  </devices>
+  <seclabel type='static' model='apparmor'>
+    <label>foolabel</label>
+    <imagelabel>fooimagelabel</imagelabel>
+  </seclabel>
+</domain>
diff --git a/tests/qemuxml2xmldata/qemuxml2xml-seclabel-static-out.xml b/tests/qemuxml2xmldata/qemuxml2xml-seclabel-static-out.xml
new file mode 100644
index 0000000..9954175
--- /dev/null
+++ b/tests/qemuxml2xmldata/qemuxml2xml-seclabel-static-out.xml
@@ -0,0 +1,23 @@
+<domain type='qemu'>
+  <name>QEMUGuest1</name>
+  <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+  <memory>219200</memory>
+  <currentMemory>219200</currentMemory>
+  <vcpu>1</vcpu>
+  <os>
+    <type arch='i686' machine='pc'>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>
+    <emulator>/usr/bin/qemu</emulator>
+    <controller type='ide' index='0'/>
+    <memballoon model='virtio'/>
+  </devices>
+  <seclabel type='static' model='apparmor'>
+    <label>foolabel</label>
+  </seclabel>
+</domain>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-balloon-device-auto.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-balloon-device-auto.xml
deleted file mode 100644
index ed91e37..0000000
--- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-balloon-device-auto.xml
+++ /dev/null
@@ -1,25 +0,0 @@
-<domain type='qemu'>
-  <name>QEMUGuest1</name>
-  <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
-  <memory>219200</memory>
-  <currentMemory>219200</currentMemory>
-  <vcpu>1</vcpu>
-  <os>
-    <type arch='i686' machine='pc'>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>
-    <emulator>/usr/bin/qemu</emulator>
-    <disk type='block' device='disk'>
-      <source dev='/dev/HostVG/QEMUGuest1'/>
-      <target dev='hda' bus='ide'/>
-      <address type='drive' controller='0' bus='0' unit='0'/>
-    </disk>
-    <controller type='ide' index='0'/>
-    <memballoon model='virtio'/>
-  </devices>
-</domain>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-channel-virtio-auto.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-channel-virtio-auto.xml
deleted file mode 100644
index 7990374..0000000
--- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-channel-virtio-auto.xml
+++ /dev/null
@@ -1,54 +0,0 @@
-<domain type='qemu'>
-  <name>QEMUGuest1</name>
-  <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
-  <memory>219200</memory>
-  <currentMemory>219200</currentMemory>
-  <vcpu cpuset='1-4,8-20,525'>1</vcpu>
-  <os>
-    <type arch='i686' machine='pc'>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>
-    <emulator>/usr/bin/qemu</emulator>
-    <disk type='block' device='disk'>
-      <source dev='/dev/HostVG/QEMUGuest1'/>
-      <target dev='hda' bus='ide'/>
-      <address type='drive' controller='0' bus='0' unit='0'/>
-    </disk>
-    <controller type='ide' index='0'/>
-    <controller type='virtio-serial' index='0' ports='16' vectors='4'/>
-    <controller type='virtio-serial' index='1'>
-      <address type='pci' domain='0x0000' bus='0x00' slot='0x0a' function='0x0'/>
-    </controller>
-    <controller type='virtio-serial' index='2'/>
-    <channel type='pty'>
-      <target type='virtio' name='org.linux-kvm.port.0'/>
-      <address type='virtio-serial' controller='0' bus='0' port='0'/>
-    </channel>
-    <channel type='pty'>
-      <target type='virtio' name='org.linux-kvm.port.foo'/>
-      <address type='virtio-serial' controller='1' bus='0' port='0'/>
-    </channel>
-    <channel type='pty'>
-      <target type='virtio' name='org.linux-kvm.port.bar'/>
-      <address type='virtio-serial' controller='1' bus='0' port='3'/>
-    </channel>
-    <channel type='pty'>
-      <target type='virtio' name='org.linux-kvm.port.wizz'/>
-      <address type='virtio-serial' controller='0' bus='0' port='1'/>
-    </channel>
-    <channel type='pty'>
-      <target type='virtio' name='org.linux-kvm.port.ooh'/>
-      <address type='virtio-serial' controller='1' bus='0' port='4'/>
-    </channel>
-    <channel type='pty'>
-      <target type='virtio' name='org.linux-kvm.port.lla'/>
-      <address type='virtio-serial' controller='2' bus='0' port='0'/>
-    </channel>
-    <memballoon model='virtio'/>
-  </devices>
-</domain>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-console-compat-auto.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-console-compat-auto.xml
deleted file mode 100644
index 9591c87..0000000
--- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-console-compat-auto.xml
+++ /dev/null
@@ -1,31 +0,0 @@
-<domain type='qemu'>
-  <name>QEMUGuest1</name>
-  <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
-  <memory>219200</memory>
-  <currentMemory>219200</currentMemory>
-  <vcpu>1</vcpu>
-  <os>
-    <type arch='i686' machine='pc'>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>
-    <emulator>/usr/bin/qemu</emulator>
-    <disk type='block' device='disk'>
-      <source dev='/dev/HostVG/QEMUGuest1'/>
-      <target dev='hda' bus='ide'/>
-      <address type='drive' controller='0' bus='0' unit='0'/>
-    </disk>
-    <controller type='ide' index='0'/>
-    <serial type='pty'>
-      <target port='0'/>
-    </serial>
-    <console type='pty'>
-      <target type='serial' port='0'/>
-    </console>
-    <memballoon model='virtio'/>
-  </devices>
-</domain>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-console-virtio.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-console-virtio.xml
deleted file mode 100644
index 431dd34..0000000
--- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-console-virtio.xml
+++ /dev/null
@@ -1,29 +0,0 @@
-<domain type='qemu'>
-  <name>QEMUGuest1</name>
-  <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
-  <memory>219200</memory>
-  <currentMemory>219200</currentMemory>
-  <vcpu cpuset='1-4,8-20,525'>1</vcpu>
-  <os>
-    <type arch='i686' machine='pc'>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>
-    <emulator>/usr/bin/qemu</emulator>
-    <disk type='block' device='disk'>
-      <source dev='/dev/HostVG/QEMUGuest1'/>
-      <target dev='hda' bus='ide'/>
-      <address type='drive' controller='0' bus='0' unit='0'/>
-    </disk>
-    <controller type='ide' index='0'/>
-    <controller type='virtio-serial' index='0'/>
-    <console type='pty'>
-      <target type='virtio' port='0'/>
-    </console>
-    <memballoon model='virtio'/>
-  </devices>
-</domain>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-scsi-device-auto.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-scsi-device-auto.xml
deleted file mode 100644
index a250940..0000000
--- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-scsi-device-auto.xml
+++ /dev/null
@@ -1,31 +0,0 @@
-<domain type='qemu'>
-  <name>QEMUGuest1</name>
-  <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
-  <memory>219200</memory>
-  <currentMemory>219200</currentMemory>
-  <vcpu>1</vcpu>
-  <os>
-    <type arch='i686' machine='pc'>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>
-    <emulator>/usr/bin/qemu</emulator>
-    <disk type='block' device='disk'>
-      <source dev='/dev/HostVG/QEMUGuest1'/>
-      <target dev='hda' bus='ide'/>
-      <address type='drive' controller='0' bus='0' unit='0'/>
-    </disk>
-    <disk type='file' device='disk'>
-      <source file='/tmp/scsidisk.img'/>
-      <target dev='sda' bus='scsi'/>
-      <address type='drive' controller='0' bus='0' unit='0'/>
-    </disk>
-    <controller type='ide' index='0'/>
-    <controller type='scsi' index='0'/>
-    <memballoon model='virtio'/>
-  </devices>
-</domain>
diff --git a/tests/qemuxml2xmltest.c b/tests/qemuxml2xmltest.c
index 326a1f1..2af7494 100644
--- a/tests/qemuxml2xmltest.c
+++ b/tests/qemuxml2xmltest.c
@@ -15,9 +15,14 @@
 # include "qemu/qemu_conf.h"
 # include "testutilsqemu.h"
 
+# define XML2ARGV_FMT "%s/qemuxml2argvdata/qemuxml2argv-%s.xml"
+# define XML2XMLIN_FMT "%s/qemuxml2xmldata/qemuxml2xml-%s-in.xml"
+# define XML2XMLOUT_FMT "%s/qemuxml2xmldata/qemuxml2xml-%s-out.xml"
+
 static char *progname;
 static char *abs_srcdir;
 static struct qemud_driver driver;
+static char *input_folder_fmt;
 
 # define MAX_FILE 4096
 
@@ -58,7 +63,7 @@ static int testCompareXMLToXMLFiles(const char *inxml, const char *outxml) {
 
 struct testInfo {
     const char *name;
-    int different;
+    bool different;
 };
 
 static int testCompareXMLToXMLHelper(const void *data) {
@@ -67,10 +72,8 @@ static int testCompareXMLToXMLHelper(const void *data) {
     char xml_out[PATH_MAX];
     int ret;
 
-    snprintf(xml_in, PATH_MAX, "%s/qemuxml2argvdata/qemuxml2argv-%s.xml",
-             abs_srcdir, info->name);
-    snprintf(xml_out, PATH_MAX, "%s/qemuxml2xmloutdata/qemuxml2xmlout-%s.xml",
-             abs_srcdir, info->name);
+    snprintf(xml_in, PATH_MAX, input_folder_fmt, abs_srcdir, info->name);
+    snprintf(xml_out, PATH_MAX, XML2XMLOUT_FMT, abs_srcdir, info->name);
 
     if (info->different) {
         ret = testCompareXMLToXMLFiles(xml_in, xml_out);
@@ -111,16 +114,18 @@ mymain(int argc, char **argv)
     } while (0)
 
 # define DO_TEST(name) \
-    DO_TEST_FULL(name, 0)
+    DO_TEST_FULL(name, false)
 
 # define DO_TEST_DIFFERENT(name) \
-    DO_TEST_FULL(name, 1)
+    DO_TEST_FULL(name, true)
 
     /* Unset or set all envvars here that are copied in qemudBuildCommandLine
      * using ADD_ENV_COPY, otherwise these tests may fail due to unexpected
      * values for these envvars */
     setenv("PATH", "/bin", 1);
 
+    input_folder_fmt = (char *) XML2ARGV_FMT;
+
     DO_TEST("minimal");
     DO_TEST("boot-cdrom");
     DO_TEST("boot-network");
@@ -190,6 +195,12 @@ mymain(int argc, char **argv)
     DO_TEST_DIFFERENT("disk-scsi-device-auto");
     DO_TEST_DIFFERENT("console-virtio");
 
+
+    /* All tests after this point use input and output from qemuxml2xmldata*/
+    input_folder_fmt = (char *) XML2XMLIN_FMT;
+    DO_TEST_DIFFERENT("seclabel-dynamic");
+    DO_TEST_DIFFERENT("seclabel-static");
+
     virCapabilitiesFree(driver.caps);
 
     return (ret==0 ? EXIT_SUCCESS : EXIT_FAILURE);
-- 
1.7.3.2

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list


[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]