mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-03 11:35:19 +00:00
tests: Introduce QEMU memory locking limit tests
These tests cover a number of scenarios where we care about the memory locking limit being set correctly for the guest to work properly.
This commit is contained in:
parent
94918e2035
commit
8cfe7d977a
@ -127,6 +127,7 @@ EXTRA_DIST = \
|
|||||||
qemumonitorjsondata \
|
qemumonitorjsondata \
|
||||||
qemuxml2argvdata \
|
qemuxml2argvdata \
|
||||||
qemuxml2xmloutdata \
|
qemuxml2xmloutdata \
|
||||||
|
qemumemlockdata \
|
||||||
secretxml2xmlin \
|
secretxml2xmlin \
|
||||||
securityselinuxhelperdata \
|
securityselinuxhelperdata \
|
||||||
securityselinuxlabeldata \
|
securityselinuxlabeldata \
|
||||||
@ -277,6 +278,7 @@ test_programs += qemuxml2argvtest qemuxml2xmltest \
|
|||||||
qemuargv2xmltest qemuhelptest domainsnapshotxml2xmltest \
|
qemuargv2xmltest qemuhelptest domainsnapshotxml2xmltest \
|
||||||
qemumonitortest qemumonitorjsontest qemuhotplugtest \
|
qemumonitortest qemumonitorjsontest qemuhotplugtest \
|
||||||
qemuagenttest qemucapabilitiestest qemucaps2xmltest \
|
qemuagenttest qemucapabilitiestest qemucaps2xmltest \
|
||||||
|
qemumemlocktest \
|
||||||
qemucommandutiltest
|
qemucommandutiltest
|
||||||
test_helpers += qemucapsprobe
|
test_helpers += qemucapsprobe
|
||||||
test_libraries += libqemumonitortestutils.la \
|
test_libraries += libqemumonitortestutils.la \
|
||||||
@ -659,6 +661,12 @@ domainsnapshotxml2xmltest_SOURCES = \
|
|||||||
domainsnapshotxml2xmltest.c testutilsqemu.c testutilsqemu.h \
|
domainsnapshotxml2xmltest.c testutilsqemu.c testutilsqemu.h \
|
||||||
testutils.c testutils.h
|
testutils.c testutils.h
|
||||||
domainsnapshotxml2xmltest_LDADD = $(qemu_LDADDS) $(LDADDS)
|
domainsnapshotxml2xmltest_LDADD = $(qemu_LDADDS) $(LDADDS)
|
||||||
|
|
||||||
|
qemumemlocktest_SOURCES = \
|
||||||
|
qemumemlocktest.c \
|
||||||
|
testutilsqemu.c testutilsqemu.h \
|
||||||
|
testutils.c testutils.h
|
||||||
|
qemumemlocktest_LDADD = $(qemu_LDADDS) $(LDADDS)
|
||||||
else ! WITH_QEMU
|
else ! WITH_QEMU
|
||||||
EXTRA_DIST += qemuxml2argvtest.c qemuxml2xmltest.c qemuargv2xmltest.c \
|
EXTRA_DIST += qemuxml2argvtest.c qemuxml2xmltest.c qemuargv2xmltest.c \
|
||||||
qemuhelptest.c domainsnapshotxml2xmltest.c \
|
qemuhelptest.c domainsnapshotxml2xmltest.c \
|
||||||
@ -666,6 +674,7 @@ EXTRA_DIST += qemuxml2argvtest.c qemuxml2xmltest.c qemuargv2xmltest.c \
|
|||||||
qemumonitorjsontest.c qemuhotplugtest.c \
|
qemumonitorjsontest.c qemuhotplugtest.c \
|
||||||
qemuagenttest.c qemucapabilitiestest.c \
|
qemuagenttest.c qemucapabilitiestest.c \
|
||||||
qemucaps2xmltest.c qemucommandutiltest.c \
|
qemucaps2xmltest.c qemucommandutiltest.c \
|
||||||
|
qemumemlocktest.c \
|
||||||
$(QEMUMONITORTESTUTILS_SOURCES)
|
$(QEMUMONITORTESTUTILS_SOURCES)
|
||||||
endif ! WITH_QEMU
|
endif ! WITH_QEMU
|
||||||
|
|
||||||
|
20
tests/qemumemlockdata/qemumemlock-pc-hardlimit+hostdev.xml
Normal file
20
tests/qemumemlockdata/qemumemlock-pc-hardlimit+hostdev.xml
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
<domain type='kvm'>
|
||||||
|
<name>guest</name>
|
||||||
|
<memory unit='KiB'>1048576</memory>
|
||||||
|
<memtune>
|
||||||
|
<hard_limit unit='KiB'>2097152</hard_limit>
|
||||||
|
</memtune>
|
||||||
|
<vcpu placement='static'>1</vcpu>
|
||||||
|
<os>
|
||||||
|
<type arch='x86_64' machine='pc'>hvm</type>
|
||||||
|
</os>
|
||||||
|
<devices>
|
||||||
|
<emulator>/usr/bin/qemu-system-x86_64</emulator>
|
||||||
|
<hostdev mode='subsystem' type='pci' managed='yes'>
|
||||||
|
<driver name='vfio'/>
|
||||||
|
<source>
|
||||||
|
<address domain='0x0000' bus='0x04' slot='0x02' function='0x0'/>
|
||||||
|
</source>
|
||||||
|
</hostdev>
|
||||||
|
</devices>
|
||||||
|
</domain>
|
@ -0,0 +1,23 @@
|
|||||||
|
<domain type='kvm'>
|
||||||
|
<name>guest</name>
|
||||||
|
<memory unit='KiB'>1048576</memory>
|
||||||
|
<memtune>
|
||||||
|
<hard_limit unit='KiB'>2097152</hard_limit>
|
||||||
|
</memtune>
|
||||||
|
<memoryBacking>
|
||||||
|
<locked/>
|
||||||
|
</memoryBacking>
|
||||||
|
<vcpu placement='static'>1</vcpu>
|
||||||
|
<os>
|
||||||
|
<type arch='x86_64' machine='pc'>hvm</type>
|
||||||
|
</os>
|
||||||
|
<devices>
|
||||||
|
<emulator>/usr/bin/qemu-system-x86_64</emulator>
|
||||||
|
<hostdev mode='subsystem' type='pci' managed='yes'>
|
||||||
|
<driver name='vfio'/>
|
||||||
|
<source>
|
||||||
|
<address domain='0x0000' bus='0x04' slot='0x02' function='0x0'/>
|
||||||
|
</source>
|
||||||
|
</hostdev>
|
||||||
|
</devices>
|
||||||
|
</domain>
|
17
tests/qemumemlockdata/qemumemlock-pc-hardlimit+locked.xml
Normal file
17
tests/qemumemlockdata/qemumemlock-pc-hardlimit+locked.xml
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
<domain type='kvm'>
|
||||||
|
<name>guest</name>
|
||||||
|
<memory unit='KiB'>1048576</memory>
|
||||||
|
<memtune>
|
||||||
|
<hard_limit unit='KiB'>2097152</hard_limit>
|
||||||
|
</memtune>
|
||||||
|
<memoryBacking>
|
||||||
|
<locked/>
|
||||||
|
</memoryBacking>
|
||||||
|
<vcpu placement='static'>1</vcpu>
|
||||||
|
<os>
|
||||||
|
<type arch='x86_64' machine='pc'>hvm</type>
|
||||||
|
</os>
|
||||||
|
<devices>
|
||||||
|
<emulator>/usr/bin/qemu-system-x86_64</emulator>
|
||||||
|
</devices>
|
||||||
|
</domain>
|
14
tests/qemumemlockdata/qemumemlock-pc-hardlimit.xml
Normal file
14
tests/qemumemlockdata/qemumemlock-pc-hardlimit.xml
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
<domain type='kvm'>
|
||||||
|
<name>guest</name>
|
||||||
|
<memory unit='KiB'>1048576</memory>
|
||||||
|
<memtune>
|
||||||
|
<hard_limit unit='KiB'>2097152</hard_limit>
|
||||||
|
</memtune>
|
||||||
|
<vcpu placement='static'>1</vcpu>
|
||||||
|
<os>
|
||||||
|
<type arch='x86_64' machine='pc'>hvm</type>
|
||||||
|
</os>
|
||||||
|
<devices>
|
||||||
|
<emulator>/usr/bin/qemu-system-x86_64</emulator>
|
||||||
|
</devices>
|
||||||
|
</domain>
|
17
tests/qemumemlockdata/qemumemlock-pc-hostdev.xml
Normal file
17
tests/qemumemlockdata/qemumemlock-pc-hostdev.xml
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
<domain type='kvm'>
|
||||||
|
<name>guest</name>
|
||||||
|
<memory unit='KiB'>1048576</memory>
|
||||||
|
<vcpu placement='static'>1</vcpu>
|
||||||
|
<os>
|
||||||
|
<type arch='x86_64' machine='pc'>hvm</type>
|
||||||
|
</os>
|
||||||
|
<devices>
|
||||||
|
<emulator>/usr/bin/qemu-system-x86_64</emulator>
|
||||||
|
<hostdev mode='subsystem' type='pci' managed='yes'>
|
||||||
|
<driver name='vfio'/>
|
||||||
|
<source>
|
||||||
|
<address domain='0x0000' bus='0x04' slot='0x02' function='0x0'/>
|
||||||
|
</source>
|
||||||
|
</hostdev>
|
||||||
|
</devices>
|
||||||
|
</domain>
|
11
tests/qemumemlockdata/qemumemlock-pc-kvm.xml
Normal file
11
tests/qemumemlockdata/qemumemlock-pc-kvm.xml
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
<domain type='kvm'>
|
||||||
|
<name>guest</name>
|
||||||
|
<memory unit='KiB'>1048576</memory>
|
||||||
|
<vcpu placement='static'>1</vcpu>
|
||||||
|
<os>
|
||||||
|
<type arch='x86_64' machine='pc'>hvm</type>
|
||||||
|
</os>
|
||||||
|
<devices>
|
||||||
|
<emulator>/usr/bin/qemu-system-x86_64</emulator>
|
||||||
|
</devices>
|
||||||
|
</domain>
|
20
tests/qemumemlockdata/qemumemlock-pc-locked+hostdev.xml
Normal file
20
tests/qemumemlockdata/qemumemlock-pc-locked+hostdev.xml
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
<domain type='kvm'>
|
||||||
|
<name>guest</name>
|
||||||
|
<memory unit='KiB'>1048576</memory>
|
||||||
|
<memoryBacking>
|
||||||
|
<locked/>
|
||||||
|
</memoryBacking>
|
||||||
|
<vcpu placement='static'>1</vcpu>
|
||||||
|
<os>
|
||||||
|
<type arch='x86_64' machine='pc'>hvm</type>
|
||||||
|
</os>
|
||||||
|
<devices>
|
||||||
|
<emulator>/usr/bin/qemu-system-x86_64</emulator>
|
||||||
|
<hostdev mode='subsystem' type='pci' managed='yes'>
|
||||||
|
<driver name='vfio'/>
|
||||||
|
<source>
|
||||||
|
<address domain='0x0000' bus='0x04' slot='0x02' function='0x0'/>
|
||||||
|
</source>
|
||||||
|
</hostdev>
|
||||||
|
</devices>
|
||||||
|
</domain>
|
14
tests/qemumemlockdata/qemumemlock-pc-locked.xml
Normal file
14
tests/qemumemlockdata/qemumemlock-pc-locked.xml
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
<domain type='kvm'>
|
||||||
|
<name>guest</name>
|
||||||
|
<memory unit='KiB'>1048576</memory>
|
||||||
|
<memoryBacking>
|
||||||
|
<locked/>
|
||||||
|
</memoryBacking>
|
||||||
|
<vcpu placement='static'>1</vcpu>
|
||||||
|
<os>
|
||||||
|
<type arch='x86_64' machine='pc'>hvm</type>
|
||||||
|
</os>
|
||||||
|
<devices>
|
||||||
|
<emulator>/usr/bin/qemu-system-x86_64</emulator>
|
||||||
|
</devices>
|
||||||
|
</domain>
|
11
tests/qemumemlockdata/qemumemlock-pc-tcg.xml
Normal file
11
tests/qemumemlockdata/qemumemlock-pc-tcg.xml
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
<domain type='qemu'>
|
||||||
|
<name>guest</name>
|
||||||
|
<memory unit='KiB'>1048576</memory>
|
||||||
|
<vcpu placement='static'>1</vcpu>
|
||||||
|
<os>
|
||||||
|
<type arch='x86_64' machine='pc'>hvm</type>
|
||||||
|
</os>
|
||||||
|
<devices>
|
||||||
|
<emulator>/usr/bin/qemu-system-x86_64</emulator>
|
||||||
|
</devices>
|
||||||
|
</domain>
|
@ -0,0 +1,20 @@
|
|||||||
|
<domain type='kvm'>
|
||||||
|
<name>guest</name>
|
||||||
|
<memory unit='KiB'>1048576</memory>
|
||||||
|
<memtune>
|
||||||
|
<hard_limit unit='KiB'>2097152</hard_limit>
|
||||||
|
</memtune>
|
||||||
|
<vcpu placement='static'>1</vcpu>
|
||||||
|
<os>
|
||||||
|
<type arch='ppc64' machine='pseries'>hvm</type>
|
||||||
|
</os>
|
||||||
|
<devices>
|
||||||
|
<emulator>/usr/bin/qemu-system-ppc64</emulator>
|
||||||
|
<hostdev mode='subsystem' type='pci' managed='yes'>
|
||||||
|
<driver name='vfio'/>
|
||||||
|
<source>
|
||||||
|
<address domain='0x0000' bus='0x04' slot='0x02' function='0x0'/>
|
||||||
|
</source>
|
||||||
|
</hostdev>
|
||||||
|
</devices>
|
||||||
|
</domain>
|
@ -0,0 +1,23 @@
|
|||||||
|
<domain type='kvm'>
|
||||||
|
<name>guest</name>
|
||||||
|
<memory unit='KiB'>1048576</memory>
|
||||||
|
<memtune>
|
||||||
|
<hard_limit unit='KiB'>2097152</hard_limit>
|
||||||
|
</memtune>
|
||||||
|
<memoryBacking>
|
||||||
|
<locked/>
|
||||||
|
</memoryBacking>
|
||||||
|
<vcpu placement='static'>1</vcpu>
|
||||||
|
<os>
|
||||||
|
<type arch='ppc64' machine='pseries'>hvm</type>
|
||||||
|
</os>
|
||||||
|
<devices>
|
||||||
|
<emulator>/usr/bin/qemu-system-ppc64</emulator>
|
||||||
|
<hostdev mode='subsystem' type='pci' managed='yes'>
|
||||||
|
<driver name='vfio'/>
|
||||||
|
<source>
|
||||||
|
<address domain='0x0000' bus='0x04' slot='0x02' function='0x0'/>
|
||||||
|
</source>
|
||||||
|
</hostdev>
|
||||||
|
</devices>
|
||||||
|
</domain>
|
@ -0,0 +1,17 @@
|
|||||||
|
<domain type='kvm'>
|
||||||
|
<name>guest</name>
|
||||||
|
<memory unit='KiB'>1048576</memory>
|
||||||
|
<memtune>
|
||||||
|
<hard_limit unit='KiB'>2097152</hard_limit>
|
||||||
|
</memtune>
|
||||||
|
<memoryBacking>
|
||||||
|
<locked/>
|
||||||
|
</memoryBacking>
|
||||||
|
<vcpu placement='static'>1</vcpu>
|
||||||
|
<os>
|
||||||
|
<type arch='ppc64' machine='pseries'>hvm</type>
|
||||||
|
</os>
|
||||||
|
<devices>
|
||||||
|
<emulator>/usr/bin/qemu-system-ppc64</emulator>
|
||||||
|
</devices>
|
||||||
|
</domain>
|
14
tests/qemumemlockdata/qemumemlock-pseries-hardlimit.xml
Normal file
14
tests/qemumemlockdata/qemumemlock-pseries-hardlimit.xml
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
<domain type='kvm'>
|
||||||
|
<name>guest</name>
|
||||||
|
<memory unit='KiB'>1048576</memory>
|
||||||
|
<memtune>
|
||||||
|
<hard_limit unit='KiB'>2097152</hard_limit>
|
||||||
|
</memtune>
|
||||||
|
<vcpu placement='static'>1</vcpu>
|
||||||
|
<os>
|
||||||
|
<type arch='ppc64' machine='pseries'>hvm</type>
|
||||||
|
</os>
|
||||||
|
<devices>
|
||||||
|
<emulator>/usr/bin/qemu-system-ppc64</emulator>
|
||||||
|
</devices>
|
||||||
|
</domain>
|
17
tests/qemumemlockdata/qemumemlock-pseries-hostdev.xml
Normal file
17
tests/qemumemlockdata/qemumemlock-pseries-hostdev.xml
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
<domain type='kvm'>
|
||||||
|
<name>guest</name>
|
||||||
|
<memory unit='KiB'>1048576</memory>
|
||||||
|
<vcpu placement='static'>1</vcpu>
|
||||||
|
<os>
|
||||||
|
<type arch='ppc64' machine='pseries'>hvm</type>
|
||||||
|
</os>
|
||||||
|
<devices>
|
||||||
|
<emulator>/usr/bin/qemu-system-ppc64</emulator>
|
||||||
|
<hostdev mode='subsystem' type='pci' managed='yes'>
|
||||||
|
<driver name='vfio'/>
|
||||||
|
<source>
|
||||||
|
<address domain='0x0000' bus='0x04' slot='0x02' function='0x0'/>
|
||||||
|
</source>
|
||||||
|
</hostdev>
|
||||||
|
</devices>
|
||||||
|
</domain>
|
11
tests/qemumemlockdata/qemumemlock-pseries-kvm.xml
Normal file
11
tests/qemumemlockdata/qemumemlock-pseries-kvm.xml
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
<domain type='kvm'>
|
||||||
|
<name>guest</name>
|
||||||
|
<memory unit='KiB'>1048576</memory>
|
||||||
|
<vcpu placement='static'>1</vcpu>
|
||||||
|
<os>
|
||||||
|
<type arch='ppc64' machine='pseries'>hvm</type>
|
||||||
|
</os>
|
||||||
|
<devices>
|
||||||
|
<emulator>/usr/bin/qemu-system-ppc64</emulator>
|
||||||
|
</devices>
|
||||||
|
</domain>
|
20
tests/qemumemlockdata/qemumemlock-pseries-locked+hostdev.xml
Normal file
20
tests/qemumemlockdata/qemumemlock-pseries-locked+hostdev.xml
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
<domain type='kvm'>
|
||||||
|
<name>guest</name>
|
||||||
|
<memory unit='KiB'>1048576</memory>
|
||||||
|
<memoryBacking>
|
||||||
|
<locked/>
|
||||||
|
</memoryBacking>
|
||||||
|
<vcpu placement='static'>1</vcpu>
|
||||||
|
<os>
|
||||||
|
<type arch='ppc64' machine='pseries'>hvm</type>
|
||||||
|
</os>
|
||||||
|
<devices>
|
||||||
|
<emulator>/usr/bin/qemu-system-ppc64</emulator>
|
||||||
|
<hostdev mode='subsystem' type='pci' managed='yes'>
|
||||||
|
<driver name='vfio'/>
|
||||||
|
<source>
|
||||||
|
<address domain='0x0000' bus='0x04' slot='0x02' function='0x0'/>
|
||||||
|
</source>
|
||||||
|
</hostdev>
|
||||||
|
</devices>
|
||||||
|
</domain>
|
14
tests/qemumemlockdata/qemumemlock-pseries-locked.xml
Normal file
14
tests/qemumemlockdata/qemumemlock-pseries-locked.xml
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
<domain type='kvm'>
|
||||||
|
<name>guest</name>
|
||||||
|
<memory unit='KiB'>1048576</memory>
|
||||||
|
<memoryBacking>
|
||||||
|
<locked/>
|
||||||
|
</memoryBacking>
|
||||||
|
<vcpu placement='static'>1</vcpu>
|
||||||
|
<os>
|
||||||
|
<type arch='ppc64' machine='pseries'>hvm</type>
|
||||||
|
</os>
|
||||||
|
<devices>
|
||||||
|
<emulator>/usr/bin/qemu-system-ppc64</emulator>
|
||||||
|
</devices>
|
||||||
|
</domain>
|
11
tests/qemumemlockdata/qemumemlock-pseries-tcg.xml
Normal file
11
tests/qemumemlockdata/qemumemlock-pseries-tcg.xml
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
<domain type='qemu'>
|
||||||
|
<name>guest</name>
|
||||||
|
<memory unit='KiB'>1048576</memory>
|
||||||
|
<vcpu placement='static'>1</vcpu>
|
||||||
|
<os>
|
||||||
|
<type arch='ppc64' machine='pseries'>hvm</type>
|
||||||
|
</os>
|
||||||
|
<devices>
|
||||||
|
<emulator>/usr/bin/qemu-system-ppc64</emulator>
|
||||||
|
</devices>
|
||||||
|
</domain>
|
142
tests/qemumemlocktest.c
Normal file
142
tests/qemumemlocktest.c
Normal file
@ -0,0 +1,142 @@
|
|||||||
|
#include <config.h>
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
|
#include <sys/types.h>
|
||||||
|
#include <fcntl.h>
|
||||||
|
|
||||||
|
#include "testutils.h"
|
||||||
|
|
||||||
|
#ifdef WITH_QEMU
|
||||||
|
|
||||||
|
# include "datatypes.h"
|
||||||
|
# include "internal.h"
|
||||||
|
# include "virstring.h"
|
||||||
|
# include "conf/domain_conf.h"
|
||||||
|
# include "qemu/qemu_domain.h"
|
||||||
|
|
||||||
|
# include "testutilsqemu.h"
|
||||||
|
|
||||||
|
# define VIR_FROM_THIS VIR_FROM_QEMU
|
||||||
|
|
||||||
|
static const char *abs_top_srcdir;
|
||||||
|
static virQEMUDriver driver;
|
||||||
|
|
||||||
|
struct testInfo {
|
||||||
|
const char *name;
|
||||||
|
unsigned long long memlock;
|
||||||
|
};
|
||||||
|
|
||||||
|
static int
|
||||||
|
testCompareMemLock(const void *data)
|
||||||
|
{
|
||||||
|
const struct testInfo *info = data;
|
||||||
|
virDomainDefPtr def = NULL;
|
||||||
|
char *xml = NULL;
|
||||||
|
int ret = -1;
|
||||||
|
|
||||||
|
if (virAsprintf(&xml, "%s/qemumemlockdata/qemumemlock-%s.xml",
|
||||||
|
abs_srcdir, info->name) < 0)
|
||||||
|
goto cleanup;
|
||||||
|
|
||||||
|
if (!(def = virDomainDefParseFile(xml, driver.caps, driver.xmlopt, NULL,
|
||||||
|
VIR_DOMAIN_DEF_PARSE_INACTIVE))) {
|
||||||
|
goto cleanup;
|
||||||
|
}
|
||||||
|
|
||||||
|
ret = virTestCompareToULL(info->memlock, qemuDomainGetMemLockLimitBytes(def));
|
||||||
|
|
||||||
|
cleanup:
|
||||||
|
virObjectUnref(def);
|
||||||
|
VIR_FREE(xml);
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static int
|
||||||
|
mymain(void)
|
||||||
|
{
|
||||||
|
int ret = 0;
|
||||||
|
|
||||||
|
abs_top_srcdir = getenv("abs_top_srcdir");
|
||||||
|
if (!abs_top_srcdir)
|
||||||
|
abs_top_srcdir = abs_srcdir "/..";
|
||||||
|
|
||||||
|
if (qemuTestDriverInit(&driver) < 0)
|
||||||
|
return EXIT_FAILURE;
|
||||||
|
|
||||||
|
driver.privileged = true;
|
||||||
|
|
||||||
|
# define DO_TEST(name, memlock) \
|
||||||
|
do { \
|
||||||
|
static struct testInfo info = { \
|
||||||
|
name, memlock \
|
||||||
|
}; \
|
||||||
|
if (virTestRun("QEMU MEMLOCK " name, testCompareMemLock, &info) < 0) \
|
||||||
|
ret = -1; \
|
||||||
|
} while (0)
|
||||||
|
|
||||||
|
/* The tests below make sure that the memory locking limit is being
|
||||||
|
* calculated correctly in a number of situations. Each test is
|
||||||
|
* performed both on x86_64/pc and ppc64/pseries in order to account
|
||||||
|
* for some architecture-specific details.
|
||||||
|
*
|
||||||
|
* kvm: simple KMV guest
|
||||||
|
* tcg: simple TCG guest
|
||||||
|
*
|
||||||
|
* hardlimit: guest where <memtune><hard_limit> has been configured
|
||||||
|
* locked: guest where <memoryBacking><locked> has been enabled
|
||||||
|
* hostdev: guest that has some hostdev assigned
|
||||||
|
*
|
||||||
|
* The remaining tests cover different combinations of the above to
|
||||||
|
* ensure settings are prioritized as expected.
|
||||||
|
*/
|
||||||
|
|
||||||
|
qemuTestSetHostArch(driver.caps, VIR_ARCH_X86_64);
|
||||||
|
|
||||||
|
DO_TEST("pc-kvm", 0);
|
||||||
|
DO_TEST("pc-tcg", 0);
|
||||||
|
|
||||||
|
DO_TEST("pc-hardlimit", 2147483648);
|
||||||
|
DO_TEST("pc-locked", VIR_DOMAIN_MEMORY_PARAM_UNLIMITED);
|
||||||
|
DO_TEST("pc-hostdev", 2147483648);
|
||||||
|
|
||||||
|
DO_TEST("pc-hardlimit+locked", 2147483648);
|
||||||
|
DO_TEST("pc-hardlimit+hostdev", 2147483648);
|
||||||
|
DO_TEST("pc-hardlimit+locked+hostdev", 2147483648);
|
||||||
|
DO_TEST("pc-locked+hostdev", VIR_DOMAIN_MEMORY_PARAM_UNLIMITED);
|
||||||
|
|
||||||
|
qemuTestSetHostArch(driver.caps, VIR_ARCH_PPC64);
|
||||||
|
|
||||||
|
DO_TEST("pseries-kvm", 20971520);
|
||||||
|
DO_TEST("pseries-tcg", 0);
|
||||||
|
|
||||||
|
DO_TEST("pseries-hardlimit", 2147483648);
|
||||||
|
DO_TEST("pseries-locked", VIR_DOMAIN_MEMORY_PARAM_UNLIMITED);
|
||||||
|
DO_TEST("pseries-hostdev", 2168455168);
|
||||||
|
|
||||||
|
DO_TEST("pseries-hardlimit+locked", 2147483648);
|
||||||
|
DO_TEST("pseries-hardlimit+hostdev", 2147483648);
|
||||||
|
DO_TEST("pseries-hardlimit+locked+hostdev", 2147483648);
|
||||||
|
DO_TEST("pseries-locked+hostdev", VIR_DOMAIN_MEMORY_PARAM_UNLIMITED);
|
||||||
|
|
||||||
|
qemuTestDriverFree(&driver);
|
||||||
|
|
||||||
|
return ret == 0 ? EXIT_SUCCESS : EXIT_FAILURE;
|
||||||
|
}
|
||||||
|
|
||||||
|
VIRT_TEST_MAIN(mymain)
|
||||||
|
|
||||||
|
#else
|
||||||
|
|
||||||
|
int
|
||||||
|
main(void)
|
||||||
|
{
|
||||||
|
return EXIT_AM_SKIP;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif /* WITH_QEMU */
|
Loading…
Reference in New Issue
Block a user