[Libguestfs] [PATCH v2] inspector: validate resulting XML files

Richard W.M. Jones rjones at redhat.com
Wed May 3 18:24:04 UTC 2017


On Wed, May 03, 2017 at 03:16:54PM +0200, Pino Toscano wrote:
> Run xmllint to validate the XML output files of virt-inspector, so the
> schema is checked against actual output of virt-inspector.
> ---
>  .gitignore                                                      | 1 +
>  configure.ac                                                    | 2 ++
>  inspector/{test-virt-inspector.sh => test-virt-inspector.sh.in} | 2 ++
>  3 files changed, 5 insertions(+)
>  rename inspector/{test-virt-inspector.sh => test-virt-inspector.sh.in} (92%)
> 
> diff --git a/.gitignore b/.gitignore
> index 152a400..89638f5 100644
> --- a/.gitignore
> +++ b/.gitignore
> @@ -298,6 +298,7 @@ Makefile.in
>  /haskell/Guestfs.hs
>  /inspector/actual-*.xml
>  /inspector/stamp-virt-inspector.pod
> +/inspector/test-virt-inspector.sh
>  /inspector/test-xmllint.sh
>  /inspector/virt-inspector
>  /inspector/virt-inspector.1
> diff --git a/configure.ac b/configure.ac
> index da7653e..a8d8127 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -151,6 +151,8 @@ AC_CONFIG_FILES([appliance/libguestfs-make-fixed-appliance],
>                  [chmod +x,-w appliance/libguestfs-make-fixed-appliance])
>  AC_CONFIG_FILES([inspector/test-xmllint.sh],
>                  [chmod +x,-w inspector/test-xmllint.sh])
> +AC_CONFIG_FILES([inspector/test-virt-inspector.sh],
> +                [chmod +x,-w inspector/test-virt-inspector.sh])
>  AC_CONFIG_FILES([installcheck.sh],
>                  [chmod +x,-w installcheck.sh])
>  AC_CONFIG_FILES([p2v/virt-p2v-make-disk],
> diff --git a/inspector/test-virt-inspector.sh b/inspector/test-virt-inspector.sh.in
> similarity index 92%
> rename from inspector/test-virt-inspector.sh
> rename to inspector/test-virt-inspector.sh.in
> index 2f55cdc..10e5268 100755
> --- a/inspector/test-virt-inspector.sh
> +++ b/inspector/test-virt-inspector.sh.in
> @@ -30,6 +30,8 @@ for f in ../test-data/phony-guests/{debian,fedora,ubuntu,archlinux,coreos,window
>      if [ -s "$f" ]; then
>          b=$(basename "$f" .xml)
>  	$VG virt-inspector --format=raw -a "$f" > "actual-$b.xml"
> +        # Check the generated output validate the schema.
> +        @XMLLINT@ --noout --relaxng "$srcdir/virt-inspector.rng" "actual-$b.xml"
>          # This 'diff' command will fail (because of -e option) if there
>          # are any differences.
>          diff -ur $diff_ignore "expected-$b.xml" "actual-$b.xml"
> -- 
> 2.9.3

ACK

Rich.

-- 
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Read my programming and virtualization blog: http://rwmj.wordpress.com
virt-builder quickly builds VMs from scratch
http://libguestfs.org/virt-builder.1.html




More information about the Libguestfs mailing list