tests: xmconfigtest: add tests for cmdline formating

Commit 656151bf fixed formatting of the <cmdline> element. Perhaps it
would have been noticed and fixed earlier if we had a test. With this
change, all possible cases of formatting <cmdline> from xmconfig are
covered

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

Case 1 is covered by all existing paravirt tests since they have no
'extra=' or 'root='. Case 2 is covered by adding 'extra=' to a few
of the existing paravirt tests. Cases 3 and 4 are covered by new
tests that only test conversion of xm.cfg to xml.

Signed-off-by: Jim Fehlig <jfehlig@suse.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
This commit is contained in:
Jim Fehlig 2018-05-23 15:09:45 -06:00
parent 67c56f6e65
commit 076a2b4096
9 changed files with 99 additions and 0 deletions

View File

@ -0,0 +1,13 @@
name = "XenGuest1"
uuid = "c7a5fdb0-cdaf-9455-926a-d65c16db1809"
memory = 512
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 = "console=hvc0"
disk = [ "phy:/dev/HostVG/XenGuest1,xvda,w" ]

View File

@ -0,0 +1,34 @@
<domain type='xen'>
<name>XenGuest1</name>
<uuid>c7a5fdb0-cdaf-9455-926a-d65c16db1809</uuid>
<memory unit='KiB'>524288</memory>
<currentMemory unit='KiB'>524288</currentMemory>
<vcpu placement='static'>2</vcpu>
<bootloader>/usr/bin/pygrub</bootloader>
<os>
<type arch='x86_64' machine='xenpv'>linux</type>
<cmdline>root=/dev/xvda2 console=hvc0</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>

View File

@ -10,4 +10,5 @@ on_reboot = "restart"
on_crash = "restart"
vif = [ "mac=00:16:3e:66:94:9c,bridge=br0,script=vif-bridge" ]
bootloader = "/usr/bin/pygrub"
extra = "console=hvc0"
disk = [ "phy:/dev/HostVG/XenGuest1,xvda,w" ]

View File

@ -7,6 +7,7 @@
<bootloader>/usr/bin/pygrub</bootloader>
<os>
<type arch='x86_64' machine='xenpv'>linux</type>
<cmdline>console=hvc0</cmdline>
</os>
<clock offset='utc' adjustment='reset'/>
<on_poweroff>destroy</on_poweroff>

View File

@ -0,0 +1,12 @@
name = "XenGuest1"
uuid = "c7a5fdb0-cdaf-9455-926a-d65c16db1809"
memory = 512
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"
disk = [ "phy:/dev/HostVG/XenGuest1,xvda,w" ]

View File

@ -0,0 +1,34 @@
<domain type='xen'>
<name>XenGuest1</name>
<uuid>c7a5fdb0-cdaf-9455-926a-d65c16db1809</uuid>
<memory unit='KiB'>524288</memory>
<currentMemory unit='KiB'>524288</currentMemory>
<vcpu placement='static'>2</vcpu>
<bootloader>/usr/bin/pygrub</bootloader>
<os>
<type arch='x86_64' machine='xenpv'>linux</type>
<cmdline>root=/dev/xvda2</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>

View File

@ -10,4 +10,5 @@ on_reboot = "restart"
on_crash = "restart"
vif = [ "mac=00:16:3e:66:94:9c,bridge=br0,script=vif-bridge" ]
bootloader = "/usr/bin/pygrub"
extra = "console=hvc0"
disk = [ "phy:/dev/HostVG/XenGuest1,xvda,w" ]

View File

@ -7,6 +7,7 @@
<bootloader>/usr/bin/pygrub</bootloader>
<os>
<type arch='x86_64' machine='xenpv'>linux</type>
<cmdline>console=hvc0</cmdline>
</os>
<clock offset='utc' adjustment='reset'/>
<on_poweroff>destroy</on_poweroff>

View File

@ -200,6 +200,8 @@ mymain(void)
DO_TEST("paravirt-net-vifname");
DO_TEST("paravirt-vcpu");
DO_TEST("paravirt-maxvcpus");
DO_TEST_FORMAT("paravirt-root");
DO_TEST_FORMAT("paravirt-extra-root");
DO_TEST("fullvirt-new-cdrom");
DO_TEST("fullvirt-utc");
DO_TEST("fullvirt-localtime");