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

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

 



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.
You can obtain list of mockable functions this way:
objdump -T .../libvirt_driver_libxl.so | grep UND

-- 
Best Regards,
Marek Marczykowski-Górecki
Invisible Things Lab
A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?

Attachment: signature.asc
Description: PGP signature

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list

[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]
  Powered by Linux