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

John Ferlan jferlan at redhat.com
Fri May 20 14:23:13 UTC 2016



On 05/20/2016 09:03 AM, Peter Krempa wrote:
> 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.
> 

OK - I'll wait for that before pushing patch 6 since it depends on it.

John




More information about the libvir-list mailing list