[libvirt] [PATCH 2/3] tests: Need help... Trying to add virRandomBytes mock

Peter Krempa pkrempa at redhat.com
Thu May 19 14:18:19 UTC 2016


On Wed, May 18, 2016 at 19:52:31 -0400, John Ferlan wrote:
> What I'd like to do is merge this and the previous patch together;
> however, I'm missing something (hopefully obvious) with the building
> of the mocked function.
> 
> Since this won't be a qemu specific function, the test wouldn't belong
> in qemuxml2argvmock - rather a separate mock would seemingly have to be
> created and then a separate virrandomtest; however, I'm lost in the
> maze of Makefile magic - so hopefully someone can help... The current
> code works, but generates a nefarious:
> 
> *** Warning: Linking the executable virrandomtest against the loadable module
> *** virrandommock.so is not portable!
> 
> during the build...

diff --git a/tests/Makefile.am b/tests/Makefile.am
index 6ba6c5b..9d1a2ea 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -1085,7 +1085,6 @@ vircryptotest_LDADD = $(LDADDS)
 virrandomtest_SOURCES = \
        virrandomtest.c testutils.h testutils.c
 virrandomtest_LDADD = \
-       virrandommock.la \
        ../src/libvirt.la \
        ../src/libvirt_util.la \
        $(GNULIB_LIBS)
diff --git a/tests/virrandomtest.c b/tests/virrandomtest.c
index 76e187c..bf1f46e 100644
--- a/tests/virrandomtest.c
+++ b/tests/virrandomtest.c
@@ -73,7 +73,7 @@ mymain(void)
     return ret == 0 ? EXIT_SUCCESS : EXIT_FAILURE;
 }

-VIRT_TEST_MAIN(mymain)
+VIRT_TEST_MAIN_PRELOAD(mymain, abs_builddir "/.libs/virrandommock.so")

 #else

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20160519/f6a1347b/attachment-0001.sig>


More information about the libvir-list mailing list