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

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




On 05/19/2016 10:18 AM, Peter Krempa wrote:
> 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")
> 

Ah - I see - thanks... I also see that means the Makefile.am can just be
$(LDADDS), too

>

Next problem - how does this then get "into" qemuxml2argvtest?  It
already pulls in qemuxml2argvmock.

I tried messing with virtTestRun to no avail.

I tried to add virrandommock.la in the qemuxml2argvtests LDADD list to
no avail.

Without the not so random number, the xml2argv test I've added fails.

This did work with the virRandomBytes and gnutls_rnd in qemuxml2argvmock

Tks -

John


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