---
.gitignore | 1 +
cat/Makefile.am | 23 ++-------
cat/test-virt-cat.sh | 4 +-
cat/test-virt-filesystems-local-guests.sh.in | 24 ++++++++++
cat/test-virt-filesystems.sh | 4 +-
cat/test-virt-log.sh | 2 +-
cat/test-virt-ls.sh | 8 ++--
cat/tests.mk | 70 ++++++++++++++++++++++++++++
configure.ac | 2 +
generator/tests.ml | 13 ++++++
10 files changed, 123 insertions(+), 28 deletions(-)
create mode 100755 cat/test-virt-filesystems-local-guests.sh.in
create mode 100644 cat/tests.mk
diff --git a/.gitignore b/.gitignore
index 6dbf1cd..254dcda 100644
--- a/.gitignore
+++ b/.gitignore
@@ -70,6 +70,7 @@ Makefile.in
/builder/virt-index-validate.1
/builder/*.xz
/cat/stamp-virt-*.pod
+/cat/test-virt-filesystems-local-guests.sh
/cat/virt-cat
/cat/virt-cat.1
/cat/virt-filesystems
diff --git a/cat/Makefile.am b/cat/Makefile.am
index d0db6fa..f644cd1 100644
--- a/cat/Makefile.am
+++ b/cat/Makefile.am
@@ -17,10 +17,13 @@
include $(top_srcdir)/subdir-rules.mk
+generator_built = tests.mk
+
EXTRA_DIST = \
test-virt-cat.sh \
virt-cat.pod \
test-virt-filesystems.sh \
+ test-virt-filesystems-local-guests.sh \
virt-filesystems.pod \
test-virt-log.sh \
virt-log.pod \
@@ -189,22 +192,4 @@ stamp-virt-ls.pod: virt-ls.pod
$<
touch $@
-# Tests.
-
-TESTS_ENVIRONMENT = $(top_builddir)/run --test
-
-if ENABLE_APPLIANCE
-TESTS = \
- test-virt-cat.sh \
- test-virt-filesystems.sh \
- test-virt-log.sh \
- test-virt-ls.sh
-endif ENABLE_APPLIANCE
-
-check-valgrind:
- $(MAKE) VG="$(top_builddir)/run @VG@" check
-
-check-valgrind-local-guests:
- for g in $(GUESTS); do \
- $(top_builddir)/run --test @VG@ ./virt-filesystems -c "$(libvirt_ro_uri)" -d
"$$g" --all --long -h --uuid || exit $$?; \
- done
+include $(srcdir)/tests.mk
diff --git a/cat/test-virt-cat.sh b/cat/test-virt-cat.sh
index 0fcd98d..ce70123 100755
--- a/cat/test-virt-cat.sh
+++ b/cat/test-virt-cat.sh
@@ -20,11 +20,11 @@ export LANG=C
set -e
# Read out the test files from the image using virt-cat.
-if [ "$($VG virt-cat ../tests/guests/fedora.img /etc/test1)" !=
"abcdefg" ]; then
+if [ "$($VG virt-cat $phonydir/fedora.img /etc/test1)" != "abcdefg"
]; then
echo "$0: error: mismatch in file test1"
exit 1
fi
-if [ "$($VG virt-cat ../tests/guests/fedora.img /etc/test2)" != "" ];
then
+if [ "$($VG virt-cat $phonydir/fedora.img /etc/test2)" != "" ]; then
echo "$0: error: mismatch in file test2"
exit 1
fi
diff --git a/cat/test-virt-filesystems-local-guests.sh.in
b/cat/test-virt-filesystems-local-guests.sh.in
new file mode 100755
index 0000000..b64089b
--- /dev/null
+++ b/cat/test-virt-filesystems-local-guests.sh.in
@@ -0,0 +1,24 @@
+#!/bin/bash -
+# libguestfs
+# Copyright (C) 2009-2014 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 g in "$@"; do
+ $VG $builddir/virt-filesystems -c "@libvirt_ro_uri@" -d "$g"
--all --long -h --uuid || exit 1
+done
diff --git a/cat/test-virt-filesystems.sh b/cat/test-virt-filesystems.sh
index b2f3b48..a517d76 100755
--- a/cat/test-virt-filesystems.sh
+++ b/cat/test-virt-filesystems.sh
@@ -19,7 +19,7 @@
export LANG=C
set -e
-output="$($VG virt-filesystems -a ../tests/guests/fedora.img | sort)"
+output="$($VG virt-filesystems -a $phonydir/fedora.img | sort)"
expected="/dev/VG/LV1
/dev/VG/LV2
/dev/VG/LV3
@@ -32,7 +32,7 @@ if [ "$output" != "$expected" ]; then
exit 1
fi
-output="$($VG virt-filesystems -a ../tests/guests/fedora.img --all --long --uuid -h
--no-title | awk '{print $1}' | sort -u)"
+output="$($VG virt-filesystems -a $phonydir/fedora.img --all --long --uuid -h
--no-title | awk '{print $1}' | sort -u)"
expected="/dev/VG
/dev/VG/LV1
/dev/VG/LV2
diff --git a/cat/test-virt-log.sh b/cat/test-virt-log.sh
index aff994a..feacefb 100755
--- a/cat/test-virt-log.sh
+++ b/cat/test-virt-log.sh
@@ -35,7 +35,7 @@ can_handle ()
tmpfile=`mktemp`
# Read out the log files from the image using virt-log.
-for f in ../tests/guests/{fedora,debian,ubuntu}.img; do
+for f in $phonydir/{fedora,debian,ubuntu}.img; do
echo "Trying $f ..."
if [ ! -s "$f" ]; then
echo "SKIP: empty file"
diff --git a/cat/test-virt-ls.sh b/cat/test-virt-ls.sh
index 5bb4b8a..23465f4 100755
--- a/cat/test-virt-ls.sh
+++ b/cat/test-virt-ls.sh
@@ -20,7 +20,7 @@ export LANG=C
set -e
# Read out the test directory using virt-ls.
-if [ "$($VG virt-ls ../tests/guests/fedora.img /bin)" != "ls
+if [ "$($VG virt-ls $phonydir/fedora.img /bin)" != "ls
test1
test2
test3
@@ -33,7 +33,7 @@ test7" ]; then
fi
# Try the -lR option.
-output="$($VG virt-ls -lR ../tests/guests/fedora.img /boot | awk '{print $1 $2
$4}')"
+output="$($VG virt-ls -lR $phonydir/fedora.img /boot | awk '{print $1 $2
$4}')"
expected="d0755/boot
d0755/boot/grub
-0644/boot/grub/grub.conf
@@ -49,5 +49,5 @@ if [ "$output" != "$expected" ]; then
fi
# Try the -l and -R options. XXX Should check the output.
-$VG virt-ls -l ../tests/guests/fedora.img /
-$VG virt-ls -R ../tests/guests/fedora.img /
+$VG virt-ls -l $phonydir/fedora.img /
+$VG virt-ls -R $phonydir/fedora.img /
diff --git a/cat/tests.mk b/cat/tests.mk
new file mode 100644
index 0000000..b076f86
--- /dev/null
+++ b/cat/tests.mk
@@ -0,0 +1,70 @@
+# libguestfs generated file
+# WARNING: THIS FILE IS GENERATED FROM:
+# generator/ *.ml
+# ANY CHANGES YOU MAKE TO THIS FILE WILL BE LOST.
+#
+# Copyright (C) 2009-2015 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.
+
+localtestsdir = $(alltestsdir)/cat
+
+localtests_SCRIPTS = \
+ test-virt-cat.sh \
+ test-virt-filesystems-local-guests.sh \
+ test-virt-filesystems.sh \
+ test-virt-log.sh \
+ test-virt-ls.sh
+
+# Note that we cannot create a simple 'check:' target since
+# automake will (silently) overrule it, so we do this instead:
+
+TESTS_ENVIRONMENT = $(top_builddir)/run
+TESTS = $(top_builddir)/test-harness
+
+check-valgrind:
+ $(top_builddir)/run $(top_builddir)/test-harness --valgrind
+
+check-direct:
+ $(top_builddir)/run $(top_builddir)/test-harness --direct
+
+check-valgrind-direct:
+ $(top_builddir)/run $(top_builddir)/test-harness --valgrind --direct
+
+check-libvirt:
+ $(top_builddir)/run $(top_builddir)/test-harness --libvirt
+
+check-valgrind-libvirt:
+ $(top_builddir)/run $(top_builddir)/test-harness --valgrind --libvirt
+
+check-uml:
+ $(top_builddir)/run $(top_builddir)/test-harness --uml
+
+check-valgrind-uml:
+ $(top_builddir)/run $(top_builddir)/test-harness --valgrind --uml
+
+check-with-upstream-qemu:
+ $(top_builddir)/run $(top_builddir)/test-harness --upstream-qemu
+
+check-with-upstream-libvirt:
+ $(top_builddir)/run $(top_builddir)/test-harness --upstream-libvirt
+
+check-local-guests:
+ $(top_builddir)/run $(top_builddir)/test-harness --local-guests
+
+check-valgrind-local-guests:
+ $(top_builddir)/run $(top_builddir)/test-harness --valgrind --local-guests
+
+EXTRA_DIST += tests.mk
diff --git a/configure.ac b/configure.ac
index 8a3f018..f015000 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1700,6 +1700,8 @@ mkdir -p \
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([cat/test-virt-filesystems-local-guests.sh],
+ [chmod +x,-w cat/test-virt-filesystems-local-guests.sh])
AC_CONFIG_FILES([inspector/test-virt-inspector-local-guests.sh],
[chmod +x,-w inspector/test-virt-inspector-local-guests.sh])
AC_CONFIG_FILES([inspector/test-xmllint.sh],
diff --git a/generator/tests.ml b/generator/tests.ml
index 17212c9..f0f2a06 100644
--- a/generator/tests.ml
+++ b/generator/tests.ml
@@ -366,6 +366,19 @@ let tests = [
];
};
+ "cat", {
+ defaults with
+ check = [
+ "test-virt-cat.sh";
+ "test-virt-filesystems.sh";
+ "test-virt-log.sh";
+ "test-virt-ls.sh";
+ ];
+ check_local_guests = [
+ "test-virt-filesystems-local-guests.sh";
+ ];
+ };
+
"fish", {
defaults with
check_fast = [
--
2.4.3