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

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



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 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

Attachment: signature.asc
Description: Digital signature


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