[libvirt] [PATCH] tests: Handle networkxml2argvtest being configure --localstatedir dependant

Eric Blake eblake at redhat.com
Mon Jun 27 13:41:48 UTC 2011


On 06/25/2011 10:10 AM, Matthias Bolte wrote:
> 2011/6/25 Eric Blake <eblake at redhat.com>:
>> On 06/25/2011 06:41 AM, Matthias Bolte wrote:
>>> networkxml2argvtest indirectly calls networkDnsmasqLeaseFileName
>>> that depends on configure --localstatedir. Therefore, the .argv
>>> files used in the test have to be created with this localstatedir.
>>>
>>> Move the .argv to .argv.in files with a @localstatedir@ placeholder.
>>
>> Will this work in VPATH builds?  Previously, we have done hacks where
>> the test directory can provide an override string; if the override is
>> NULL (the default, for use in libvirtd), then use @localstatedir@, but
>> if the override is provided (from the test case), then use that instead.
> 
> Where are we doing that in libvirtd, I can't find something like that.
> 
> Also how would you do that in general? Environment variable?
> LD_PRELOAD to replace networkDnsmasqLeaseFileName for testing
> (assuming that LD_PRELOAD works in this case)?

Function override.  See for example how openvz_conf.h declares
openvzLocateConfFile, which is normally set to
openvzLocateConfFileDefault and uses configure arguments to determine
the string to create, but within tests/openvzutilstest, is overridden to
a test-only variant that hard-codes the location to instead be relative
to the test directory.

That is, the networkDnsmasqLeaseFileName function can easily be reworked
into a function pointer, with the current definition being installed by
default, but with an alternate function pointer installed during the
test that avoids any reference to configure arguments.

-- 
Eric Blake   eblake at redhat.com    +1-801-349-2682
Libvirt virtualization library http://libvirt.org

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 619 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20110627/201694aa/attachment-0001.sig>


More information about the libvir-list mailing list