--- fish/Makefile.am | 37 ++------------------ fish/test-find0.sh | 4 +-- fish/test-inspect.sh | 2 +- fish/test-mount-local.sh | 9 ++--- fish/test-read-file.sh | 6 ++-- fish/test-run.sh | 2 +- fish/test-upload-to-dir.sh | 2 +- fish/tests.mk | 85 ++++++++++++++++++++++++++++++++++++++++++++++ generator/tests.ml | 31 +++++++++++++++++ 9 files changed, 129 insertions(+), 49 deletions(-) create mode 100644 fish/tests.mk diff --git a/fish/Makefile.am b/fish/Makefile.am index c4b82ae..5b79931 100644 --- a/fish/Makefile.am +++ b/fish/Makefile.am @@ -37,7 +37,8 @@ generator_built = \ guestfish-commands.pod \ guestfish-prepopts.pod \ prepopts.h \ - prepopts.c + prepopts.c \ + tests.mk BUILT_SOURCES = \ $(generator_built) \ @@ -266,39 +267,7 @@ toolsconf_DATA = libguestfs-tools.conf # Tests. -TESTS_ENVIRONMENT = $(top_builddir)/run --test - -TESTS = \ - test-a.sh \ - test-add-domain.sh \ - test-add-uri.sh \ - test-d.sh \ - test-escapes.sh \ - test-events.sh \ - test-invalid-params.sh \ - test-tilde.sh - -if ENABLE_APPLIANCE -TESTS += \ - test-copy.sh \ - test-edit.sh \ - test-file-attrs.sh \ - test-find0.sh \ - test-inspect.sh \ - test-glob.sh \ - test-mount-local.sh \ - test-prep.sh \ - test-read-file.sh \ - test-remote.sh \ - test-remote-events.sh \ - test-reopen.sh \ - test-run.sh \ - test-stringlist.sh \ - test-upload-to-dir.sh -endif - -check-valgrind: - $(MAKE) TESTS="test-a.sh test-add-domain.sh test-add-uri.sh test-copy.sh test-d.sh test-edit.sh test-escapes.sh test-events.sh test-find0.sh test-glob.sh test-inspect.sh test-prep.sh test-read-file.sh test-remote.sh test-remote-events.sh test-reopen.sh test-run.sh test-stringlist.sh test-tilde.sh test-upload-to-dir.sh" VG="$(top_builddir)/run @VG@" check +include $(srcdir)/tests.mk EXTRA_DIST += \ test-a.sh \ diff --git a/fish/test-find0.sh b/fish/test-find0.sh index 07daab3..77ceda7 100755 --- a/fish/test-find0.sh +++ b/fish/test-find0.sh @@ -22,8 +22,8 @@ set -e rm -f test.out -$VG guestfish <<'EOF' -add-ro ../tests/data/test.iso +$VG guestfish <<EOF +add-ro $datadir/test.iso run mount-ro /dev/sda / find0 / test.out diff --git a/fish/test-inspect.sh b/fish/test-inspect.sh index 126740d..363ea50 100755 --- a/fish/test-inspect.sh +++ b/fish/test-inspect.sh @@ -18,4 +18,4 @@ set -e -$VG guestfish -a ../tests/guests/fedora.img -i exit +$VG guestfish -a $phonydir/fedora.img -i exit diff --git a/fish/test-mount-local.sh b/fish/test-mount-local.sh index 0b5804e..952c7d4 100755 --- a/fish/test-mount-local.sh +++ b/fish/test-mount-local.sh @@ -18,11 +18,6 @@ # Test guestfish mount-local / mount-local-run commands. -if [ -n "$SKIP_TEST_MOUNT_LOCAL_SH" ]; then - echo "$0: skipping test because SKIP_TEST_MOUNT_LOCAL_SH is set." - exit 77 -fi - # Skip if no FUSE. test -w /dev/fuse || { @@ -51,7 +46,7 @@ if [ $# -gt 0 -a "$1" = "--run-test" ]; then echo 'mount-local test successful' > test-mount-local-mp/ok # Unmount the mountpoint. - ../fuse/guestunmount test-mount-local-mp + guestunmount test-mount-local-mp exit 0 fi @@ -63,7 +58,7 @@ mkdir test-mount-local-mp if ! guestfish -N test-mount-local.img=fs -m /dev/sda1 2>test-mount-local.errors <<EOF; then mount-local test-mount-local-mp -! $0 --run-test & +! $abs_srcdir/test-mount-local.sh --run-test & mount-local-run # /ok should have been created and left over by the test. diff --git a/fish/test-read-file.sh b/fish/test-read-file.sh index 8f35efb..838853a 100755 --- a/fish/test-read-file.sh +++ b/fish/test-read-file.sh @@ -22,13 +22,13 @@ set -e rm -f test.out -$VG guestfish <<'EOF' > test.out -add-ro ../tests/data/test.iso +$VG guestfish <<EOF > test.out +add-ro $datadir/test.iso run mount-ro /dev/sda / read-file /helloworld.tar EOF -cmp $srcdir/../tests/data/helloworld.tar test.out +cmp $datadir/helloworld.tar test.out rm -f test.out diff --git a/fish/test-run.sh b/fish/test-run.sh index a66ad9c..ed99b7d 100755 --- a/fish/test-run.sh +++ b/fish/test-run.sh @@ -18,4 +18,4 @@ set -e -$VG guestfish -a ../tests/guests/fedora.img run +$VG guestfish -a $phonydir/fedora.img run diff --git a/fish/test-upload-to-dir.sh b/fish/test-upload-to-dir.sh index 0bacd75..996547d 100755 --- a/fish/test-upload-to-dir.sh +++ b/fish/test-upload-to-dir.sh @@ -24,7 +24,7 @@ set -e rm -f test-upload-to-dir.img test-upload-to-dir.out -if $VG guestfish -N test-upload-to-dir.img=fs -m /dev/sda1 upload ../tests/data/test.iso / 2>test-upload-to-dir.out +if $VG guestfish -N test-upload-to-dir.img=fs -m /dev/sda1 upload $datadir/test.iso / 2>test-upload-to-dir.out then echo "$0: expecting guestfish to return an error" exit 1 diff --git a/fish/tests.mk b/fish/tests.mk new file mode 100644 index 0000000..c68fa0b --- /dev/null +++ b/fish/tests.mk @@ -0,0 +1,85 @@ +# 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)/fish + +localtests_SCRIPTS = \ + test-a.sh \ + test-add-domain.sh \ + test-add-uri.sh \ + test-copy.sh \ + test-d.sh \ + test-edit.sh \ + test-escapes.sh \ + test-events.sh \ + test-file-attrs.sh \ + test-find0.sh \ + test-glob.sh \ + test-inspect.sh \ + test-invalid-params.sh \ + test-mount-local.sh \ + test-prep.sh \ + test-read-file.sh \ + test-remote-events.sh \ + test-remote.sh \ + test-reopen.sh \ + test-run.sh \ + test-stringlist.sh \ + test-tilde.sh \ + test-upload-to-dir.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 diff --git a/generator/tests.ml b/generator/tests.ml index fdcf57f..17212c9 100644 --- a/generator/tests.ml +++ b/generator/tests.ml @@ -366,6 +366,37 @@ let tests = [ ]; }; + "fish", { + defaults with + check_fast = [ + "test-a.sh"; + "test-add-domain.sh"; + "test-add-uri.sh"; + "test-d.sh"; + "test-escapes.sh"; + "test-events.sh"; + "test-invalid-params.sh"; + "test-tilde.sh"; + ]; + check = [ + "test-copy.sh"; + "test-edit.sh"; + "test-file-attrs.sh"; + "test-find0.sh"; + "test-inspect.sh"; + "test-glob.sh"; + "test-mount-local.sh"; + "test-prep.sh"; + "test-read-file.sh"; + "test-remote.sh"; + "test-remote-events.sh"; + "test-reopen.sh"; + "test-run.sh"; + "test-stringlist.sh"; + "test-upload-to-dir.sh"; + ]; + }; + "inspector", { defaults with check = [ -- 2.4.3