---
.gitignore | 3 +-
customize/Makefile.am | 16 +++------
customize/test-virt-customize.sh | 2 +-
customize/tests.mk | 60 +++++++++++++++++++++++++++++++
generator/tests.ml | 32 +++++++++++++++++
mllib/Makefile.am | 30 ++++++++--------
mllib/tests.mk | 64 +++++++++++++++++++++++++++++++++
resize/Makefile.am | 16 +++------
resize/tests.mk | 60 +++++++++++++++++++++++++++++++
sparsify/Makefile.am | 17 +++------
sparsify/test-virt-sparsify-in-place.sh | 5 ---
sparsify/tests.mk | 61 +++++++++++++++++++++++++++++++
12 files changed, 306 insertions(+), 60 deletions(-)
create mode 100644 customize/tests.mk
create mode 100644 mllib/tests.mk
create mode 100644 resize/tests.mk
create mode 100644 sparsify/tests.mk
diff --git a/.gitignore b/.gitignore
index 169a42a..f425bbe 100644
--- a/.gitignore
+++ b/.gitignore
@@ -304,7 +304,8 @@ Makefile.in
/missing
/mllib/.depend
/mllib/common_gettext.ml
-/mllib/common_utils_tests
+/mllib/common_utils_tests.bc
+/mllib/common_utils_tests.opt
/mllib/config.ml
/mllib/dummy
/mllib/libdir.ml
diff --git a/customize/Makefile.am b/customize/Makefile.am
index 39759dc..9a9998a 100644
--- a/customize/Makefile.am
+++ b/customize/Makefile.am
@@ -31,7 +31,8 @@ generator_built = \
customize_cmdline.mli \
customize_cmdline.ml \
customize-options.pod \
- customize-synopsis.pod
+ customize-synopsis.pod \
+ tests.mk
# Alphabetical order.
SOURCES = \
@@ -176,17 +177,6 @@ stamp-virt-customize.pod: virt-customize.pod
$(top_srcdir)/customize/customize-s
$<
touch $@
-# Tests.
-
-TESTS_ENVIRONMENT = $(top_builddir)/run --test
-
-if ENABLE_APPLIANCE
-TESTS = test-virt-customize.sh
-endif
-
-check-valgrind:
- $(MAKE) VG="$(top_builddir)/run @VG@" check
-
# Dependencies.
depend: .depend
@@ -206,3 +196,5 @@ endif
DISTCLEANFILES = .depend
.PHONY: depend docs
+
+include $(srcdir)/tests.mk
diff --git a/customize/test-virt-customize.sh b/customize/test-virt-customize.sh
index 979e6f0..2d17a67 100755
--- a/customize/test-virt-customize.sh
+++ b/customize/test-virt-customize.sh
@@ -22,7 +22,7 @@ set -e
# virt-customize with the -n option doesn't modify the guest. It ought
# to be able to customize any of our Linux-like test guests.
-for f in ../tests/guests/{debian,fedora,ubuntu}.img; do
+for f in $phonydir/{debian,fedora,ubuntu}.img; do
# Ignore zero-sized windows.img if ntfs-3g is not installed.
if [ -s "$f" ]; then
# Add --no-network so UML works.
diff --git a/customize/tests.mk b/customize/tests.mk
new file mode 100644
index 0000000..d08fc67
--- /dev/null
+++ b/customize/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-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.
+
+localtestsdir = $(alltestsdir)/customize
+
+localtests_SCRIPTS = \
+ test-virt-customize.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/generator/tests.ml b/generator/tests.ml
index 78ceb12..ad0ff19 100644
--- a/generator/tests.ml
+++ b/generator/tests.ml
@@ -488,4 +488,36 @@ let tests = [
];
};
+ (* Test tools written in OCaml. *)
+
+ "mllib", {
+ defaults with
+ check_fast = [
+ "common_utils_tests.bc";
+ "common_utils_tests.opt";
+ ];
+ };
+
+ "customize", {
+ defaults with
+ check = [
+ "test-virt-customize.sh"
+ ];
+ };
+
+ "resize", {
+ defaults with
+ check = [
+ "test-virt-resize.pl"
+ ];
+ };
+
+ "sparsify", {
+ defaults with
+ check = [
+ "test-virt-sparsify.sh";
+ "test-virt-sparsify-in-place.sh";
+ ];
+ };
+
]
diff --git a/mllib/Makefile.am b/mllib/Makefile.am
index 2ad4eaa..ba0552d 100644
--- a/mllib/Makefile.am
+++ b/mllib/Makefile.am
@@ -17,10 +17,12 @@
include $(top_srcdir)/subdir-rules.mk
+generator_built = tests.mk
+
EXTRA_DIST = \
$(filter-out config.ml,$(SOURCES))
-CLEANFILES = *~ *.cmi *.cmo *.cmx *.cmxa *.o
+CLEANFILES = *~ *.cmi *.cmo *.cmx *.cmxa *.o *.bc *.opt
# Alphabetical order.
SOURCES = \
@@ -149,25 +151,19 @@ DEFAULT_INCLUDES = \
# Tests.
-check_SCRIPTS = common_utils_tests
-
-if HAVE_OCAMLOPT
-common_utils_tests: common_gettext.cmx tty-c.o tTY.cmx common_utils.cmx
common_utils_tests.cmx
- $(OCAMLFIND) ocamlopt $(OCAMLOPTFLAGS) \
- mlguestfs.cmxa -linkpkg $^ -cclib -lncurses -o $@
-else
-common_utils_tests: common_gettext.cmo tty-c.o tTY.cmo common_utils.cmo
common_utils_tests.cmo
+common_utils_tests.bc: common_gettext.cmo tty-c.o tTY.cmo common_utils.cmo
common_utils_tests.cmo
$(OCAMLFIND) ocamlc $(OCAMLCFLAGS) \
mlguestfs.cma -linkpkg $^ -cclib -lncurses -custom -o $@
+if HAVE_OCAMLOPT
+common_utils_tests.opt: common_gettext.cmx tty-c.o tTY.cmx common_utils.cmx
common_utils_tests.cmx
+ $(OCAMLFIND) ocamlopt $(OCAMLOPTFLAGS) \
+ mlguestfs.cmxa -linkpkg $^ -cclib -lncurses -o $@
+else
+common_utils_tests.opt:
+ echo 'exit 77' > $@
+ chmod 0755 $@
endif
-TESTS_ENVIRONMENT = $(top_builddir)/run --test
-
-TESTS = common_utils_tests
-
-check-valgrind:
- $(MAKE) VG="$(top_builddir)/run @VG@" check
-
# Dependencies.
depend: .depend
@@ -187,3 +183,5 @@ endif
DISTCLEANFILES = .depend
.PHONY: depend docs
+
+include $(srcdir)/tests.mk
diff --git a/mllib/tests.mk b/mllib/tests.mk
new file mode 100644
index 0000000..4459bed
--- /dev/null
+++ b/mllib/tests.mk
@@ -0,0 +1,64 @@
+# libguestfs generated file
+# WARNING: THIS FILE IS GENERATED FROM:
+# generator/ *.ml
+# ANY CHANGES YOU MAKE TO THIS FILE WILL BE LOST.
+#
+# 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.
+
+localtestsdir = $(alltestsdir)/mllib
+
+localtests_SCRIPTS = \
+ common_utils_tests.bc \
+ common_utils_tests.opt
+
+# 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/resize/Makefile.am b/resize/Makefile.am
index 629fa22..028fcb4 100644
--- a/resize/Makefile.am
+++ b/resize/Makefile.am
@@ -17,6 +17,8 @@
include $(top_srcdir)/subdir-rules.mk
+generator_built = tests.mk
+
EXTRA_DIST = \
$(SOURCES) \
virt-resize.pod \
@@ -130,18 +132,6 @@ stamp-virt-resize.pod: virt-resize.pod
CLEANFILES += stamp-virt-resize.pod
-# Tests.
-
-TESTS_ENVIRONMENT = $(top_builddir)/run --test
-
-TESTS =
-if ENABLE_APPLIANCE
-TESTS += test-virt-resize.pl
-endif
-
-check-valgrind:
- $(MAKE) VG="$(top_builddir)/run @VG@" check
-
# Dependencies.
depend: .depend
@@ -161,3 +151,5 @@ endif
DISTCLEANFILES = .depend
.PHONY: depend docs
+
+include $(srcdir)/tests.mk
diff --git a/resize/tests.mk b/resize/tests.mk
new file mode 100644
index 0000000..0c496d1
--- /dev/null
+++ b/resize/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-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.
+
+localtestsdir = $(alltestsdir)/resize
+
+localtests_SCRIPTS = \
+ test-virt-resize.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
diff --git a/sparsify/Makefile.am b/sparsify/Makefile.am
index a7d4166..d9c68ef 100644
--- a/sparsify/Makefile.am
+++ b/sparsify/Makefile.am
@@ -17,6 +17,8 @@
include $(top_srcdir)/subdir-rules.mk
+generator_built = tests.mk
+
EXTRA_DIST = \
$(SOURCES_ML) $(SOURCES_C) \
virt-sparsify.pod \
@@ -118,19 +120,6 @@ stamp-virt-sparsify.pod: virt-sparsify.pod
CLEANFILES += stamp-virt-sparsify.pod
-# Tests.
-
-TESTS_ENVIRONMENT = $(top_builddir)/run --test
-
-if ENABLE_APPLIANCE
-TESTS = \
- test-virt-sparsify.sh \
- test-virt-sparsify-in-place.sh
-endif ENABLE_APPLIANCE
-
-check-valgrind:
- $(MAKE) VG="$(top_builddir)/run @VG@" check
-
# Dependencies.
depend: .depend
@@ -150,3 +139,5 @@ endif
DISTCLEANFILES = .depend
.PHONY: depend docs
+
+include $(srcdir)/tests.mk
diff --git a/sparsify/test-virt-sparsify-in-place.sh
b/sparsify/test-virt-sparsify-in-place.sh
index d085032..f9dbf16 100755
--- a/sparsify/test-virt-sparsify-in-place.sh
+++ b/sparsify/test-virt-sparsify-in-place.sh
@@ -19,11 +19,6 @@
export LANG=C
set -e
-if [ -n "$SKIP_TEST_VIRT_SPARSIFY_IN_PLACE_SH" ]; then
- echo "$0: skipping test (environment variable set)"
- exit 77
-fi
-
if [ "$(guestfish get-backend)" = "uml" ]; then
echo "$0: skipping test because uml backend does not support discard"
exit 77
diff --git a/sparsify/tests.mk b/sparsify/tests.mk
new file mode 100644
index 0000000..57ef959
--- /dev/null
+++ b/sparsify/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-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.
+
+localtestsdir = $(alltestsdir)/sparsify
+
+localtests_SCRIPTS = \
+ test-virt-sparsify-in-place.sh \
+ test-virt-sparsify.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.0.4