[PATCH 02/13] qemuxml2argvmock: Drop link time dependency on qemuFDPassDirectNew()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



While Linux linker has no trouble resolving the symbols, valgrind
does. It has probably something to do with the fact that we don't
tell what symbols to export from mock libraries. Anyway, just
resolve the symbol at runtime.

Signed-off-by: Michal Privoznik <mprivozn@xxxxxxxxxx>
---
 tests/qemuxml2argvmock.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/tests/qemuxml2argvmock.c b/tests/qemuxml2argvmock.c
index 9cc97199c4..7bcad7284d 100644
--- a/tests/qemuxml2argvmock.c
+++ b/tests/qemuxml2argvmock.c
@@ -40,6 +40,8 @@
 
 #define VIR_FROM_THIS VIR_FROM_NONE
 
+static qemuFDPassDirect * (*real_qemuFDPassDirectNew)(const char *name, int *fd);
+
 long virGetSystemPageSize(void)
 {
     return 4096;
@@ -212,6 +214,10 @@ qemuInterfaceOpenVhostNet(virDomainObj *vm G_GNUC_UNUSED,
     size_t vhostfdSize = net->driver.virtio.queues;
     size_t i;
 
+    if (!real_qemuFDPassDirectNew) {
+        VIR_MOCK_REAL_INIT(qemuFDPassDirectNew);
+    }
+
     if (!vhostfdSize)
          vhostfdSize = 1;
 
@@ -222,7 +228,7 @@ qemuInterfaceOpenVhostNet(virDomainObj *vm G_GNUC_UNUSED,
         g_autofree char *name = g_strdup_printf("vhostfd-%s%zu", net->info.alias, i);
         int fd = STDERR_FILENO + 42 + i;
 
-        netpriv->vhostfds = g_slist_prepend(netpriv->vhostfds, qemuFDPassDirectNew(name, &fd));
+        netpriv->vhostfds = g_slist_prepend(netpriv->vhostfds, real_qemuFDPassDirectNew(name, &fd));
     }
 
     netpriv->vhostfds = g_slist_reverse(netpriv->vhostfds);
-- 
2.43.2
_______________________________________________
Devel mailing list -- devel@xxxxxxxxxxxxxxxxx
To unsubscribe send an email to devel-leave@xxxxxxxxxxxxxxxxx




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux