Re: [PATCH] tests: Fix qemucapsprobemock linking

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

 



On 05/10/2018 11:13 PM, Martin Kletzander wrote:
> Add libvirt.la into qemucapsprobemock_la_LIBADD because that mock uses bunch of
> libvirt internal functions.  Without this patch the following error occurs:
> 
>   $ ./qemucapsprobe /usr/bin/qemu-system-x86_64
>   ...
>   warning : virQEMUCapsLogProbeFailure:4204 : Failed to probe capabilities for
>   /usr/bin/qemu-system-x86_64: internal error: Failed to probe QEMU binary with
>   QMP: /usr/bin/qemu-system-x86_64: symbol lookup error:
>   .../qemucapsprobemock.so: undefined symbol: virJSONValueObjectHasKey
> 
> Signed-off-by: Martin Kletzander <mkletzan@xxxxxxxxxx>
> ---
> 
> TBH I didn't go into details why this is needed.  It still seems fishy to me.
> Not only that I get that error above as a libvirt error, but if i add just
> libvirt_util.la in there, I get:
> 
>   .../qemucapsprobe: symbol lookup error: .../qemucapsprobemock.so:
>   undefined symbol: libvirt_event_poll_update_handle_semaphore

This is because libvirt_utils is built WITH_DTRACE_PROBES enabled.
Therefore it requires libvirt_probes.lo. So adding these two should be
enough.

However, I'm unable to reproduce this. But what I am able to reproduce is:

  libvirt.git/tests $ ../run valgrind --trace-children=yes ./qemuxml2argvtest

  Missing symbol 'virFileCanonicalizePath'
  Aborted (core dumped)

This points to merely the same problem. In our mocks we are/want to use
our internal APIs. Therefore instead of relying on program that links
with the mock at runtime (VIR_TEST_MAIN_PRELOAD macro) being already
linked with libvirt.so I think we should link our mocks with it:

diff --git i/tests/Makefile.am w/tests/Makefile.am
index 621480dd0c..ac92190845 100644
--- i/tests/Makefile.am
+++ w/tests/Makefile.am
@@ -81,7 +81,8 @@ LDADDS = \
        ../src/libvirt.la
 
 MOCKLIBS_LIBS = \
-       $(GNULIB_LIBS)
+       $(GNULIB_LIBS) \
+       ../src/libvirt.la
 
 EXTRA_DIST = \
        .valgrind.supp \

Michal


P.S. This opened a pandora box for me when I tried running qemucapsprobe
over the latest qemu compiled from git only to find that qemu has a
regression when it does not accept -no-user-config on the command line
anymore. Patch proposed upstream (link not yet available because their
list is very slow).

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[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