[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[Libguestfs] [PATCH v2 12/14] tools: Convert tools to use the test harness.



---
 generator/tests.ml                  | 10 ++++++
 tools/Makefile.am                   | 16 +++-------
 tools/test-virt-list-filesystems.sh |  2 +-
 tools/test-virt-tar.sh              |  2 +-
 tools/tests.mk                      | 61 +++++++++++++++++++++++++++++++++++++
 5 files changed, 78 insertions(+), 13 deletions(-)
 create mode 100644 tools/tests.mk

diff --git a/generator/tests.ml b/generator/tests.ml
index 9602081..b94a4a8 100644
--- a/generator/tests.ml
+++ b/generator/tests.ml
@@ -649,4 +649,14 @@ let tests = [
       ];
   };
 
+  (* Tools written in Perl. *)
+
+  "tools", {
+    defaults with
+      check = [
+        "test-virt-list-filesystems.sh";
+	"test-virt-tar.sh";
+      ];
+  };
+
 ]
diff --git a/tools/Makefile.am b/tools/Makefile.am
index 40ee410..ddf98ab 100644
--- a/tools/Makefile.am
+++ b/tools/Makefile.am
@@ -17,6 +17,8 @@
 
 include $(top_srcdir)/subdir-rules.mk
 
+generator_built = tests.mk
+
 tools = \
 	list-filesystems \
 	list-partitions \
@@ -27,8 +29,7 @@ tools = \
 CLEANFILES = *.pl
 
 EXTRA_DIST = \
-	$(tools:%=virt-%) \
-	test-virt-*.sh
+	$(tools:%=virt-%)
 
 if HAVE_TOOLS
 
@@ -55,16 +56,9 @@ $(top_builddir)/html/virt-%.1.html: virt-%
 	  --license GPLv2+ \
 	  $<
 
-# Tests.
-
-TESTS_ENVIRONMENT = $(top_builddir)/run --test
-
-if ENABLE_APPLIANCE
-TESTS = test-virt-list-filesystems.sh \
-	test-virt-tar.sh
-endif ENABLE_APPLIANCE
-
 endif
 
 all-local:
 	for f in $(tools:%=tools/virt-%); do echo $$f; done > $(top_srcdir)/po/POTFILES-pl
+
+include $(srcdir)/tests.mk
diff --git a/tools/test-virt-list-filesystems.sh b/tools/test-virt-list-filesystems.sh
index a78f359..125d6d3 100755
--- a/tools/test-virt-list-filesystems.sh
+++ b/tools/test-virt-list-filesystems.sh
@@ -21,7 +21,7 @@ set -e
 
 # Run virt-list-filesystems.
 # Only columns 1 & 2 are guaranteed, we may add more in future.
-if [ "$($srcdir/virt-list-filesystems -l ../tests/guests/fedora.img |
+if [ "$(virt-list-filesystems -l $phonydir/fedora.img |
         sort | awk '{print $1 $2}')" \
     != \
 "/dev/VG/LV1ext2
diff --git a/tools/test-virt-tar.sh b/tools/test-virt-tar.sh
index f363e04..8694d84 100755
--- a/tools/test-virt-tar.sh
+++ b/tools/test-virt-tar.sh
@@ -20,7 +20,7 @@ export LANG=C
 set -e
 
 # Read out the test directory using virt-tar.
-$srcdir/virt-tar -x ../tests/guests/fedora.img /bin test.tar
+virt-tar -x $phonydir/fedora.img /bin test.tar
 
 if [ "$(tar tf test.tar | sort)" != "./
 ./ls
diff --git a/tools/tests.mk b/tools/tests.mk
new file mode 100644
index 0000000..cd4f12f
--- /dev/null
+++ b/tools/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)/tools
+
+localtests_SCRIPTS = \
+	test-virt-list-filesystems.sh \
+	test-virt-tar.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
-- 
2.5.0


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]