[libvirt] [PATCH] Move the expected output data from virshdata/*.txt into virshtest.c.

Jim Meyering jim at meyering.net
Fri Nov 21 13:09:05 UTC 2008

Daniel Veillard <veillard at redhat.com> wrote:
> On Fri, Nov 21, 2008 at 10:27:55AM +0100, Jim Meyering wrote:
>> Jim Meyering <jim at meyering.net> wrote:
>> > This is mainly just reorganization and factorization, with an eye
>> > towards making it easier to add more tests in virshtest.c later.
>> >
>> >>From 21352a07b073d52bcd3c442c76d7fb985aeef845 Mon Sep 17 00:00:00 2001
>> > From: Jim Meyering <meyering at redhat.com>
>> > Date: Thu, 20 Nov 2008 20:35:57 +0100
>> > Subject: [PATCH] Move the expected output data from virshdata/*.txt into virshtest.c.
>> >
>> > * tests/virshtest.c: Embed literal, expected output here, rather than
>> > using virshdata/*.txt file names.
>> > Factor out some common constructs.
>> > (testCompareOutputLit): New function.
>> > (testCompareOutput): #ifdef-out, not that it's unused.
>> > * tests/Makefile.am (SUBDIRS): Remove virshdata/ and all files in it.
>> > * docs/testnode.xml: Fix typo in a comment.
>> Since I'm removing a directory containing a Makefile.am,
>> I've amended the patch to do this, too:
>>     * configure.in (AC_OUTPUT): Remove tests/virshdata/Makefile.
>   I'm fine with those but wondering a bit how embedding thing in the .c
> makes things any simpler.

My goal was to improve proximity/maintainability.
The more stand-alone and "local" (with all pieces in close proximity)
a test is, the easier it is to add another like it, or to make
adjustments without having to change relatively "distant" pieces.
Now, if I want to change one of those test scenarios, I can do it
by changing that one file.  Well, there are still exceptions:
the initialization files in ../doc/*.xml, but that's not a big deal.

More information about the libvir-list mailing list