--- customize/Makefile.am | 16 +++------ customize/test-virt-customize.sh | 2 +- customize/tests.mk | 60 +++++++++++++++++++++++++++++++ generator/tests.ml | 32 +++++++++++++++++ mllib/Makefile.am | 17 +++------ 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 +++++++++++++++++++++++++++++++ 11 files changed, 294 insertions(+), 56 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/customize/Makefile.am b/customize/Makefile.am index 1974b80..dcc1421 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 SOURCES_MLI = \ crypt.mli \ @@ -163,17 +164,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 @@ -193,3 +183,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..f79c51b --- /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-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)/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 66ac296..15ee810 100644 --- a/generator/tests.ml +++ b/generator/tests.ml @@ -493,4 +493,36 @@ let tests = [ ]; }; + (* Test tools written in OCaml. *) + + "mllib", { + defaults with + check_fast = [ + "common_utils_tests"; + "JSON_tests"; + ]; + }; + + "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 272c981..bef33d9 100644 --- a/mllib/Makefile.am +++ b/mllib/Makefile.am @@ -17,6 +17,8 @@ include $(top_srcdir)/subdir-rules.mk +generator_built = tests.mk + EXTRA_DIST = \ $(SOURCES_MLI) \ $(filter-out config.ml libdir.ml,$(SOURCES_ML)) \ @@ -182,21 +184,8 @@ JSON_tests_LINK = \ $(OCAMLFIND) $(BEST) $(OCAMLFLAGS) $(OCAMLPACKAGES) $(OCAMLPACKAGES_TESTS) $(OCAMLLINKFLAGS) \ $(JSON_tests_THEOBJECTS) -o $@ -TESTS_ENVIRONMENT = $(top_builddir)/run --test - -TESTS = -check_PROGRAMS = - -if HAVE_OCAML_PKG_OUNIT -check_PROGRAMS += common_utils_tests JSON_tests -TESTS += common_utils_tests JSON_tests -endif - CLEANFILES += oUnit-* -check-valgrind: - $(MAKE) VG="$(top_builddir)/run @VG@" check - # Dependencies. depend: .depend @@ -216,3 +205,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..0ae0029 --- /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-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)/mllib + +localtests_PROGRAMS = \ + JSON_tests \ + common_utils_tests + +# 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 657b626..773eac4 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_MLI) $(SOURCES_ML) $(SOURCES_C) \ virt-resize.pod \ @@ -127,18 +129,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 @@ -158,3 +148,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..88dd8e0 --- /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-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)/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 98ab729..4e0b8c9 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 \ @@ -120,19 +122,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 @@ -152,3 +141,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 64ead1a..0b86562 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..f375c03 --- /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-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)/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.4.3