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

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

 



On 05/21/2018 05:57 AM, Filip Alac wrote:
Add test case for the os cmdline.
Check if:
656151bf5dd299322dcf37d06d20534e667a1963
work as expected.

Thanks for taking up Cole's suggestion! I had added it to my todo list.

To test the code you fixed in 656151bf, we need to check the following

1. no 'extra=' or 'root=' in xm.cfg
2. 'extra=' but no 'root=' in xm.cfg
3. 'root=' but no 'extra=' in xm.cfg
4. both 'root=' and 'extra=' in xm.cfg

Since all of the existing xmconfig tests have no 'extra=' or 'root=', we've got 1 covered :-). We could be evil and test 2 by adding 'extra=' to an existing paravirt test, e.g. test-paravirt-vcpu. Perhaps less evil would be to add 'extra=' to all the existing paravirt tests, along with <cmdline> in associated .xml file.

3 and 4 need handled a bit differently since the roundtrip xm.cfg to xml to xm.cfg tests will not pass when xm.cfg contains 'root='. The xm.cfg to xml conversion maps 'root=' to <cmdline>, but the reverse maps <cmdline> to 'extra='. The easy solution is to only test the xm.cfg to xml conversion using the DO_TEST_FORMAT macro. E.g attached is a patch that tests xm.cfg to xml conversion of xm.cfg containing both 'extra=' and 'root='. We'd need a similar change for testing only 'root='.

Do you have time to tweak the patch to test all conditions and submit a V2? If not I'll get to it.

Regards,
Jim
>From 4e993de0a28c5863336df402e862fbeeb97fe305 Mon Sep 17 00:00:00 2001
From: Jim Fehlig <jfehlig@xxxxxxxx>
Date: Fri, 18 May 2018 15:07:46 -0600
Subject: [PATCH] tests: add xmconfig test for cmdline conversion

Signed-off-by: Jim Fehlig <jfehlig@xxxxxxxx>
---
 tests/xmconfigdata/test-paravirt-cmdline.cfg | 14 ++++++++++++
 tests/xmconfigdata/test-paravirt-cmdline.xml | 34 ++++++++++++++++++++++++++++
 tests/xmconfigtest.c                         |  1 +
 3 files changed, 49 insertions(+)

diff --git a/tests/xmconfigdata/test-paravirt-cmdline.cfg b/tests/xmconfigdata/test-paravirt-cmdline.cfg
new file mode 100644
index 0000000000..a15d9b2532
--- /dev/null
+++ b/tests/xmconfigdata/test-paravirt-cmdline.cfg
@@ -0,0 +1,14 @@
+name = "XenGuest1"
+uuid = "c7a5fdb0-cdaf-9455-926a-d65c16db1809"
+maxmem = 579
+memory = 394
+vcpus = 2
+localtime = 0
+on_poweroff = "destroy"
+on_reboot = "restart"
+on_crash = "restart"
+vif = [ "mac=00:16:3e:66:94:9c,bridge=br0,script=vif-bridge" ]
+bootloader = "/usr/bin/pygrub"
+root="/dev/xvda2"
+extra="3"
+disk = [ "phy:/dev/HostVG/XenGuest1,xvda,w" ]
diff --git a/tests/xmconfigdata/test-paravirt-cmdline.xml b/tests/xmconfigdata/test-paravirt-cmdline.xml
new file mode 100644
index 0000000000..a18a3a3894
--- /dev/null
+++ b/tests/xmconfigdata/test-paravirt-cmdline.xml
@@ -0,0 +1,34 @@
+<domain type='xen'>
+  <name>XenGuest1</name>
+  <uuid>c7a5fdb0-cdaf-9455-926a-d65c16db1809</uuid>
+  <memory unit='KiB'>592896</memory>
+  <currentMemory unit='KiB'>403456</currentMemory>
+  <vcpu placement='static'>2</vcpu>
+  <bootloader>/usr/bin/pygrub</bootloader>
+  <os>
+    <type arch='x86_64' machine='xenpv'>linux</type>
+    <cmdline>root=/dev/xvda2 3</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='block' device='disk'>
+      <driver name='phy' type='raw'/>
+      <source dev='/dev/HostVG/XenGuest1'/>
+      <target dev='xvda' bus='xen'/>
+    </disk>
+    <interface type='bridge'>
+      <mac address='00:16:3e:66:94:9c'/>
+      <source bridge='br0'/>
+      <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 6851fa73cd..21569f40b6 100644
--- a/tests/xmconfigtest.c
+++ b/tests/xmconfigtest.c
@@ -194,6 +194,7 @@ mymain(void)
         DO_TEST_FORMAT(name); \
     } while (0)
 
+    DO_TEST_FORMAT("paravirt-cmdline");
     DO_TEST("paravirt-new-pvfb");
     DO_TEST("paravirt-new-pvfb-vncdisplay");
     DO_TEST("paravirt-net-e1000");
-- 
2.16.3

--
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]

  Powered by Linux