9119d9
From c32465d55a913cf0bd600f34f1cc71ea2ed64f9d Mon Sep 17 00:00:00 2001
9119d9
Message-Id: <c32465d55a913cf0bd600f34f1cc71ea2ed64f9d@dist-git>
9119d9
From: Michal Privoznik <mprivozn@redhat.com>
9119d9
Date: Thu, 18 Sep 2014 11:45:40 +0200
9119d9
Subject: [PATCH] domaincapstest: Run cleanly on systems missing OVMF firmware
9119d9
9119d9
https://bugzilla.redhat.com/show_bug.cgi?id=1026772
9119d9
9119d9
As of f05b6a918e28 the test produces the list of paths that can
9119d9
be passed to <loader/> and libvirt knows about them. However,
9119d9
during the process of generating the list the paths are checked
9119d9
for their presence. This may produce different results on
9119d9
different systems.  Therefore, the path - if missing - is
9119d9
added to pretend it's there.
9119d9
9119d9
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
9119d9
(cherry picked from commit b3f42da6b77644107bcbaf720d7ed9cef5c798a2)
9119d9
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
9119d9
---
9119d9
 tests/domaincapstest.c | 11 +++++++++++
9119d9
 1 file changed, 11 insertions(+)
9119d9
9119d9
diff --git a/tests/domaincapstest.c b/tests/domaincapstest.c
9119d9
index 8543963..067ad4d 100644
9119d9
--- a/tests/domaincapstest.c
9119d9
+++ b/tests/domaincapstest.c
9119d9
@@ -118,6 +118,17 @@ fillQemuCaps(virDomainCapsPtr domCaps,
9119d9
                              VIR_DOMAIN_HOSTDEV_PCI_BACKEND_DEFAULT,
9119d9
                              VIR_DOMAIN_HOSTDEV_PCI_BACKEND_KVM,
9119d9
                              VIR_DOMAIN_HOSTDEV_PCI_BACKEND_VFIO);
9119d9
+
9119d9
+    /* Moreover, as of f05b6a918e28 we are expecting to see
9119d9
+     * OVMF_CODE.fd file which may not exists everywhere. */
9119d9
+    if (!domCaps->os.loader.values.nvalues) {
9119d9
+        virDomainCapsLoaderPtr loader = &domCaps->os.loader;
9119d9
+
9119d9
+        if (fillStringValues(&loader->values,
9119d9
+                             "/usr/share/OVMF/OVMF_CODE.fd",
9119d9
+                             NULL) < 0)
9119d9
+            return -1;
9119d9
+    }
9119d9
     return 0;
9119d9
 }
9119d9
 #endif /* WITH_QEMU */
9119d9
-- 
9119d9
2.1.0
9119d9