[libvirt PATCH 1/4] test: move nodedev xml2xml output to a separate dir

Michal Prívozník mprivozn at redhat.com
Wed May 19 08:46:21 UTC 2021


On 5/14/21 11:28 PM, Jonathon Jongsma wrote:
> Currently, we're loading and parsing the xml from the input file, and
> then formatting it and then comparing it directly back to the input
> file. This works for now, but is severely limiting as it relies on the
> input file being fully-specified and in the exact order as the output
> xml format.
> 
> If optional elements are ommitted in the input XML, the output xml
> may include default values for the ommitted elements and thus the output
> will not match the input.
> 
> In order to allow more flexibility in testing, save the expected output
> to a seprate 'out' directory similar to what most of the other xml2xml
> tests are already doing.
> 
> Signed-off-by: Jonathon Jongsma <jjongsma at redhat.com>
> ---

Fair enough - we have plenty of examples around, qemuxml2xmloutdata/ to
name the biggest one. However, what we also do (to save disk space) is
to turn those files where input XML is the same as output XML into
symlinks. I've identified a few which could be just a symlink:

tests/nodedevxml2xmlout $ for i in *; do if diff $i
../nodedevschemadata/$i >/dev/null ; then echo $i; fi; done
DVD_GCC_4247N.xml
DVD_with_media.xml
ap_07_0038.xml
ap_card07.xml
ap_matrix.xml
ap_matrix_mdev_types.xml
....

I know you are modifying some of these files (mdev*), that's why I ran
the command only after all your patches. For these patches we could make
everything a symlink in 1/4 and then as we need to make changes (in 2/4
and 3/4) remove those symlinks and make regular copies.

Do you think it's worth doing? If so, no need to resend, it's something
I can fix before pushing. Plus marking @outfile variable in
testCompareXMLToXMLHelper() as g_autofree (thanks to Pavel who noticed!).

Patches look good otherwise.

Michal




More information about the libvir-list mailing list