Re: [PATCH 4/4] Replace daemon-conf test script with a proper test case

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

 



On 04/04/2012 08:07 AM, Daniel P. Berrange wrote:
> From: "Daniel P. Berrange" <berrange@xxxxxxxxxx>
> 
> 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@xxxxxxxxxx    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital 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]