]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
tests: qemuxml2argv: Make tests based on DO_TEST_CAPS_LATEST stable
authorPeter Krempa <pkrempa@redhat.com>
Mon, 4 Jun 2018 13:30:49 +0000 (15:30 +0200)
committerPeter Krempa <pkrempa@redhat.com>
Fri, 8 Jun 2018 07:28:58 +0000 (09:28 +0200)
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>
src/qemu/qemu_capabilities.c
src/qemu/qemu_capspriv.h
tests/qemuxml2argvdata/disk-virtio-scsi-reservations.x86_64-latest.args
tests/qemuxml2argvdata/genid-auto.x86_64-latest.args
tests/qemuxml2argvdata/genid.x86_64-latest.args
tests/qemuxml2argvtest.c

index 52178f0b0d861da8c078eeb5615741373efe69b4..e7d4f00bb18e265f7666aae88cb0df61096619c5 100644 (file)
@@ -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);
+}
index 989d183c6c274058b5ed68bd633637af0d0e55eb..4b7a04ad4b2cc74adbfccfdfeeaa05d1f3791bea 100644 (file)
@@ -98,4 +98,7 @@ virQEMUCapsProbeQMPCPUDefinitions(virQEMUCapsPtr qemuCaps,
 void
 virQEMUCapsSetMicrocodeVersion(virQEMUCapsPtr qemuCaps,
                                unsigned int microcodeVersion);
+
+void
+virQEMUCapsStripMachineAliases(virQEMUCapsPtr qemuCaps);
 #endif
index 1173dac674d355928136f400a37f79095bbcead4..902864539b91bb138d5517b7d13c56ccc7352588 100644 (file)
@@ -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 \
index c25e73b6e2704252f47869a44d5d1904901ba969..63b1d41885ef315cbcdd723f88a043fc34638642 100644 (file)
@@ -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 \
index 704e5d93e5742aac1350cc372d1afbe9fda46494..e209a1de726f97f89eed8c21a66efb9fe009c678 100644 (file)
@@ -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 \
index b0490aea556ff28cc7c61a803092e927e59b0d26..7ad1ae3930902879025f7ab7bf786d3a13392b6d 100644 (file)
@@ -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