inspector: Add some real virt-inspector tests.

This commit is contained in:
Richard W.M. Jones
2012-11-12 18:26:48 +00:00
parent e884abfd06
commit 73631705cf
5 changed files with 68 additions and 5 deletions

1
.gitignore vendored
View File

@@ -198,6 +198,7 @@ Makefile.in
/html/virt-tar-out.1.html
/html/virt-win-reg.1.html
/inspector/stamp-virt-inspector.pod
/inspector/test-xmllint.sh
/inspector/virt-inspector
/inspector/virt-inspector.1
/install-sh

View File

@@ -1328,6 +1328,8 @@ AC_CONFIG_HEADERS([config.h])
dnl http://www.mail-archive.com/automake@gnu.org/msg10204.html
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([podwrapper.pl],
[chmod +x,-w podwrapper.pl])
AC_CONFIG_FILES([run],

View File

@@ -20,7 +20,7 @@ builddir ?= .
include $(top_srcdir)/subdir-rules.mk
EXAMPLE_XML = \
export EXAMPLE_XML = \
example-debian.xml \
example-fedora.xml \
example-ubuntu.xml \
@@ -36,6 +36,8 @@ EXAMPLE_XML = \
example-windows-xp-cd.xml
EXTRA_DIST = \
test-virt-inspector.sh \
test-xmllint.sh.in \
virt-inspector.pod
CLEANFILES = stamp-virt-inspector.pod
@@ -91,11 +93,10 @@ stamp-virt-inspector.pod: virt-inspector.pod
$<
touch $@
TESTS_ENVIRONMENT = $(top_builddir)/run --test
TESTS = test-virt-inspector.sh
if HAVE_XMLLINT
TESTS = $(EXAMPLE_XML)
TESTS_ENVIRONMENT = $(XMLLINT) --noout --relaxng $(srcdir)/virt-inspector.rng
TESTS += test-xmllint.sh
endif
endif

View File

@@ -0,0 +1,30 @@
#!/bin/bash -
# libguestfs virt-inspector test script
# Copyright (C) 2012 Red Hat Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
export LANG=C
set -e
for f in ../tests/guests/{debian,fedora,ubuntu,windows}.img; do
./virt-inspector -a $f
done
# We could also test this image, but mdadm is problematic for
# many users.
# ./virt-inspector \
# -a ../tests/guests/fedora-md1.img \
# -a ../tests/guests/fedora-md2.img

29
inspector/test-xmllint.sh.in Executable file
View File

@@ -0,0 +1,29 @@
#!/bin/bash -
# @configure_input@
# Copyright (C) 2012 Red Hat Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
export LANG=C
set -e
if [ -z "$EXAMPLE_XML" ]; then
echo "$0: \$EXAMPLE_XML is not defined"
exit 1
fi
for f in $EXAMPLE_XML; do
@XMLLINT@ --noout --relaxng $srcdir/virt-inspector.rng $f
done