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

2024-05-07 Thread Daniel P . Berrangé
On Mon, May 06, 2024 at 10:42:59AM +0200, Michal Privoznik wrote:
> 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 
> ---
>  tests/qemuxml2argvmock.c | 8 +++-
>  1 file changed, 7 insertions(+), 1 deletion(-)

Reviewed-by: Daniel P. Berrangé 


With regards,
Daniel
-- 
|: https://berrange.com  -o-https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org -o-https://fstop138.berrange.com :|
|: https://entangle-photo.org-o-https://www.instagram.com/dberrange :|
___
Devel mailing list -- devel@lists.libvirt.org
To unsubscribe send an email to devel-le...@lists.libvirt.org


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

2024-05-06 Thread Michal Privoznik
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 
---
 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, ));
+netpriv->vhostfds = g_slist_prepend(netpriv->vhostfds, 
real_qemuFDPassDirectNew(name, ));
 }
 
 netpriv->vhostfds = g_slist_reverse(netpriv->vhostfds);
-- 
2.43.2
___
Devel mailing list -- devel@lists.libvirt.org
To unsubscribe send an email to devel-le...@lists.libvirt.org