--- generator/tests.ml | 13 +++++++++ p2v/Makefile.am | 18 ++---------- p2v/test-virt-p2v-cmdline.sh | 5 ---- p2v/test-virt-p2v.sh | 12 ++------ p2v/tests.mk | 67 ++++++++++++++++++++++++++++++++++++++++++++ 5 files changed, 86 insertions(+), 29 deletions(-) create mode 100644 p2v/tests.mk diff --git a/generator/tests.ml b/generator/tests.ml index b94a4a8..4f664b7 100644 --- a/generator/tests.ml +++ b/generator/tests.ml @@ -474,6 +474,19 @@ let tests = [ ] }; + "p2v", { + defaults with + check_fast = [ + "test-virt-p2v-cmdline.sh"; + ]; + check = [ + "test-virt-p2v.sh"; + ]; + check_data = [ + "test-virt-p2v-ssh.sh"; + ]; + }; + (* Test language bindings. *) "ocaml", { diff --git a/p2v/Makefile.am b/p2v/Makefile.am index 57efd8d..c05f6f7 100644 --- a/p2v/Makefile.am +++ b/p2v/Makefile.am @@ -17,6 +17,8 @@ include $(top_srcdir)/subdir-rules.mk +generator_built = tests.mk + EXTRA_DIST = \ HACKING \ dependencies.m4 \ @@ -151,18 +153,4 @@ stamp-virt-p2v-make-kickstart.pod: virt-p2v-make-kickstart.pod $< touch $@ -# Tests. - -TESTS_ENVIRONMENT = $(top_builddir)/run --test - -TESTS = \ - test-virt-p2v-cmdline.sh - -if ENABLE_APPLIANCE -TESTS += \ - test-virt-p2v.sh -endif ENABLE_APPLIANCE - -EXTRA_DIST += \ - $(TESTS) \ - test-virt-p2v-ssh.sh +include $(srcdir)/tests.mk diff --git a/p2v/test-virt-p2v-cmdline.sh b/p2v/test-virt-p2v-cmdline.sh index bdd51d3..7f6db93 100755 --- a/p2v/test-virt-p2v-cmdline.sh +++ b/p2v/test-virt-p2v-cmdline.sh @@ -22,11 +22,6 @@ unset CDPATH export LANG=C set -e -if [ -n "$SKIP_TEST_VIRT_P2V_CMDLINE_SH" ]; then - echo "$0: test skipped because environment variable is set" - exit 77 -fi - out=test-virt-p2v-cmdline.out rm -f $out diff --git a/p2v/test-virt-p2v.sh b/p2v/test-virt-p2v.sh index 8c3731c..fe5b389 100755 --- a/p2v/test-virt-p2v.sh +++ b/p2v/test-virt-p2v.sh @@ -22,23 +22,17 @@ unset CDPATH export LANG=C set -e -if [ -n "$SKIP_TEST_VIRT_P2V_SH" ]; then - echo "$0: test skipped because environment variable is set" - exit 77 -fi - if [ "$(guestfish get-backend)" = "uml" ]; then echo "$0: test skipped because UML backend does not support network" exit 77 fi -guestsdir="$(cd ../tests/guests && pwd)" -f1="$guestsdir/windows.img" +f1="$phonydir/windows.img" if ! test -f $f1 || ! test -s $f1; then echo "$0: test skipped because phony Windows image was not created" exit 77 fi -f2="$guestsdir/blank-part.img" +f2="$phonydir/blank-part.img" if ! test -f $f2 || ! test -s $f2; then echo "$0: test skipped because blank-part.img was not created" exit 77 @@ -57,7 +51,7 @@ mkdir $d # We don't want the program under test to run real 'ssh'. It's # unlikely to work. Therefore create a dummy 'ssh' binary. pushd $d -ln -sf ../test-virt-p2v-ssh.sh ssh +ln -sf $srcdir/test-virt-p2v-ssh.sh ssh popd export PATH=$d:$PATH diff --git a/p2v/tests.mk b/p2v/tests.mk new file mode 100644 index 0000000..2093fd9 --- /dev/null +++ b/p2v/tests.mk @@ -0,0 +1,67 @@ +# 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)/p2v + +localtests_DATA = \ + test-virt-p2v-ssh.sh + +localtests_SCRIPTS = \ + test-virt-p2v-cmdline.sh \ + test-virt-p2v.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-fast: + $(top_builddir)/run $(top_builddir)/test-harness --fast + +EXTRA_DIST += tests.mk -- 2.5.0