[libvirt] [PATCH v5 5/6] tests: Allow comma separate list of libs to preload

Peter Krempa pkrempa at redhat.com
Fri May 20 13:03:06 UTC 2016


On Thu, May 19, 2016 at 16:29:04 -0400, John Ferlan wrote:
> Adjust the model to allow callers to provide a comma separated list
> of libraries to be loaded. For those tests that may need more than
> one mock library loaded.
> 
> Signed-off-by: John Ferlan <jferlan at redhat.com>
> ---
>  tests/testutils.c | 12 ++++++++++--
>  1 file changed, 10 insertions(+), 2 deletions(-)
> 
> diff --git a/tests/testutils.c b/tests/testutils.c
> index 9180e86..69cd77c 100644
> --- a/tests/testutils.c
> +++ b/tests/testutils.c
> @@ -854,8 +854,16 @@ int virtTestMain(int argc,
>      if (getenv("VIR_TEST_FILE_ACCESS"))
>          VIRT_TEST_PRELOAD(TEST_MOCK);
>  
> -    if (lib)
> -        VIRT_TEST_PRELOAD(lib);
> +    if (lib) {
> +        char **liblist;
> +        size_t count = 0;
> +        size_t i;
> +
> +        liblist = virStringSplitCount(lib, ",", 0, &count);
> +        for (i = 0; i < count; i++)
> +            VIRT_TEST_PRELOAD(liblist[i]);

I don't like this very much. I'll try to refactor the chaining of the
mocking libs to prevent re-execing for every single .so you want to
pre-load.

I expect to use a variadic macro for that.

Peter
-------------- 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/20160520/6b5490f4/attachment-0001.sig>


More information about the libvir-list mailing list