[Libguestfs] [PATCH 14/16] align, etc.: Convert more virt-* tools to use the test harness.

Richard W.M. Jones rjones at redhat.com
Tue Aug 4 13:20:04 UTC 2015


Use test-harness framework for the following directories:

  align
  diff
  df
  edit
  format
  fuse
  make-fs
  rescue
---
 .gitignore                               |  1 +
 align/Makefile.am                        | 19 ++------
 align/test-virt-alignment-scan-guests.sh |  8 +---
 align/test-virt-alignment-scan.sh        |  2 +-
 align/tests.mk                           | 61 +++++++++++++++++++++++++
 configure.ac                             |  2 +
 df/Makefile.am                           | 22 ++-------
 df/test-virt-df-guests.sh                |  8 +---
 df/test-virt-df-local-guests.sh.in       | 24 ++++++++++
 df/test-virt-df.sh                       |  2 +-
 df/tests.mk                              | 68 ++++++++++++++++++++++++++++
 diff/Makefile.am                         | 15 ++-----
 diff/test-virt-diff.sh                   |  6 +--
 diff/tests.mk                            | 60 +++++++++++++++++++++++++
 edit/Makefile.am                         | 11 ++---
 edit/test-virt-edit.sh                   |  2 +-
 edit/tests.mk                            | 60 +++++++++++++++++++++++++
 format/Makefile.am                       | 15 ++-----
 format/test-virt-format.sh               |  5 ---
 format/tests.mk                          | 60 +++++++++++++++++++++++++
 fuse/Makefile.am                         | 42 ++++++++----------
 fuse/test-fuse-umount-race.sh            | 18 ++------
 fuse/test-fuse.c                         | 11 -----
 fuse/test-guestmount-fd.c                | 39 ++++++++--------
 fuse/test-guestunmount-fd.c              | 18 +-------
 fuse/test-guestunmount-not-mounted.sh    | 12 +----
 fuse/tests.mk                            | 69 +++++++++++++++++++++++++++++
 generator/tests.ml                       | 76 ++++++++++++++++++++++++++++++--
 make-fs/Makefile.am                      | 15 ++-----
 make-fs/test-virt-make-fs.sh             |  5 ---
 make-fs/tests.mk                         | 60 +++++++++++++++++++++++++
 rescue/Makefile.am                       | 19 ++------
 rescue/test-virt-rescue-suggest.sh       |  2 +-
 rescue/test-virt-rescue.pl               |  2 +-
 rescue/tests.mk                          | 61 +++++++++++++++++++++++++
 35 files changed, 675 insertions(+), 225 deletions(-)
 create mode 100644 align/tests.mk
 create mode 100755 df/test-virt-df-local-guests.sh.in
 create mode 100644 df/tests.mk
 create mode 100644 diff/tests.mk
 create mode 100644 edit/tests.mk
 create mode 100644 format/tests.mk
 create mode 100644 fuse/tests.mk
 create mode 100644 make-fs/tests.mk
 create mode 100644 rescue/tests.mk

diff --git a/.gitignore b/.gitignore
index 5bbf80f..361da6d 100644
--- a/.gitignore
+++ b/.gitignore
@@ -117,6 +117,7 @@ Makefile.in
 /daemon/stubs.c
 /depcomp
 /df/stamp-virt-df.pod
+/df/test-virt-df-local-guests.sh
 /df/virt-df
 /df/virt-df.1
 /dib/.depend
diff --git a/align/Makefile.am b/align/Makefile.am
index 92b86b7..e6e8130 100644
--- a/align/Makefile.am
+++ b/align/Makefile.am
@@ -17,9 +17,9 @@
 
 include $(top_srcdir)/subdir-rules.mk
 
+generator_built = tests.mk
+
 EXTRA_DIST = \
-	test-virt-alignment-scan.sh \
-	test-virt-alignment-scan-guests.sh \
 	virt-alignment-scan.pod
 
 CLEANFILES = stamp-virt-alignment-scan.pod
@@ -86,17 +86,4 @@ stamp-virt-alignment-scan.pod: virt-alignment-scan.pod
 	  $<
 	touch $@
 
-# Tests.
-
-TESTS_ENVIRONMENT = $(top_builddir)/run --test
-
-TESTS =
-
-if ENABLE_APPLIANCE
-TESTS += \
-	test-virt-alignment-scan.sh \
-	test-virt-alignment-scan-guests.sh
-endif
-
-check-valgrind:
-	$(MAKE) VG="$(top_builddir)/run @VG@" check
+include $(srcdir)/tests.mk
diff --git a/align/test-virt-alignment-scan-guests.sh b/align/test-virt-alignment-scan-guests.sh
index 99e2585..a013705 100755
--- a/align/test-virt-alignment-scan-guests.sh
+++ b/align/test-virt-alignment-scan-guests.sh
@@ -18,13 +18,7 @@
 
 export LANG=C
 
-if [ -n "$SKIP_TEST_VIRT_ALIGNMENT_SCAN_GUESTS_SH" ]; then
-    echo "$0: skipping test because SKIP_TEST_VIRT_ALIGNMENT_SCAN_GUESTS_SH is set."
-    exit 77
-fi
-
-guestsdir="$(cd ../tests/guests && pwd)"
-libvirt_uri="test://$guestsdir/guests-all-good.xml"
+libvirt_uri="test://$phonydir/guests-all-good.xml"
 
 $VG virt-alignment-scan -c "$libvirt_uri"
 r=$?
diff --git a/align/test-virt-alignment-scan.sh b/align/test-virt-alignment-scan.sh
index 293a9ef..35d7a2e 100755
--- a/align/test-virt-alignment-scan.sh
+++ b/align/test-virt-alignment-scan.sh
@@ -18,7 +18,7 @@
 
 export LANG=C
 
-$VG virt-alignment-scan -a ../tests/guests/fedora.img
+$VG virt-alignment-scan -a $phonydir/fedora.img
 r=$?
 
 # 0, 2 and 3 are reasonable non-error exit codes.  Others are errors.
diff --git a/align/tests.mk b/align/tests.mk
new file mode 100644
index 0000000..6b2afef
--- /dev/null
+++ b/align/tests.mk
@@ -0,0 +1,61 @@
+# 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)/align
+
+localtests_SCRIPTS = \
+	test-virt-alignment-scan-guests.sh \
+	test-virt-alignment-scan.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
+
+EXTRA_DIST += tests.mk
diff --git a/configure.ac b/configure.ac
index 27d1740..174ddc6 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1702,6 +1702,8 @@ 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([df/test-virt-df-local-guests.sh],
+                [chmod +x,-w cat/test-virt-df-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/df/Makefile.am b/df/Makefile.am
index e56ac79..d18a22a 100644
--- a/df/Makefile.am
+++ b/df/Makefile.am
@@ -17,10 +17,10 @@
 
 include $(top_srcdir)/subdir-rules.mk
 
+generator_built = tests.mk
+
 EXTRA_DIST = \
 	README \
-	test-virt-df.sh \
-	test-virt-df-guests.sh \
 	virt-df.pod
 
 CLEANFILES = stamp-virt-df.pod
@@ -89,20 +89,4 @@ stamp-virt-df.pod: virt-df.pod
 	  $<
 	touch $@
 
-# Tests.
-
-TESTS_ENVIRONMENT = $(top_builddir)/run --test
-
-TESTS =
-
-if ENABLE_APPLIANCE
-TESTS += \
-	test-virt-df.sh \
-	test-virt-df-guests.sh
-endif ENABLE_APPLIANCE
-
-check-valgrind:
-	$(MAKE) VG="$(top_builddir)/run @VG@" check
-
-check-valgrind-local-guests:
-	$(top_builddir)/run --test @VG@ ./virt-df -c "$(libvirt_ro_uri)"
+include $(srcdir)/tests.mk
diff --git a/df/test-virt-df-guests.sh b/df/test-virt-df-guests.sh
index b485cd7..78e6f2c 100755
--- a/df/test-virt-df-guests.sh
+++ b/df/test-virt-df-guests.sh
@@ -21,12 +21,6 @@
 export LANG=C
 set -e
 
-if [ -n "$SKIP_TEST_VIRT_DF_GUESTS_SH" ]; then
-    echo "$0: skipping test because SKIP_TEST_DF_GUESTS_SH is set."
-    exit 77
-fi
-
-guestsdir="$(cd ../tests/guests && pwd)"
-libvirt_uri="test://$guestsdir/guests.xml"
+libvirt_uri="test://$phonydir/guests.xml"
 
 $VG virt-df -c "$libvirt_uri"
diff --git a/df/test-virt-df-local-guests.sh.in b/df/test-virt-df-local-guests.sh.in
new file mode 100755
index 0000000..188e52b
--- /dev/null
+++ b/df/test-virt-df-local-guests.sh.in
@@ -0,0 +1,24 @@
+#!/bin/bash -
+# libguestfs
+# Copyright (C) 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.
+
+export LANG=C
+set -e
+
+for g in "$@"; do
+    $VG virt-df -c "@libvirt_ro_uri@"
+done
diff --git a/df/test-virt-df.sh b/df/test-virt-df.sh
index a776c4c..02e5bba 100755
--- a/df/test-virt-df.sh
+++ b/df/test-virt-df.sh
@@ -20,7 +20,7 @@ export LANG=C
 set -e
 
 # Run virt-df.
-output=$($VG virt-df ../tests/guests/fedora.img)
+output=$($VG virt-df $phonydir/fedora.img)
 
 # Check title is the first line.
 if [[ ! $output =~ ^Filesystem.* ]]; then
diff --git a/df/tests.mk b/df/tests.mk
new file mode 100644
index 0000000..da5f0e7
--- /dev/null
+++ b/df/tests.mk
@@ -0,0 +1,68 @@
+# 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)/df
+
+localtests_SCRIPTS = \
+	test-virt-df-guests.sh \
+	test-virt-df-local-guests.sh \
+	test-virt-df.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/diff/Makefile.am b/diff/Makefile.am
index 65a8a30..15bdf03 100644
--- a/diff/Makefile.am
+++ b/diff/Makefile.am
@@ -17,8 +17,9 @@
 
 include $(top_srcdir)/subdir-rules.mk
 
+generator_built = tests.mk
+
 EXTRA_DIST = \
-	test-virt-diff.sh \
 	virt-diff.pod
 
 CLEANFILES = stamp-virt-diff.pod
@@ -75,14 +76,4 @@ stamp-virt-diff.pod: virt-diff.pod
 	  $<
 	touch $@
 
-# Tests.
-
-TESTS_ENVIRONMENT = $(top_builddir)/run --test
-
-if ENABLE_APPLIANCE
-TESTS = \
-	test-virt-diff.sh
-endif ENABLE_APPLIANCE
-
-check-valgrind:
-	$(MAKE) VG="$(top_builddir)/run @VG@" check
+include $(srcdir)/tests.mk
diff --git a/diff/test-virt-diff.sh b/diff/test-virt-diff.sh
index fa13411..9bafa5a 100755
--- a/diff/test-virt-diff.sh
+++ b/diff/test-virt-diff.sh
@@ -19,7 +19,7 @@
 export LANG=C
 set -e
 
-if [ ! -f ../tests/guests/fedora.img ]; then
+if [ ! -f $phonydir/fedora.img ]; then
     echo "$0: test skipped because there is no phony fedora test image"
     exit 77
 fi
@@ -34,14 +34,14 @@ rm -f fedora.qcow2
 # Modify a copy of the image.
 guestfish -- \
   disk-create fedora.qcow2 qcow2 -1 \
-    backingfile:../tests/guests/fedora.img backingformat:raw
+    backingfile:$phonydir/fedora.img backingformat:raw
 
 guestfish -a fedora.qcow2 -i <<EOF
 touch /diff
 write-append /etc/motd "Testing virt-diff\n"
 EOF
 
-output="$($VG virt-diff -a ../tests/guests/fedora.img -A fedora.qcow2)"
+output="$($VG virt-diff -a $phonydir/fedora.img -A fedora.qcow2)"
 
 expected="\
 + - 0644          0 /diff
diff --git a/diff/tests.mk b/diff/tests.mk
new file mode 100644
index 0000000..ec78692
--- /dev/null
+++ b/diff/tests.mk
@@ -0,0 +1,60 @@
+# 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)/diff
+
+localtests_SCRIPTS = \
+	test-virt-diff.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
+
+EXTRA_DIST += tests.mk
diff --git a/edit/Makefile.am b/edit/Makefile.am
index bbb7254..4fe5b56 100644
--- a/edit/Makefile.am
+++ b/edit/Makefile.am
@@ -17,8 +17,9 @@
 
 include $(top_srcdir)/subdir-rules.mk
 
+generator_built = tests.mk
+
 EXTRA_DIST = \
-	test-virt-edit.sh \
 	virt-edit.pod
 
 CLEANFILES = stamp-virt-edit.pod
@@ -78,10 +79,4 @@ stamp-virt-edit.pod: virt-edit.pod
 	  $<
 	touch $@
 
-# Tests.
-
-TESTS_ENVIRONMENT = $(top_builddir)/run --test
-
-if ENABLE_APPLIANCE
-TESTS = test-virt-edit.sh
-endif ENABLE_APPLIANCE
+include $(srcdir)/tests.mk
diff --git a/edit/test-virt-edit.sh b/edit/test-virt-edit.sh
index 810e1c1..f752039 100755
--- a/edit/test-virt-edit.sh
+++ b/edit/test-virt-edit.sh
@@ -30,7 +30,7 @@ rm -f test.qcow2
 # discard it.
 guestfish -- \
   disk-create test.qcow2 qcow2 -1 \
-    backingfile:../tests/guests/fedora.img backingformat:raw
+    backingfile:$phonydir/fedora.img backingformat:raw
 
 # Edit interactively.  We have to simulate this by setting $EDITOR.
 # The command will be: echo newline >> /tmp/file
diff --git a/edit/tests.mk b/edit/tests.mk
new file mode 100644
index 0000000..b021e40
--- /dev/null
+++ b/edit/tests.mk
@@ -0,0 +1,60 @@
+# 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)/edit
+
+localtests_SCRIPTS = \
+	test-virt-edit.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
+
+EXTRA_DIST += tests.mk
diff --git a/format/Makefile.am b/format/Makefile.am
index 276cfc3..887bc9d 100644
--- a/format/Makefile.am
+++ b/format/Makefile.am
@@ -17,6 +17,8 @@
 
 include $(top_srcdir)/subdir-rules.mk
 
+generator_built = tests.mk
+
 EXTRA_DIST = \
 	virt-format.pod
 
@@ -74,15 +76,4 @@ stamp-virt-format.pod: virt-format.pod
 	  $<
 	touch $@
 
-# Tests.
-
-TESTS_ENVIRONMENT = $(top_builddir)/run --test
-
-if ENABLE_APPLIANCE
-TESTS = test-virt-format.sh
-endif ENABLE_APPLIANCE
-
-check-valgrind:
-	$(MAKE) VG="$(top_builddir)/run @VG@" check
-
-EXTRA_DIST += test-virt-format.sh
+include $(srcdir)/tests.mk
diff --git a/format/test-virt-format.sh b/format/test-virt-format.sh
index 2383c71..ecb6d2a 100755
--- a/format/test-virt-format.sh
+++ b/format/test-virt-format.sh
@@ -20,11 +20,6 @@
 
 set -e
 
-if [ -n "$SKIP_TEST_VIRT_FORMAT_SH" ]; then
-    echo "$0: test skipped because environment variable is set."
-    exit 77
-fi
-
 rm -f test-virt-format.img
 
 $VG guestfish -N test-virt-format.img=bootrootlv exit
diff --git a/format/tests.mk b/format/tests.mk
new file mode 100644
index 0000000..f9815ad
--- /dev/null
+++ b/format/tests.mk
@@ -0,0 +1,60 @@
+# 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)/format
+
+localtests_SCRIPTS = \
+	test-virt-format.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
+
+EXTRA_DIST += tests.mk
diff --git a/fuse/Makefile.am b/fuse/Makefile.am
index 318061b..cf50799 100644
--- a/fuse/Makefile.am
+++ b/fuse/Makefile.am
@@ -17,11 +17,11 @@
 
 include $(top_srcdir)/subdir-rules.mk
 
+generator_built = tests.mk
+
 EXTRA_DIST = \
 	guestmount.pod \
-	guestunmount.pod \
-	test-fuse-umount-race.sh \
-	test-guestunmount-not-mounted.sh
+	guestunmount.pod
 
 CLEANFILES = \
 	stamp-guestmount.pod \
@@ -124,25 +124,6 @@ stamp-guestunmount.pod: guestunmount.pod
 	  $<
 	touch $@
 
-# Tests.
-
-TESTS = \
-	test-guestunmount-fd \
-	test-guestunmount-not-mounted.sh
-
-if ENABLE_APPLIANCE
-TESTS += \
-	test-fuse \
-	test-fuse-umount-race.sh \
-	test-guestmount-fd
-endif ENABLE_APPLIANCE
-
-TESTS_ENVIRONMENT = \
-	top_builddir=.. \
-	$(top_builddir)/run --test
-
-check_PROGRAMS = test-fuse test-guestmount-fd test-guestunmount-fd
-
 test_fuse_SOURCES = \
 	test-fuse.c
 
@@ -197,4 +178,19 @@ test_guestunmount_fd_LDADD = \
 	$(LTLIBINTL) \
 	../gnulib/lib/libgnu.la
 
-endif HAVE_FUSE
+else
+
+# Without fuse, generate some dummy test programs.
+test-guestmount-fd:
+	echo 'exit 77' > $@
+	chmod 0755 $@
+test-guestunmount-fd:
+	echo 'exit 77' > $@
+	chmod 0755 $@
+test-fuse:
+	echo 'exit 77' > $@
+	chmod 0755 $@
+
+endif
+
+include $(srcdir)/tests.mk
diff --git a/fuse/test-fuse-umount-race.sh b/fuse/test-fuse-umount-race.sh
index a1f21ae..aeaacf9 100755
--- a/fuse/test-fuse-umount-race.sh
+++ b/fuse/test-fuse-umount-race.sh
@@ -23,22 +23,12 @@ unset CDPATH
 set -e
 #set -v
 
-if [ -n "$SKIP_TEST_FUSE_SH" ]; then
-    echo "$0: test skipped because environment variable is set."
-    exit 77
-fi
-
-if [ -n "$SKIP_TEST_FUSE_UMOUNT_RACE_SH" ]; then
-    echo "$0: test skipped because environment variable is set."
-    exit 77
-fi
-
 if [ ! -w /dev/fuse ]; then
     echo "$0: test skipped because there is no /dev/fuse."
     exit 77
 fi
 
-if [ ! -f ../tests/guests/fedora.img ]; then
+if [ ! -f $phonydir/fedora.img ]; then
     echo "$0: test skipped because fedora.img test guest does not exist."
     exit 77
 fi
@@ -54,10 +44,10 @@ rm -rf mp
 # Make a copy of the Fedora image so we can write to it then discard it.
 guestfish -- \
     disk-create test.qcow2 qcow2 -1 \
-      backingfile:../tests/guests/fedora.img backingformat:raw
+      backingfile:$phonydir/fedora.img backingformat:raw
 
 mkdir mp
-./guestmount -a test.qcow2 -m /dev/VG/Root --pid-file test.pid mp
+guestmount -a test.qcow2 -m /dev/VG/Root --pid-file test.pid mp
 cp $0 mp/test-umount
 
 # Save the PID of guestmount.
@@ -66,7 +56,7 @@ pid="$(cat test.pid)"
 timeout=10
 
 # Unmount the mountpoint.
-./guestunmount -v mp
+guestunmount -v mp
 
 # Wait for guestmount to exit.
 count=$timeout
diff --git a/fuse/test-fuse.c b/fuse/test-fuse.c
index 6e91d71..c1d093b 100644
--- a/fuse/test-fuse.c
+++ b/fuse/test-fuse.c
@@ -68,7 +68,6 @@ static int test_fuse (void);
 int
 main (int argc, char *argv[])
 {
-  const char *s;
   const char *acl_group[] = { "acl", NULL };
   const char *linuxxattrs_group[] = { "linuxxattrs", NULL };
   int debug_calls, r, res;
@@ -76,16 +75,6 @@ main (int argc, char *argv[])
   struct sigaction sa;
   char cmd[128];
 
-  /* Allow the test to be skipped.  Note I'm using the old shell
-   * script name here.
-   */
-  s = getenv ("SKIP_TEST_FUSE_SH");
-  if (s && STRNEQ (s, "")) {
-    printf ("%s: test skipped because environment variable is set\n",
-            argv[0]);
-    exit (77);
-  }
-
   if (access ("/dev/fuse", W_OK) == -1) {
     perror ("/dev/fuse");
     exit (77);
diff --git a/fuse/test-guestmount-fd.c b/fuse/test-guestmount-fd.c
index d6fe12b..8ee44a8 100644
--- a/fuse/test-guestmount-fd.c
+++ b/fuse/test-guestmount-fd.c
@@ -33,39 +33,40 @@
 #include "guestfs.h"
 #include "guestfs-internal-frontend.h"
 
-#define GUESTMOUNT_BINARY "./guestmount"
-#define GUESTUNMOUNT_BINARY "./guestunmount"
-#define TEST_IMAGE "../tests/guests/fedora.img"
+#define GUESTMOUNT_BINARY "guestmount"
+#define GUESTUNMOUNT_BINARY "guestunmount"
+#define TEST_IMAGE "fedora.img"
 #define MOUNTPOINT "test-guestmount-fd.d"
 #define TEST_FILE MOUNTPOINT "/etc/fstab"
 
 int
 main (int argc, char *argv[])
 {
-  char *skip;
+  const char *phonydir;
+  char *test_image;
+  size_t len;
   int pipefd[2];
   pid_t pid;
   char c;
   int r, status;
 
-  /* Allow the test to be skipped. */
-  skip = getenv ("SKIP_TEST_FUSE_SH");
-  if (skip && guestfs_int_is_true (skip) > 0) {
-    fprintf (stderr, "%s: test skipped because environment variable set.\n",
+  phonydir = getenv ("phonydir");
+  if (phonydir == NULL) {
+    fprintf (stderr, "%s: $phonydir was not set by test harness\n",
              guestfs_int_program_name);
-    exit (77);
+    exit (EXIT_FAILURE);
   }
-
-  skip = getenv ("SKIP_TEST_GUESTMOUNT_FD");
-  if (skip && guestfs_int_is_true (skip) > 0) {
-    fprintf (stderr, "%s: test skipped because environment variable set.\n",
-             guestfs_int_program_name);
-    exit (77);
+  len = strlen (phonydir) + strlen (TEST_IMAGE) + 1;
+  test_image = malloc (len+1);
+  if (test_image == NULL) {
+    perror ("malloc");
+    exit (EXIT_FAILURE);
   }
+  snprintf (test_image, len, "%s/%s", phonydir, TEST_IMAGE);
 
   /* Skip the test if the test image can't be found. */
-  if (access (TEST_IMAGE, R_OK) == -1) {
-    perror (TEST_IMAGE);
+  if (access (test_image, R_OK) == -1) {
+    perror (test_image);
     exit (77);
   }
 
@@ -107,7 +108,7 @@ main (int argc, char *argv[])
     execlp (GUESTMOUNT_BINARY,
             "guestmount",
             "--fd", fd_str, "--no-fork",
-            "--ro", "-a", TEST_IMAGE, "-i", MOUNTPOINT, NULL);
+            "--ro", "-a", test_image, "-i", MOUNTPOINT, NULL);
     perror ("execlp");
     _exit (EXIT_FAILURE);
   }
@@ -173,5 +174,7 @@ main (int argc, char *argv[])
 
   ignore_value (rmdir (MOUNTPOINT));
 
+  free (test_image);
+
   exit (EXIT_SUCCESS);
 }
diff --git a/fuse/test-guestunmount-fd.c b/fuse/test-guestunmount-fd.c
index c4b833f..c73fced 100644
--- a/fuse/test-guestunmount-fd.c
+++ b/fuse/test-guestunmount-fd.c
@@ -39,26 +39,10 @@
 int
 main (int argc, char *argv[])
 {
-  char *skip;
   int pipefd[2];
   pid_t pid;
   int r, status;
 
-  /* Allow the test to be skipped. */
-  skip = getenv ("SKIP_TEST_FUSE_SH");
-  if (skip && guestfs_int_is_true (skip) > 0) {
-    fprintf (stderr, "%s: test skipped because environment variable set.\n",
-             guestfs_int_program_name);
-    exit (77);
-  }
-
-  skip = getenv ("SKIP_TEST_GUESTUNMOUNT_FD");
-  if (skip && guestfs_int_is_true (skip) > 0) {
-    fprintf (stderr, "%s: test skipped because environment variable set.\n",
-             guestfs_int_program_name);
-    exit (77);
-  }
-
   /* Create the pipe. */
   if (pipe (pipefd) == -1) {
     perror ("pipe");
@@ -79,7 +63,7 @@ main (int argc, char *argv[])
 
     snprintf (fd_str, sizeof fd_str, "%d", pipefd[0]);
 
-    execlp ("./guestunmount", "guestunmount", "--fd", fd_str, "/", NULL);
+    execlp ("guestunmount", "guestunmount", "--fd", fd_str, "/", NULL);
     perror ("execlp");
     _exit (EXIT_FAILURE);
   }
diff --git a/fuse/test-guestunmount-not-mounted.sh b/fuse/test-guestunmount-not-mounted.sh
index 5e1febe..1d76a13 100755
--- a/fuse/test-guestunmount-not-mounted.sh
+++ b/fuse/test-guestunmount-not-mounted.sh
@@ -24,23 +24,13 @@ unset CDPATH
 #set -e
 #set -v
 
-if [ -n "$SKIP_TEST_FUSE_SH" ]; then
-    echo "$0: test skipped because environment variable is set."
-    exit 77
-fi
-
-if [ -n "$SKIP_TEST_GUESTUNMOUNT_NOT_MOUNTED_SH" ]; then
-    echo "$0: test skipped because environment variable is set."
-    exit 77
-fi
-
 if [ ! -w /dev/fuse ]; then
     echo "SKIPPING guestunmount test, because there is no /dev/fuse."
     exit 77
 fi
 
 # Not expecting cwd to be a FUSE mountpoint.
-./guestunmount --quiet $(pwd)
+guestunmount --quiet $(pwd)
 r=$?
 case $r in
     0)
diff --git a/fuse/tests.mk b/fuse/tests.mk
new file mode 100644
index 0000000..98f08c9
--- /dev/null
+++ b/fuse/tests.mk
@@ -0,0 +1,69 @@
+# 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)/fuse
+
+localtests_SCRIPTS = \
+	test-fuse-umount-race.sh \
+	test-guestunmount-not-mounted.sh
+
+localtests_PROGRAMS = \
+	test-fuse \
+	test-guestmount-fd \
+	test-guestunmount-fd
+
+# 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-fast:
+	$(top_builddir)/run $(top_builddir)/test-harness --fast
+
+EXTRA_DIST += tests.mk
diff --git a/generator/tests.ml b/generator/tests.ml
index 4f664b7..3dc196e 100644
--- a/generator/tests.ml
+++ b/generator/tests.ml
@@ -389,6 +389,14 @@ let tests = [
 
   (* Test tools written in C. *)
 
+  "align", {
+    defaults with
+      check = [
+        "test-virt-alignment-scan.sh";
+	"test-virt-alignment-scan-guests.sh";
+      ];
+  };
+
   "cat", {
     defaults with
       check = [
@@ -402,6 +410,31 @@ let tests = [
       ];
   };
 
+  "diff", {
+    defaults with
+      check = [
+        "test-virt-diff.sh";
+      ];
+  };
+
+  "df", {
+    defaults with
+      check = [
+        "test-virt-df.sh";
+        "test-virt-df-guests.sh";
+      ];
+      check_local_guests = [
+        "test-virt-df-local-guests.sh";
+      ];
+  };
+
+  "edit", {
+    defaults with
+      check = [
+        "test-virt-edit.sh"
+      ];
+  };
+
   "fish", {
     defaults with
       check_fast = [
@@ -433,6 +466,26 @@ let tests = [
       ];
   };
 
+  "format", {
+    defaults with
+      check = [
+        "test-virt-format.sh"
+      ];
+  };
+
+  "fuse", {
+    defaults with
+      check_fast = [
+	"test-guestunmount-fd";
+	"test-guestunmount-not-mounted.sh";
+      ];
+      check = [
+	"test-fuse";
+	"test-fuse-umount-race.sh";
+	"test-guestmount-fd";
+      ];
+  };
+
   "inspector", {
     defaults with
       check = [
@@ -467,11 +520,11 @@ let tests = [
       ]
   };
 
-  "src", {
+  "make-fs", {
     defaults with
-      check_fast = [
-        "test-utils";
-      ]
+      check = [
+        "test-virt-make-fs.sh"
+      ];
   };
 
   "p2v", {
@@ -487,6 +540,21 @@ let tests = [
       ];
   };
 
+  "rescue", {
+    defaults with
+      check = [
+	"test-virt-rescue.pl";
+	"test-virt-rescue-suggest.sh";
+      ];
+  };
+
+  "src", {
+    defaults with
+      check_fast = [
+        "test-utils";
+      ]
+  };
+
   (* Test language bindings. *)
 
   "ocaml", {
diff --git a/make-fs/Makefile.am b/make-fs/Makefile.am
index b88ece0..1e2a887 100644
--- a/make-fs/Makefile.am
+++ b/make-fs/Makefile.am
@@ -17,8 +17,9 @@
 
 include $(top_srcdir)/subdir-rules.mk
 
+generator_built = tests.mk
+
 EXTRA_DIST = \
-	test-virt-make-fs.sh \
 	virt-make-fs.pod
 
 CLEANFILES = stamp-virt-make-fs.pod
@@ -69,14 +70,4 @@ stamp-virt-make-fs.pod: virt-make-fs.pod
 	  $<
 	touch $@
 
-# Tests.
-
-TESTS_ENVIRONMENT = $(top_builddir)/run --test
-
-if ENABLE_APPLIANCE
-TESTS = \
-	test-virt-make-fs.sh
-endif ENABLE_APPLIANCE
-
-check-valgrind:
-	$(MAKE) VG="$(top_builddir)/run @VG@" check
+include $(srcdir)/tests.mk
diff --git a/make-fs/test-virt-make-fs.sh b/make-fs/test-virt-make-fs.sh
index 9897473..38adb5c 100755
--- a/make-fs/test-virt-make-fs.sh
+++ b/make-fs/test-virt-make-fs.sh
@@ -34,11 +34,6 @@ perl -MSys::Guestfs -e '
   $g->feature_available (["btrfs"]) and print "btrfs_available=yes\n";
 ')
 
-# Allow btrfs to be disabled when btrfs is broken (eg. RHBZ#863978).
-if [ -n "$SKIP_TEST_VIRT_MAKE_FS_BTRFS" ]; then
-    btrfs_available=
-fi
-
 # UML backend doesn't support qcow2.
 if [ "$(guestfish get-backend)" != "uml" ]; then
     qcow2_supported=yes
diff --git a/make-fs/tests.mk b/make-fs/tests.mk
new file mode 100644
index 0000000..166549e
--- /dev/null
+++ b/make-fs/tests.mk
@@ -0,0 +1,60 @@
+# 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)/make-fs
+
+localtests_SCRIPTS = \
+	test-virt-make-fs.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
+
+EXTRA_DIST += tests.mk
diff --git a/rescue/Makefile.am b/rescue/Makefile.am
index eab06e9..e215c94 100644
--- a/rescue/Makefile.am
+++ b/rescue/Makefile.am
@@ -17,9 +17,9 @@
 
 include $(top_srcdir)/subdir-rules.mk
 
+generator_built = tests.mk
+
 EXTRA_DIST = \
-	test-virt-rescue.pl \
-	test-virt-rescue-suggest.sh \
 	virt-rescue.pod
 
 CLEANFILES = stamp-virt-rescue.pod
@@ -76,17 +76,4 @@ stamp-virt-rescue.pod: virt-rescue.pod
 	  $<
 	touch $@
 
-# Tests.
-
-TESTS_ENVIRONMENT = $(top_builddir)/run --test
-
-TESTS =
-
-if ENABLE_APPLIANCE
-TESTS += \
-	test-virt-rescue.pl \
-	test-virt-rescue-suggest.sh
-endif ENABLE_APPLIANCE
-
-check-valgrind:
-	$(MAKE) TESTS="test-virt-rescue-suggest.sh" VG="$(top_builddir)/run @VG@" check
+include $(srcdir)/tests.mk
diff --git a/rescue/test-virt-rescue-suggest.sh b/rescue/test-virt-rescue-suggest.sh
index f79e4f8..2e1cf7a 100755
--- a/rescue/test-virt-rescue-suggest.sh
+++ b/rescue/test-virt-rescue-suggest.sh
@@ -19,7 +19,7 @@
 export LANG=C
 set -e
 
-guest=../tests/guests/fedora.img
+guest=$phonydir/fedora.img
 
 if [ ! -s "$guest" ]; then
     echo "$0: test skipped because $guest does not exist or is an empty file"
diff --git a/rescue/test-virt-rescue.pl b/rescue/test-virt-rescue.pl
index 9547fd6..8dea87e 100755
--- a/rescue/test-virt-rescue.pl
+++ b/rescue/test-virt-rescue.pl
@@ -31,7 +31,7 @@ unless (exists $INC{"Expect.pm"}) {
 }
 
 # Run virt-rescue and make sure we get to the rescue prompt.
-my $exp = Expect->spawn ("./virt-rescue", "--scratch")
+my $exp = Expect->spawn ("virt-rescue", "--scratch")
     or die "$progname: Expect could not spawn virt-rescue: $!\n";
 
 my $timeout = 5 * 60;
diff --git a/rescue/tests.mk b/rescue/tests.mk
new file mode 100644
index 0000000..5401a78
--- /dev/null
+++ b/rescue/tests.mk
@@ -0,0 +1,61 @@
+# 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)/rescue
+
+localtests_SCRIPTS = \
+	test-virt-rescue-suggest.sh \
+	test-virt-rescue.pl
+
+# 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
+
+EXTRA_DIST += tests.mk
-- 
2.5.0




More information about the Libguestfs mailing list