summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard W.M. Jones <rjones@redhat.com>2012-11-12 18:26:48 +0000
committerRichard W.M. Jones <rjones@redhat.com>2012-11-13 15:26:29 +0000
commit73631705cfdad72ed4ae8446757dd41c341800dd (patch)
tree3a6b305f271e4dfe3f0ce38f5a0fdfb0edaaa754
parente884abfd06f3f06eab3f8db9843367ab62f7e9e9 (diff)
downloadlibguestfs-73631705cfdad72ed4ae8446757dd41c341800dd.tar.gz
libguestfs-73631705cfdad72ed4ae8446757dd41c341800dd.tar.xz
libguestfs-73631705cfdad72ed4ae8446757dd41c341800dd.zip
inspector: Add some real virt-inspector tests.
-rw-r--r--.gitignore1
-rw-r--r--configure.ac2
-rw-r--r--inspector/Makefile.am11
-rwxr-xr-xinspector/test-virt-inspector.sh30
-rwxr-xr-xinspector/test-xmllint.sh.in29
5 files changed, 68 insertions, 5 deletions
diff --git a/.gitignore b/.gitignore
index 460ca4cb..5fdb2cd6 100644
--- a/.gitignore
+++ b/.gitignore
@@ -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
diff --git a/configure.ac b/configure.ac
index d1c9ca4d..88772605 100644
--- a/configure.ac
+++ b/configure.ac
@@ -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],
diff --git a/inspector/Makefile.am b/inspector/Makefile.am
index 6e209ce4..a72d7f18 100644
--- a/inspector/Makefile.am
+++ b/inspector/Makefile.am
@@ -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
diff --git a/inspector/test-virt-inspector.sh b/inspector/test-virt-inspector.sh
new file mode 100755
index 00000000..517ae1e4
--- /dev/null
+++ b/inspector/test-virt-inspector.sh
@@ -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
diff --git a/inspector/test-xmllint.sh.in b/inspector/test-xmllint.sh.in
new file mode 100755
index 00000000..c156bd2a
--- /dev/null
+++ b/inspector/test-xmllint.sh.in
@@ -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