[libvirt] [PATCH 1/1] tests: xmconfigtest: Add test for os.cmdline

Filip Alac filipalac at gmail.com
Mon May 21 11:57:26 UTC 2018


Add test case for the os cmdline.
Check if:
656151bf5dd299322dcf37d06d20534e667a1963
work as expected.

Signed-off-by: Filip Alac <filipalac at gmail.com>
---
 tests/xmconfigdata/test-os-cmdline.cfg | 14 +++++++++
 tests/xmconfigdata/test-os-cmdline.xml | 40 ++++++++++++++++++++++++++
 tests/xmconfigtest.c                   |  2 ++
 3 files changed, 56 insertions(+)
 create mode 100644 tests/xmconfigdata/test-os-cmdline.cfg
 create mode 100644 tests/xmconfigdata/test-os-cmdline.xml

diff --git a/tests/xmconfigdata/test-os-cmdline.cfg b/tests/xmconfigdata/test-os-cmdline.cfg
new file mode 100644
index 0000000..8ca8179
--- /dev/null
+++ b/tests/xmconfigdata/test-os-cmdline.cfg
@@ -0,0 +1,14 @@
+name = "test"
+uuid = "ab6eec38-06ad-4fa6-aa50-4bb3dac321ef"
+maxmem = 128
+memory = 128
+vcpus = 1
+localtime = 0
+on_poweroff = "destroy"
+on_reboot = "restart"
+on_crash = "restart"
+vif = [ "mac=00:16:3e:70:61:00,bridge=xenbr0,script=vif-bridge" ]
+kernel = "/boot/vmlinuz-2.6.26-2-xen-amd64"
+ramdisk = "/boot/initrd.img-2.6.26-2-xen-amd64"
+extra = "root=/dev/xvda2 ro"
+disk = [ "file:/opt/xen/domains/test/swap.img,xvda1,w", "file:/opt/xen/domains/test/disk.img,xvda2,w" ]
diff --git a/tests/xmconfigdata/test-os-cmdline.xml b/tests/xmconfigdata/test-os-cmdline.xml
new file mode 100644
index 0000000..5f85b2e
--- /dev/null
+++ b/tests/xmconfigdata/test-os-cmdline.xml
@@ -0,0 +1,40 @@
+<domain type='xen'>
+  <name>test</name>
+  <uuid>ab6eec38-06ad-4fa6-aa50-4bb3dac321ef</uuid>
+  <memory unit='KiB'>131072</memory>
+  <currentMemory unit='KiB'>131072</currentMemory>
+  <vcpu placement='static'>1</vcpu>
+  <os>
+    <type arch='x86_64' machine='xenpv'>linux</type>
+    <kernel>/boot/vmlinuz-2.6.26-2-xen-amd64</kernel>
+    <initrd>/boot/initrd.img-2.6.26-2-xen-amd64</initrd>
+    <cmdline>root=/dev/xvda2 ro</cmdline>
+  </os>
+  <clock offset='utc' adjustment='reset'/>
+  <on_poweroff>destroy</on_poweroff>
+  <on_reboot>restart</on_reboot>
+  <on_crash>restart</on_crash>
+  <devices>
+    <disk type='file' device='disk'>
+      <driver name='file' type='raw'/>
+      <source file='/opt/xen/domains/test/swap.img'/>
+      <target dev='xvda1' bus='xen'/>
+    </disk>
+    <disk type='file' device='disk'>
+      <driver name='file' type='raw'/>
+      <source file='/opt/xen/domains/test/disk.img'/>
+      <target dev='xvda2' bus='xen'/>
+    </disk>
+    <interface type='bridge'>
+      <mac address='00:16:3e:70:61:00'/>
+      <source bridge='xenbr0'/>
+      <script path='vif-bridge'/>
+    </interface>
+    <console type='pty'>
+      <target type='xen' port='0'/>
+    </console>
+    <input type='mouse' bus='xen'/>
+    <input type='keyboard' bus='xen'/>
+    <memballoon model='xen'/>
+  </devices>
+</domain>
diff --git a/tests/xmconfigtest.c b/tests/xmconfigtest.c
index 6851fa7..2820711 100644
--- a/tests/xmconfigtest.c
+++ b/tests/xmconfigtest.c
@@ -234,6 +234,8 @@ mymain(void)
     DO_TEST("disk-drv-blktap-raw");
     DO_TEST("disk-drv-blktap2-raw");

+    DO_TEST("os-cmdline");
+
     virObjectUnref(caps);
     virObjectUnref(xmlopt);
 
-- 
2.17.0




More information about the libvir-list mailing list