]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
tests: improve build time for qemuxml2argvtest
authorDaniel P. Berrangé <berrange@redhat.com>
Wed, 27 Nov 2019 16:20:02 +0000 (16:20 +0000)
committerDaniel P. Berrangé <berrange@redhat.com>
Thu, 28 Nov 2019 14:30:46 +0000 (14:30 +0000)
On Fedora 31 with GCC 9.2.1, compiling qemuxml2argvtest takes
about 36 seconds since

  commit 30c6d99209cd36bba8e14795622f658827698522
  Author: Jiri Denemark <jdenemar@redhat.com>
  Date:   Thu Oct 24 17:51:42 2019 +0200

    qemuxml2argvtest: Update host arch for DO_TEST*ARCH* tests

The optimizer is hitting some pathological performance behaviour due to
the high number of branches in the mymain() method.

Pushing the branch tests down into the testCompareXMLToArgv method
brings the compile time down to 3 seconds.

This likely related to this GCC bug:

  https://gcc.gnu.org/bugzilla/show_bug.cgi?id=58479

Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
tests/qemuxml2argvtest.c

index a2791d0460ac94926cef18a96978c7516089ee39..86b8899921c8cb59d1f1c44ac35a82bc2a886b99 100644 (file)
@@ -412,6 +412,9 @@ testCompareXMLToArgv(const void *data)
     size_t i;
     qemuDomainObjPrivatePtr priv = NULL;
 
+    if (info->arch != VIR_ARCH_NONE && info->arch != VIR_ARCH_X86_64)
+        qemuTestSetHostArch(driver.caps, info->arch);
+
     memset(&monitor_chr, 0, sizeof(monitor_chr));
 
     if (!(conn = virGetConnect()))
@@ -580,6 +583,9 @@ testCompareXMLToArgv(const void *data)
     virSetConnectStorage(NULL);
     virObjectUnref(conn);
     VIR_FREE(migrateURI);
+    if (info->arch != VIR_ARCH_NONE && info->arch != VIR_ARCH_X86_64)
+        qemuTestSetHostArch(driver.caps, VIR_ARCH_NONE);
+
     return ret;
 }
 
@@ -699,13 +705,9 @@ mymain(void)
                                 __VA_ARGS__, ARG_END) < 0) \
             return EXIT_FAILURE; \
         testInfoSetPaths(&info, _suffix); \
-        if (info.arch != VIR_ARCH_NONE && info.arch != VIR_ARCH_X86_64) \
-            qemuTestSetHostArch(driver.caps, info.arch); \
         if (virTestRun("QEMU XML-2-ARGV " _name _suffix, \
                        testCompareXMLToArgv, &info) < 0) \
             ret = -1; \
-        if (info.arch != VIR_ARCH_NONE && info.arch != VIR_ARCH_X86_64) \
-            qemuTestSetHostArch(driver.caps, VIR_ARCH_NONE); \
         testQemuInfoClear(&info); \
     } while (0)