[PATCH] tests: Link qemuxml2argvmock with test_utils_lib

Michal Privoznik via Devel posted 1 patch 3 days, 7 hours ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/libvirt tags/patchew/3855d1ce656d21440707639e418a6e3d5f94d280.1779864777.git.mprivozn@redhat.com
tests/meson.build | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
[PATCH] tests: Link qemuxml2argvmock with test_utils_lib
Posted by Michal Privoznik via Devel 3 days, 7 hours ago
From: Michal Privoznik <mprivozn@redhat.com>

When running qemuxmlconftest under valgrind, it fails with a
symbol lookup error:

  valgrind: symbol lookup error: libvirt.git/_build/tests/libqemuxml2argvmock.so: undefined symbol: virTestMakeDummyFD

This occurs because qemuxml2argvmock uses the
virTestMakeDummyFD() function (implemented in testutils.c) but
does not explicitly link against test_utils_lib. Fix this by
linking the test utils library to the mock library, statically.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
---
 tests/meson.build | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tests/meson.build b/tests/meson.build
index 83aa0104bb..d1d26fcea2 100644
--- a/tests/meson.build
+++ b/tests/meson.build
@@ -177,7 +177,7 @@ if conf.has('WITH_QEMU')
     { 'name': 'qemucapsprobemock', 'link_with': [ test_qemu_driver_lib ] },
     { 'name': 'qemucpumock' },
     { 'name': 'qemuhotplugmock', 'link_with': [ test_qemu_driver_lib, test_utils_qemu_lib, test_utils_lib ] },
-    { 'name': 'qemuxml2argvmock' },
+    { 'name': 'qemuxml2argvmock', 'link_with': [ test_utils_lib ] },
     { 'name': 'virhostidmock' },
   ]
 else
-- 
2.53.0
Re: [PATCH] tests: Link qemuxml2argvmock with test_utils_lib
Posted by Peter Krempa via Devel 3 days, 7 hours ago
On Wed, May 27, 2026 at 08:53:03 +0200, Michal Privoznik via Devel wrote:
> From: Michal Privoznik <mprivozn@redhat.com>
> 
> When running qemuxmlconftest under valgrind, it fails with a
> symbol lookup error:
> 
>   valgrind: symbol lookup error: libvirt.git/_build/tests/libqemuxml2argvmock.so: undefined symbol: virTestMakeDummyFD
> 
> This occurs because qemuxml2argvmock uses the
> virTestMakeDummyFD() function (implemented in testutils.c) but
> does not explicitly link against test_utils_lib. Fix this by
> linking the test utils library to the mock library, statically.

Hmm, weirdly enough, on my machine valgrind din't report that error.

Nevertheless this works even on my box so:


> 
> Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
> ---
>  tests/meson.build | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/tests/meson.build b/tests/meson.build
> index 83aa0104bb..d1d26fcea2 100644
> --- a/tests/meson.build
> +++ b/tests/meson.build
> @@ -177,7 +177,7 @@ if conf.has('WITH_QEMU')
>      { 'name': 'qemucapsprobemock', 'link_with': [ test_qemu_driver_lib ] },
>      { 'name': 'qemucpumock' },
>      { 'name': 'qemuhotplugmock', 'link_with': [ test_qemu_driver_lib, test_utils_qemu_lib, test_utils_lib ] },
> -    { 'name': 'qemuxml2argvmock' },
> +    { 'name': 'qemuxml2argvmock', 'link_with': [ test_utils_lib ] },
>      { 'name': 'virhostidmock' },
>    ]
>  else
> -- 
> 2.53.0
> 

Reviewed-by: Peter Krempa <pkrempa@redhat.com>