[libvirt] [PATCH 0/3] libxl: Add a test suite for libxl_domain_config generator

Jim Fehlig jfehlig at suse.com
Mon Jul 31 02:35:56 UTC 2017



On 07/28/2017 05:33 PM, Marek Marczykowski-Górecki wrote:
> On Fri, Jul 28, 2017 at 05:24:10PM -0600, Jim Fehlig wrote:
>> On 07/27/2017 04:51 PM, Marek Marczykowski-Górecki wrote:
>>> On Thu, Jul 27, 2017 at 03:24:38PM -0600, Jim Fehlig wrote:
>>>
>>>> Did you have any comment on the approach taken in the attachments to this
>>>> thread? Particularly the patch titled "libxl: make emulator checks
>>>> mockable"?
>>> I don't see how macros could solve this - those are expanded at
>>> individual files compilation time. And you don't recompile the driver
>>> for tests.
>> Right. I went back to my mocking attempt and thought that I had something working
>>
>> https://www.redhat.com/archives/libvir-list/2017-July/msg01335.html
>>
>> But while testing I forgot to remove my /usr/lib/xen/bin/qemu-system-i386
>> specified in the test files. Once I renamed it, the tests fail with "unsupported
>> configuration: emulator '/usr/lib/xen/bin/qemu-system-i386' not found". So the
>> mocked emulator checks are not called :-(.
>>
>>> Something that could work would be putting those two functions into
>>> separate shared object, then override using LD_PRELOAD or something like
>>> this. But it would require significant change in the driver structure
>>> just for tests. Alternatively something similar could be done by
>>> covering lower level functions (virFileExists, virCommandRun, or even
>>> open, stat etc).
>>> Using /bin/true is much simpler anyway.
>> Unless you spot something obvious in the V2 that I've overlooked, I'm beginning
>> to agree.
> You can override only dynamic symbols this way. If the function is in
> the same object (or even the same shared library), it is resolved at
> link time, not load time.

Yep, understood. I think it is time for you to post your patch using /bin/true
as emulator :-).




More information about the libvir-list mailing list