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?
Description: PGP signature