提交 36cc189a 编写于 作者: M Michal Privoznik

tests: Add test cases for previous commit

This commit is rather big. Firstly, the in memory config
representation is adjusted like if security_driver was set to "none".
The rest is then just adaptation to the new code that will generate
different seclabels.
Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
上级 d869a6ea
...@@ -42,5 +42,5 @@ ...@@ -42,5 +42,5 @@
</controller> </controller>
<memballoon model='none'/> <memballoon model='none'/>
</devices> </devices>
<seclabel type='none'/> <seclabel type='none' model='none'/>
</domain> </domain>
...@@ -41,5 +41,5 @@ ...@@ -41,5 +41,5 @@
</controller> </controller>
<memballoon model='none'/> <memballoon model='none'/>
</devices> </devices>
<seclabel type='none'/> <seclabel type='none' model='none'/>
</domain> </domain>
...@@ -42,5 +42,5 @@ ...@@ -42,5 +42,5 @@
</controller> </controller>
<memballoon model='none'/> <memballoon model='none'/>
</devices> </devices>
<seclabel type='none'/> <seclabel type='none' model='none'/>
</domain> </domain>
...@@ -34,5 +34,5 @@ ...@@ -34,5 +34,5 @@
</controller> </controller>
<memballoon model='none'/> <memballoon model='none'/>
</devices> </devices>
<seclabel type='none'/> <seclabel type='none' model='none'/>
</domain> </domain>
<domain type='kvm'>
<name>migt10</name>
<uuid>0d73c5c3-43d0-f75b-31de-6aa919b0176b</uuid>
<memory unit='KiB'>262144</memory>
<currentMemory unit='KiB'>262144</currentMemory>
<memoryBacking>
<hugepages>
<page size='2048' unit='KiB' nodeset='0'/>
</hugepages>
</memoryBacking>
<vcpu placement='static'>4</vcpu>
<os>
<type arch='x86_64' machine='pc-i440fx-2.1'>hvm</type>
<boot dev='hd'/>
</os>
<features>
<acpi/>
</features>
<clock offset='utc'/>
<on_poweroff>destroy</on_poweroff>
<on_reboot>restart</on_reboot>
<on_crash>destroy</on_crash>
<devices>
<emulator>/usr/bin/qemu-system-x86_64</emulator>
<controller type='usb' index='0'>
<address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/>
</controller>
<controller type='virtio-serial' index='0'>
<address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
</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>
<channel type='spicevmc'>
<target type='virtio' name='com.redhat.spice.0'/>
<address type='virtio-serial' controller='0' bus='0' port='1'/>
</channel>
<input type='mouse' bus='ps2'/>
<input type='keyboard' bus='ps2'/>
<graphics type='spice' autoport='yes' listen='0.0.0.0'>
<listen type='address' address='0.0.0.0'/>
</graphics>
<video>
<model type='cirrus' vram='8192' 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>
</devices>
<seclabel type='dynamic' relabel='yes'/>
</domain>
<domain type='kvm'>
<name>migt10</name>
<uuid>0d73c5c3-43d0-f75b-31de-6aa919b0176b</uuid>
<memory unit='KiB'>262144</memory>
<currentMemory unit='KiB'>262144</currentMemory>
<memoryBacking>
<hugepages>
<page size='2048' unit='KiB' nodeset='0'/>
</hugepages>
</memoryBacking>
<vcpu placement='static'>4</vcpu>
<os>
<type arch='x86_64' machine='pc-i440fx-2.1'>hvm</type>
<boot dev='hd'/>
</os>
<features>
<acpi/>
</features>
<clock offset='utc'/>
<on_poweroff>destroy</on_poweroff>
<on_reboot>restart</on_reboot>
<on_crash>destroy</on_crash>
<devices>
<emulator>/usr/bin/qemu-system-x86_64</emulator>
<controller type='usb' index='0'>
<address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/>
</controller>
<controller type='virtio-serial' index='0'>
<address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
</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>
<channel type='spicevmc'>
<target type='virtio' name='com.redhat.spice.0'/>
<address type='virtio-serial' controller='0' bus='0' port='1'/>
</channel>
<input type='mouse' bus='ps2'/>
<input type='keyboard' bus='ps2'/>
<graphics type='spice' autoport='yes' listen='0.0.0.0'>
<listen type='address' address='0.0.0.0'/>
</graphics>
<video>
<model type='cirrus' vram='8192' 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>
</devices>
<seclabel type='none' model='none'/>
</domain>
<domain type='qemu'>
<name>QEMUGuest1</name>
<uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
<memory unit='KiB'>219100</memory>
<currentMemory unit='KiB'>219100</currentMemory>
<vcpu placement='static' 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' target='0' unit='0'/>
</disk>
<controller type='usb' index='0'/>
<controller type='ide' index='0'/>
<controller type='pci' index='0' model='pci-root'/>
<memballoon model='virtio'/>
</devices>
<seclabel type='none' model='none'/>
</domain>
<domain type='qemu'>
<name>QEMUGuest1</name>
<uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
<memory unit='KiB'>219100</memory>
<currentMemory unit='KiB'>219100</currentMemory>
<vcpu placement='static' 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' target='0' unit='0'/>
</disk>
<controller type='usb' index='0'/>
<controller type='ide' index='0'/>
<controller type='pci' index='0' model='pci-root'/>
<memballoon model='virtio'/>
</devices>
<seclabel type='none' model='none'/>
</domain>
...@@ -315,12 +315,13 @@ mymain(void) ...@@ -315,12 +315,13 @@ mymain(void)
DO_TEST_FULL("seclabel-dynamic-baselabel", false, WHEN_INACTIVE); DO_TEST_FULL("seclabel-dynamic-baselabel", false, WHEN_INACTIVE);
DO_TEST_FULL("seclabel-dynamic-override", false, WHEN_INACTIVE); DO_TEST_FULL("seclabel-dynamic-override", false, WHEN_INACTIVE);
DO_TEST_FULL("seclabel-dynamic-labelskip", true, WHEN_INACTIVE); DO_TEST_FULL("seclabel-dynamic-labelskip", true, WHEN_INACTIVE);
DO_TEST_FULL("seclabel-dynamic-relabel", false, WHEN_INACTIVE); DO_TEST_FULL("seclabel-dynamic-relabel", true, WHEN_INACTIVE);
DO_TEST("seclabel-static"); DO_TEST("seclabel-static");
DO_TEST_FULL("seclabel-static-labelskip", false, WHEN_ACTIVE); DO_TEST_FULL("seclabel-static-labelskip", false, WHEN_ACTIVE);
DO_TEST("seclabel-none"); DO_TEST_DIFFERENT("seclabel-none");
DO_TEST("seclabel-dac-none"); DO_TEST("seclabel-dac-none");
DO_TEST("seclabel-dynamic-none"); DO_TEST("seclabel-dynamic-none");
DO_TEST_FULL("seclabel-dynamic-none-relabel", true, WHEN_INACTIVE);
DO_TEST("numad-static-vcpu-no-numatune"); DO_TEST("numad-static-vcpu-no-numatune");
DO_TEST("disk-scsi-lun-passthrough-sgio"); DO_TEST("disk-scsi-lun-passthrough-sgio");
......
...@@ -252,6 +252,16 @@ virCapsPtr testQemuCapsInit(void) ...@@ -252,6 +252,16 @@ virCapsPtr testQemuCapsInit(void)
false, false)) == NULL) false, false)) == NULL)
return NULL; return NULL;
/* Add dummy 'none' security_driver. This is equal to setting
* security_driver = "none" in qemu.conf. */
if (VIR_ALLOC_N(caps->host.secModels, 1) < 0)
goto cleanup;
caps->host.nsecModels = 1;
if (VIR_STRDUP(caps->host.secModels[0].model, "none") < 0 ||
VIR_STRDUP(caps->host.secModels[0].doi, "0") < 0)
goto cleanup;
if ((caps->host.cpu = virCPUDefCopy(&host_cpu)) == NULL || if ((caps->host.cpu = virCPUDefCopy(&host_cpu)) == NULL ||
(machines = testQemuAllocMachines(&nmachines)) == NULL) (machines = testQemuAllocMachines(&nmachines)) == NULL)
goto cleanup; goto cleanup;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册