[libvirt] [PATCH 4/4] Replace daemon-conf test script with a proper test case
Eric Blake
eblake at redhat.com
Fri Apr 6 17:05:02 UTC 2012
On 04/04/2012 08:07 AM, Daniel P. Berrange wrote:
> From: "Daniel P. Berrange" <berrange at redhat.com>
>
> The daemon-conf test script continues to be very fragile to
> changes in libvirt. It currently fails 1 time in 3/4 due
> to race conditions in startup/shutdown of the test script.
>
> Replace it with a proper test case tailored to the code
> being tested
>
> * tests/Makefile.am: Remove daemon-conf, add libvirtdconftest
> * tests/daemon-conf: Delete obsolete test
> * tests/libvirtdconftest.c: Test config file handling
> ---
> tests/Makefile.am | 16 +++-
> tests/daemon-conf | 115 -----------------------
> tests/libvirtdconftest.c | 230 ++++++++++++++++++++++++++++++++++++++++++++++
> 3 files changed, 243 insertions(+), 118 deletions(-)
> delete mode 100755 tests/daemon-conf
> create mode 100644 tests/libvirtdconftest.c
Definitely worth doing!!!
Missing a change to the top-level .gitignore to manage the new test name.
> +
> + if (VIR_ALLOC_N(dataout, dataoutlen) < 0) {
> + virReportOOMError();
> + return NULL;
> + }
> + memcpy(dataout, datain, (eq - datain) + 1);
> + memcpy(dataout + (eq - datain) + 1,
> + replace, strlen(replace));
I might have written this as
strcpy(dataout + (eq - datain) + 1, replace)
for one less pass over replace, but it's not worth the micro-optimization.
> +
> + //VIR_DEBUG("New config [%s]", newdata);
Did you mean to leave this commented?
ACK with the nits fixed.
--
Eric Blake eblake at redhat.com +1-919-301-3266
Libvirt virtualization library http://libvirt.org
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 620 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20120406/46af8263/attachment-0001.sig>
More information about the libvir-list
mailing list