mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-02-21 19:02:25 +00:00
tests: qemuxml2argv: Make tests based on DO_TEST_CAPS_LATEST stable
To avoid problems with test cases specifying an alias machine type which would change once capabilities for a newer version are added strip all alias machine types for the DO_TEST_CAPS_LATEST based tests. Signed-off-by: Peter Krempa <pkrempa@redhat.com> Reviewed-by: John Ferlan <jferlan@redhat.com>
This commit is contained in:
parent
e1e8d0a9b7
commit
e546785dce
@ -5170,3 +5170,20 @@ virQEMUCapsSetMicrocodeVersion(virQEMUCapsPtr qemuCaps,
|
||||
{
|
||||
qemuCaps->microcodeVersion = microcodeVersion;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* virQEMUCapsStripMachineAliases:
|
||||
* @qemuCaps: capabilities object to process
|
||||
*
|
||||
* Remove all aliases so that the tests depending on the latest capabilities
|
||||
* file can be stable when new files are added.
|
||||
*/
|
||||
void
|
||||
virQEMUCapsStripMachineAliases(virQEMUCapsPtr qemuCaps)
|
||||
{
|
||||
size_t i;
|
||||
|
||||
for (i = 0; i < qemuCaps->nmachineTypes; i++)
|
||||
VIR_FREE(qemuCaps->machineTypes[i].alias);
|
||||
}
|
||||
|
@ -98,4 +98,7 @@ virQEMUCapsProbeQMPCPUDefinitions(virQEMUCapsPtr qemuCaps,
|
||||
void
|
||||
virQEMUCapsSetMicrocodeVersion(virQEMUCapsPtr qemuCaps,
|
||||
unsigned int microcodeVersion);
|
||||
|
||||
void
|
||||
virQEMUCapsStripMachineAliases(virQEMUCapsPtr qemuCaps);
|
||||
#endif
|
||||
|
@ -11,7 +11,7 @@ QEMU_AUDIO_DRV=none \
|
||||
file=/tmp/lib/domain--1-QEMUGuest1/master-key.aes \
|
||||
-object pr-manager-helper,id=pr-helper0,\
|
||||
path=/tmp/lib/domain--1-QEMUGuest1/pr-helper0.sock \
|
||||
-machine pc-i440fx-2.12,accel=tcg,usb=off,dump-guest-core=off \
|
||||
-machine pc,accel=tcg,usb=off,dump-guest-core=off \
|
||||
-m 214 \
|
||||
-realtime mlock=off \
|
||||
-smp 8,sockets=8,cores=1,threads=1 \
|
||||
|
@ -9,7 +9,7 @@ QEMU_AUDIO_DRV=none \
|
||||
-S \
|
||||
-object secret,id=masterKey0,format=raw,\
|
||||
file=/tmp/lib/domain--1-QEMUGuest1/master-key.aes \
|
||||
-machine pc-i440fx-2.12,accel=tcg,usb=off,dump-guest-core=off \
|
||||
-machine pc,accel=tcg,usb=off,dump-guest-core=off \
|
||||
-m 214 \
|
||||
-realtime mlock=off \
|
||||
-smp 1,sockets=1,cores=1,threads=1 \
|
||||
|
@ -9,7 +9,7 @@ QEMU_AUDIO_DRV=none \
|
||||
-S \
|
||||
-object secret,id=masterKey0,format=raw,\
|
||||
file=/tmp/lib/domain--1-QEMUGuest1/master-key.aes \
|
||||
-machine pc-i440fx-2.12,accel=tcg,usb=off,dump-guest-core=off \
|
||||
-machine pc,accel=tcg,usb=off,dump-guest-core=off \
|
||||
-m 214 \
|
||||
-realtime mlock=off \
|
||||
-smp 1,sockets=1,cores=1,threads=1 \
|
||||
|
@ -713,7 +713,7 @@ mymain(void)
|
||||
* version.
|
||||
*/
|
||||
# define DO_TEST_CAPS_INTERNAL(name, suffix, migrateFrom, flags, parseFlags, \
|
||||
arch, capsfile) \
|
||||
arch, capsfile, stripmachinealiases) \
|
||||
do { \
|
||||
static struct testInfo info = { \
|
||||
name, "." suffix, NULL, migrateFrom, migrateFrom ? 7 : -1,\
|
||||
@ -723,6 +723,8 @@ mymain(void)
|
||||
if (!(info.qemuCaps = qemuTestParseCapabilitiesArch(virArchFromString(arch), \
|
||||
capsfile))) \
|
||||
return EXIT_FAILURE; \
|
||||
if (stripmachinealiases) \
|
||||
virQEMUCapsStripMachineAliases(info.qemuCaps); \
|
||||
if (virTestRun("QEMU XML-2-ARGV " name "." suffix, \
|
||||
testCompareXMLToArgv, &info) < 0) \
|
||||
ret = -1; \
|
||||
@ -734,7 +736,7 @@ mymain(void)
|
||||
|
||||
# define DO_TEST_CAPS_ARCH_VER_FULL(name, flags, parseFlags, arch, ver) \
|
||||
DO_TEST_CAPS_INTERNAL(name, arch "-" ver, NULL, flags, parseFlags, \
|
||||
arch, TEST_CAPS_PATH ver "." arch ".xml")
|
||||
arch, TEST_CAPS_PATH ver "." arch ".xml", false)
|
||||
|
||||
# define DO_TEST_CAPS_ARCH_VER(name, arch, ver) \
|
||||
DO_TEST_CAPS_ARCH_VER_FULL(name, 0, 0, arch, ver)
|
||||
@ -744,7 +746,7 @@ mymain(void)
|
||||
|
||||
# define DO_TEST_CAPS_LATEST(name) \
|
||||
DO_TEST_CAPS_INTERNAL(name, "x86_64-latest", NULL, 0, 0, "x86_64", \
|
||||
capslatest_x86_64)
|
||||
capslatest_x86_64, true)
|
||||
|
||||
/**
|
||||
* The following test macros should be used only in cases when the tests require
|
||||
|
Loading…
x
Reference in New Issue
Block a user