diff options
author | Richard W.M. Jones <rjones@redhat.com> | 2011-12-22 11:35:43 +0000 |
---|---|---|
committer | Richard W.M. Jones <rjones@redhat.com> | 2011-12-22 13:04:41 +0000 |
commit | 498758faee6be7e989869bf7feba5e1026a1bb65 (patch) | |
tree | 2c8c599870039286414c7e20d138c91889ca9b05 | |
parent | 5d93d70b4d36b2337104b3dbca07722fa4d47ff5 (diff) | |
download | libguestfs-498758faee6be7e989869bf7feba5e1026a1bb65.tar.gz libguestfs-498758faee6be7e989869bf7feba5e1026a1bb65.tar.xz libguestfs-498758faee6be7e989869bf7feba5e1026a1bb65.zip |
tests: Split regressions -> various subdirectories of tests/
-rw-r--r-- | .gitignore | 11 | ||||
-rw-r--r-- | Makefile.am | 5 | ||||
-rw-r--r-- | configure.ac | 6 | ||||
-rw-r--r-- | daemon/debug.c | 8 | ||||
-rw-r--r-- | fish/Makefile.am | 26 | ||||
-rwxr-xr-x | fish/test-add-domain.sh (renamed from regressions/test-add-domain.sh) | 0 | ||||
-rwxr-xr-x | fish/test-copy.sh (renamed from regressions/test-copy.sh) | 0 | ||||
-rwxr-xr-x | fish/test-find0.sh (renamed from regressions/test-find0.sh) | 0 | ||||
-rwxr-xr-x | fish/test-guestfish-a.sh (renamed from regressions/test-guestfish-a.sh) | 0 | ||||
-rwxr-xr-x | fish/test-guestfish-d.sh (renamed from regressions/test-guestfish-d.sh) | 0 | ||||
-rwxr-xr-x | fish/test-guestfish-escapes.sh (renamed from regressions/test-guestfish-escapes.sh) | 0 | ||||
-rwxr-xr-x | fish/test-guestfish-events.sh (renamed from regressions/test-guestfish-events.sh) | 0 | ||||
-rwxr-xr-x | fish/test-guestfish-tilde.sh (renamed from regressions/test-guestfish-tilde.sh) | 0 | ||||
-rwxr-xr-x | fish/test-read_file.sh (renamed from regressions/test-read_file.sh) | 0 | ||||
-rwxr-xr-x | fish/test-remote.sh (renamed from regressions/test-remote.sh) | 0 | ||||
-rwxr-xr-x | fish/test-reopen.sh (renamed from regressions/test-reopen.sh) | 0 | ||||
-rwxr-xr-x | fish/test-stringlist.sh (renamed from regressions/test-stringlist.sh) | 0 | ||||
-rwxr-xr-x | fish/test-upload-to-dir.sh (renamed from regressions/test-upload-to-dir.sh) | 0 | ||||
-rw-r--r-- | src/guestfs.pod | 9 | ||||
-rw-r--r--[-rwxr-xr-x] | tests/luks/Makefile.am (renamed from regressions/tell-user-to-ignore-errors.sh) | 27 | ||||
-rwxr-xr-x | tests/luks/test-luks-list.sh (renamed from regressions/test-luks-list.sh) | 2 | ||||
-rwxr-xr-x | tests/luks/test-luks.sh (renamed from regressions/test-luks.sh) | 2 | ||||
-rw-r--r--[-rwxr-xr-x] | tests/lvm/Makefile.am (renamed from regressions/test-bootbootboot.sh) | 33 | ||||
-rwxr-xr-x | tests/lvm/test-lvm-filtering.sh (renamed from regressions/test-lvm-filtering.sh) | 2 | ||||
-rwxr-xr-x | tests/lvm/test-lvm-mapping.pl (renamed from regressions/test-lvm-mapping.pl) | 0 | ||||
-rw-r--r-- | tests/md/Makefile.am | 36 | ||||
-rwxr-xr-x | tests/md/test-inspect-fstab-md.sh (renamed from regressions/test-inspect-fstab-md.sh) | 8 | ||||
-rwxr-xr-x | tests/md/test-inspect-fstab.sh (renamed from regressions/test-inspect-fstab.sh) | 4 | ||||
-rwxr-xr-x | tests/md/test-list-filesystems.sh (renamed from regressions/test-list-filesystems.sh) | 2 | ||||
-rwxr-xr-x | tests/md/test-list-md-devices.sh (renamed from regressions/test-list-md-devices.sh) | 4 | ||||
-rwxr-xr-x | tests/md/test-mdadm.sh (renamed from regressions/test-mdadm.sh) | 40 | ||||
-rw-r--r-- | tests/protocol/Makefile.am | 38 | ||||
-rwxr-xr-x | tests/protocol/test-both-ends-cancel.sh (renamed from regressions/test-both-ends-cancel.sh) | 2 | ||||
-rwxr-xr-x | tests/protocol/test-cancellation-download-librarycancels.sh (renamed from regressions/test-cancellation-download-librarycancels.sh) | 2 | ||||
-rwxr-xr-x | tests/protocol/test-cancellation-upload-daemoncancels.sh (renamed from regressions/test-cancellation-upload-daemoncancels.sh) | 2 | ||||
-rwxr-xr-x | tests/protocol/test-launch-race.pl (renamed from regressions/test-launch-race.pl) | 0 | ||||
-rwxr-xr-x | tests/protocol/test-qemudie-killsub.sh (renamed from regressions/test-qemudie-killsub.sh) | 2 | ||||
-rwxr-xr-x | tests/protocol/test-qemudie-launchfail.sh (renamed from regressions/test-qemudie-launchfail.sh) | 2 | ||||
-rwxr-xr-x | tests/protocol/test-qemudie-midcommand.sh (renamed from regressions/test-qemudie-midcommand.sh) | 2 | ||||
-rwxr-xr-x | tests/protocol/test-qemudie-synch.sh (renamed from regressions/test-qemudie-synch.sh) | 2 | ||||
-rwxr-xr-x | tests/qemu/qemu-snapshot-isolation.sh | 2 | ||||
-rw-r--r-- | tests/regressions/Makefile.am (renamed from regressions/Makefile.am) | 44 | ||||
-rw-r--r-- | tests/regressions/rhbz501893.c (renamed from regressions/rhbz501893.c) | 0 | ||||
-rwxr-xr-x | tests/regressions/rhbz503169c13.sh (renamed from regressions/rhbz503169c13.sh) | 2 | ||||
-rw-r--r-- | tests/regressions/rhbz557655-expected.stderr (renamed from regressions/rhbz557655-expected.stderr) | 0 | ||||
-rw-r--r-- | tests/regressions/rhbz557655-expected.stdout (renamed from regressions/rhbz557655-expected.stdout) | 0 | ||||
-rwxr-xr-x | tests/regressions/rhbz557655.sh (renamed from regressions/rhbz557655.sh) | 4 | ||||
-rwxr-xr-x | tests/regressions/rhbz576879.sh (renamed from regressions/rhbz576879.sh) | 2 | ||||
-rwxr-xr-x | tests/regressions/rhbz578407.sh (renamed from regressions/rhbz578407.sh) | 2 | ||||
-rwxr-xr-x | tests/regressions/rhbz580246.sh (renamed from regressions/rhbz580246.sh) | 2 | ||||
-rwxr-xr-x | tests/regressions/rhbz602997.sh (renamed from regressions/rhbz602997.sh) | 2 | ||||
-rwxr-xr-x | tests/regressions/rhbz690819.sh (renamed from regressions/rhbz690819.sh) | 2 | ||||
-rwxr-xr-x | tests/regressions/rhbz727178.sh (renamed from regressions/rhbz727178.sh) | 2 | ||||
-rwxr-xr-x | tests/regressions/test-noexec-stack.pl (renamed from regressions/test-noexec-stack.pl) | 0 |
54 files changed, 203 insertions, 138 deletions
@@ -1,5 +1,9 @@ *~ *.a +test1.img +test2.img +test.err +test.out ABOUT-NLS aclocal.m4 align/stamp-virt-alignment-scan.pod @@ -294,11 +298,6 @@ python/examples/stamp-guestfs-python.pod python/guestfs.py python/guestfs-py.c python/guestfs.pyc -regressions/rhbz501893 -regressions/test1.img -regressions/test2.img -regressions/test.err -regressions/test.out rescue/stamp-virt-rescue.pod rescue/virt-rescue rescue/virt-rescue.1 @@ -340,7 +339,6 @@ src/libguestfs.syms src/stamp-guestfs.pod *.swp stamp-h1 -test1.img test-tool/libguestfs-test-tool test-tool/libguestfs-test-tool.1 test-tool/libguestfs-test-tool-helper @@ -359,6 +357,7 @@ tests/c-api/test*.img tests/c-api/tests tests/c-api/tests.c tests/c-api/test*.tmp +tests/regressions/rhbz501893 tools/test.img tools/virt-*.1 tools/virt-*.pl diff --git a/Makefile.am b/Makefile.am index 5c8ff677..31da8755 100644 --- a/Makefile.am +++ b/Makefile.am @@ -30,7 +30,10 @@ SUBDIRS += appliance endif # Tests and the test-tool. -SUBDIRS += gnulib/tests tests/c-api tests/qemu regressions extratests test-tool +SUBDIRS += gnulib/tests tests/c-api tests/qemu +SUBDIRS += tests/protocol tests/lvm tests/luks tests/md +SUBDIRS += tests/regressions +SUBDIRS += extratests test-tool # Guestfish. SUBDIRS += fish diff --git a/configure.ac b/configure.ac index ac09844e..33d2aea1 100644 --- a/configure.ac +++ b/configure.ac @@ -1041,7 +1041,6 @@ AC_CONFIG_FILES([Makefile po/Makefile.in python/Makefile python/examples/Makefile - regressions/Makefile rescue/Makefile resize/Makefile ruby/Makefile @@ -1051,7 +1050,12 @@ AC_CONFIG_FILES([Makefile src/Makefile test-tool/Makefile tests/c-api/Makefile + tests/luks/Makefile + tests/lvm/Makefile + tests/md/Makefile + tests/protocol/Makefile tests/qemu/Makefile + tests/regressions/Makefile tools/Makefile]) AC_OUTPUT diff --git a/daemon/debug.c b/daemon/debug.c index bb91c9ef..31cef465 100644 --- a/daemon/debug.c +++ b/daemon/debug.c @@ -280,7 +280,9 @@ debug_env (const char *subcmd, int argc, char *const *const argv) return out; } -/* Return binaries in the appliance. See regressions/rhbz727178.sh */ +/* Return binaries in the appliance. + * See tests/regressions/rhbz727178.sh + */ static char * debug_binaries (const char *subcmd, int argc, char *const *const argv) { @@ -306,7 +308,9 @@ debug_binaries (const char *subcmd, int argc, char *const *const argv) return out; } -/* Run 'ldd' on a file from the appliance. See regressions/rhbz727178.sh */ +/* Run 'ldd' on a file from the appliance. + * See tests/regressions/rhbz727178.sh + */ static char * debug_ldd (const char *subcmd, int argc, char *const *const argv) { diff --git a/fish/Makefile.am b/fish/Makefile.am index c940c2b8..2624a7d5 100644 --- a/fish/Makefile.am +++ b/fish/Makefile.am @@ -45,6 +45,7 @@ BUILT_SOURCES = \ EXTRA_DIST = \ $(BUILT_SOURCES) \ + $(TESTS) \ rc_protocol.x \ guestfish.pod \ guestfish-bash-completion.sh \ @@ -226,3 +227,28 @@ toolsconf_DATA = libguestfs-tools.conf bashcompletiondir = $(sysconfdir)/bash_completion.d bashcompletion_DATA = guestfish-bash-completion.sh + +# Tests. + +random_val := $(shell awk 'BEGIN{srand(); print 1+int(255*rand())}' < /dev/null) + +TESTS_ENVIRONMENT = \ + MALLOC_PERTURB_=$(random_val) \ + LD_LIBRARY_PATH=$(top_builddir)/src/.libs \ + LIBGUESTFS_PATH=$(top_builddir)/appliance \ + TMPDIR=$(top_builddir) + +TESTS = \ + test-add-domain.sh \ + test-copy.sh \ + test-find0.sh \ + test-guestfish-a.sh \ + test-guestfish-d.sh \ + test-guestfish-escapes.sh \ + test-guestfish-events.sh \ + test-guestfish-tilde.sh \ + test-read_file.sh \ + test-remote.sh \ + test-reopen.sh \ + test-stringlist.sh \ + test-upload-to-dir.sh diff --git a/regressions/test-add-domain.sh b/fish/test-add-domain.sh index 6154a758..6154a758 100755 --- a/regressions/test-add-domain.sh +++ b/fish/test-add-domain.sh diff --git a/regressions/test-copy.sh b/fish/test-copy.sh index ea6a4cc5..ea6a4cc5 100755 --- a/regressions/test-copy.sh +++ b/fish/test-copy.sh diff --git a/regressions/test-find0.sh b/fish/test-find0.sh index 726469c1..726469c1 100755 --- a/regressions/test-find0.sh +++ b/fish/test-find0.sh diff --git a/regressions/test-guestfish-a.sh b/fish/test-guestfish-a.sh index 4fd45f73..4fd45f73 100755 --- a/regressions/test-guestfish-a.sh +++ b/fish/test-guestfish-a.sh diff --git a/regressions/test-guestfish-d.sh b/fish/test-guestfish-d.sh index 41f16094..41f16094 100755 --- a/regressions/test-guestfish-d.sh +++ b/fish/test-guestfish-d.sh diff --git a/regressions/test-guestfish-escapes.sh b/fish/test-guestfish-escapes.sh index 73f41d5f..73f41d5f 100755 --- a/regressions/test-guestfish-escapes.sh +++ b/fish/test-guestfish-escapes.sh diff --git a/regressions/test-guestfish-events.sh b/fish/test-guestfish-events.sh index ad6fefe4..ad6fefe4 100755 --- a/regressions/test-guestfish-events.sh +++ b/fish/test-guestfish-events.sh diff --git a/regressions/test-guestfish-tilde.sh b/fish/test-guestfish-tilde.sh index aed44311..aed44311 100755 --- a/regressions/test-guestfish-tilde.sh +++ b/fish/test-guestfish-tilde.sh diff --git a/regressions/test-read_file.sh b/fish/test-read_file.sh index cd016e30..cd016e30 100755 --- a/regressions/test-read_file.sh +++ b/fish/test-read_file.sh diff --git a/regressions/test-remote.sh b/fish/test-remote.sh index ff5b85ad..ff5b85ad 100755 --- a/regressions/test-remote.sh +++ b/fish/test-remote.sh diff --git a/regressions/test-reopen.sh b/fish/test-reopen.sh index 321f2a02..321f2a02 100755 --- a/regressions/test-reopen.sh +++ b/fish/test-reopen.sh diff --git a/regressions/test-stringlist.sh b/fish/test-stringlist.sh index 1aa953bc..1aa953bc 100755 --- a/regressions/test-stringlist.sh +++ b/fish/test-stringlist.sh diff --git a/regressions/test-upload-to-dir.sh b/fish/test-upload-to-dir.sh index 41ce5e5a..41ce5e5a 100755 --- a/regressions/test-upload-to-dir.sh +++ b/fish/test-upload-to-dir.sh diff --git a/src/guestfs.pod b/src/guestfs.pod index 45f63297..85760659 100644 --- a/src/guestfs.pod +++ b/src/guestfs.pod @@ -2737,8 +2737,9 @@ the OCaml description. You can supply zero or as many tests as you want per API call. The tests can either be added as part of the API description (C<generator/generator_actions.ml>), or in some rarer cases you may -want to drop a script into C<regressions/>. Note that adding a script -to C<regressions/> is slower, so if possible use the first method. +want to drop a script into C<tests/*/>. Note that adding +a script to C<tests/*/> is slower, so if possible use the +first method. The following describes the test environment used when you add an API test in C<generator_actions.ml>. @@ -2996,10 +2997,6 @@ The build infrastructure and PO files for translations of manpages and POD files. Eventually this will be combined with the C<po> directory, but that is rather complicated. -=item C<regressions> - -Regression tests. - =item C<rescue> L<virt-rescue(1)> command and documentation. diff --git a/regressions/tell-user-to-ignore-errors.sh b/tests/luks/Makefile.am index 65642888..2bc21eda 100755..100644 --- a/regressions/tell-user-to-ignore-errors.sh +++ b/tests/luks/Makefile.am @@ -1,6 +1,5 @@ -#!/bin/bash - # libguestfs -# Copyright (C) 2010 Red Hat Inc. +# Copyright (C) 2009-2011 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 @@ -16,11 +15,19 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -echo -echo '*****' -echo -echo 'Some of these tests print error messages. You can ignore' -echo 'these error messages as long as the tests print "PASS".' -echo -echo '*****' -echo +include $(top_srcdir)/subdir-rules.mk + +TESTS = \ + test-luks.sh \ + test-luks-list.sh + +random_val := $(shell awk 'BEGIN{srand(); print 1+int(255*rand())}' < /dev/null) + +TESTS_ENVIRONMENT = \ + MALLOC_PERTURB_=$(random_val) \ + LD_LIBRARY_PATH=$(top_builddir)/src/.libs \ + LIBGUESTFS_PATH=$(top_builddir)/appliance \ + TMPDIR=$(top_builddir) + +EXTRA_DIST = \ + $(TESTS) diff --git a/regressions/test-luks-list.sh b/tests/luks/test-luks-list.sh index 9385a4c8..80ff6e7a 100755 --- a/regressions/test-luks-list.sh +++ b/tests/luks/test-luks-list.sh @@ -27,7 +27,7 @@ set -e rm -f test1.img test.output -../fish/guestfish --keys-from-stdin > test.output <<'EOF' +../../fish/guestfish --keys-from-stdin > test.output <<'EOF' sparse test1.img 1G run part-init /dev/sda mbr diff --git a/regressions/test-luks.sh b/tests/luks/test-luks.sh index fcf9d709..a9edca0c 100755 --- a/regressions/test-luks.sh +++ b/tests/luks/test-luks.sh @@ -27,7 +27,7 @@ set -e rm -f test1.img -../fish/guestfish --keys-from-stdin <<EOF +../../fish/guestfish --keys-from-stdin <<EOF sparse test1.img 1G run part-disk /dev/sda mbr diff --git a/regressions/test-bootbootboot.sh b/tests/lvm/Makefile.am index 476cfdbe..290f6b3d 100755..100644 --- a/regressions/test-bootbootboot.sh +++ b/tests/lvm/Makefile.am @@ -1,6 +1,5 @@ -#!/bin/bash - # libguestfs -# Copyright (C) 2009 Red Hat Inc. +# Copyright (C) 2009-2011 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 @@ -16,25 +15,19 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -# Some versions of qemu can be flakey and can hang occasionally -# during boot (particularly KVM if the BIOS is the qemu version -# which doesn't have the required KVM patches). Test repeatedly -# booting. +include $(top_srcdir)/subdir-rules.mk -set -e +TESTS = \ + test-lvm-filtering.sh \ + test-lvm-mapping.pl -rm -f test1.img +random_val := $(shell awk 'BEGIN{srand(); print 1+int(255*rand())}' < /dev/null) -n=10 -if [ -n "$1" ]; then n=$1; fi +TESTS_ENVIRONMENT = \ + MALLOC_PERTURB_=$(random_val) \ + LD_LIBRARY_PATH=$(top_builddir)/src/.libs \ + LIBGUESTFS_PATH=$(top_builddir)/appliance \ + TMPDIR=$(top_builddir) -export LIBGUESTFS_DEBUG=1 - -for i in $(seq 1 $n); do - echo Test boot $i of $n ... - ../fish/guestfish -N disk </dev/null -done - -rm test1.img - -echo Test boot completed after $n iterations. +EXTRA_DIST = \ + $(TESTS) diff --git a/regressions/test-lvm-filtering.sh b/tests/lvm/test-lvm-filtering.sh index 7644bbe1..d5ae8d50 100755 --- a/regressions/test-lvm-filtering.sh +++ b/tests/lvm/test-lvm-filtering.sh @@ -22,7 +22,7 @@ set -e rm -f test1.img test2.img -actual=$(../fish/guestfish <<'EOF' +actual=$(../../fish/guestfish <<'EOF' sparse test1.img 1G sparse test2.img 1G diff --git a/regressions/test-lvm-mapping.pl b/tests/lvm/test-lvm-mapping.pl index 3e6faa5e..3e6faa5e 100755 --- a/regressions/test-lvm-mapping.pl +++ b/tests/lvm/test-lvm-mapping.pl diff --git a/tests/md/Makefile.am b/tests/md/Makefile.am new file mode 100644 index 00000000..c778956f --- /dev/null +++ b/tests/md/Makefile.am @@ -0,0 +1,36 @@ +# libguestfs +# Copyright (C) 2009-2011 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. + +include $(top_srcdir)/subdir-rules.mk + +TESTS = \ + test-inspect-fstab.sh \ + test-inspect-fstab-md.sh \ + test-list-filesystems.sh \ + test-list-md-devices.sh \ + test-mdadm.sh + +random_val := $(shell awk 'BEGIN{srand(); print 1+int(255*rand())}' < /dev/null) + +TESTS_ENVIRONMENT = \ + MALLOC_PERTURB_=$(random_val) \ + LD_LIBRARY_PATH=$(top_builddir)/src/.libs \ + LIBGUESTFS_PATH=$(top_builddir)/appliance \ + TMPDIR=$(top_builddir) + +EXTRA_DIST = \ + $(TESTS)
\ No newline at end of file diff --git a/regressions/test-inspect-fstab-md.sh b/tests/md/test-inspect-fstab-md.sh index da163fc0..2a6cb6a9 100755 --- a/regressions/test-inspect-fstab-md.sh +++ b/tests/md/test-inspect-fstab-md.sh @@ -24,19 +24,19 @@ export LANG=C # The first test requires a new Augeas lens for parsing mdadm.conf. # If this is not present in the appliance or on the host, skip the # test. -f=$(grep mdadm_conf.aug ../appliance/supermin.d/hostfiles | head -1) +f=$(grep mdadm_conf.aug ../../appliance/supermin.d/hostfiles | head -1) if [ -z "$f" -o ! -f "$f" ]; then echo "$0: test skipped because Augeas mdadm.conf lens is not available." exit 0 fi -guestfish=../fish/guestfish +guestfish=../../fish/guestfish rm -f test1.img test.fstab test.output # First, test the regular fedora image, which specifies /boot as /dev/md0 -cp ../images/fedora-md1.img test1.img -cp ../images/fedora-md2.img test2.img +cp ../../images/fedora-md1.img test1.img +cp ../../images/fedora-md2.img test2.img $guestfish -i test[12].img <<'EOF' | sort > test.output exists /boot/grub/grub.conf diff --git a/regressions/test-inspect-fstab.sh b/tests/md/test-inspect-fstab.sh index 332cde0c..72a11fad 100755 --- a/regressions/test-inspect-fstab.sh +++ b/tests/md/test-inspect-fstab.sh @@ -22,13 +22,13 @@ set -e export LANG=C -guestfish=../fish/guestfish +guestfish=../../fish/guestfish rm -f test1.img test.fstab test.output # Start with the regular (good) fedora image, modify /etc/fstab # and then inspect it. -cp ../images/fedora.img test1.img +cp ../../images/fedora.img test1.img cat <<'EOF' > test.fstab /dev/VG/Root / ext2 default 0 0 diff --git a/regressions/test-list-filesystems.sh b/tests/md/test-list-filesystems.sh index 353cdd0b..9aea21a0 100755 --- a/regressions/test-list-filesystems.sh +++ b/tests/md/test-list-filesystems.sh @@ -31,7 +31,7 @@ set -e # vg0 : 16M LV (lv0) # lv0 : 16M vfat output=$( -../fish/guestfish <<EOF +../../fish/guestfish <<EOF # Add 2 empty disks sparse fs-test1.img 50M sparse fs-test2.img 50M diff --git a/regressions/test-list-md-devices.sh b/tests/md/test-list-md-devices.sh index 0216ca95..99283be5 100755 --- a/regressions/test-list-md-devices.sh +++ b/tests/md/test-list-md-devices.sh @@ -21,7 +21,7 @@ set -e output=$( -../fish/guestfish <<EOF +../../fish/guestfish <<EOF # Add 2 empty disks sparse md-test1.img 100M sparse md-test2.img 100M @@ -44,7 +44,7 @@ fi # Ensure list-md-devices now returns the newly created md device output=$( -../fish/guestfish -a md-test1.img -a md-test2.img <<EOF +../../fish/guestfish -a md-test1.img -a md-test2.img <<EOF run list-md-devices EOF diff --git a/regressions/test-mdadm.sh b/tests/md/test-mdadm.sh index 7314ca56..e7f5775a 100755 --- a/regressions/test-mdadm.sh +++ b/tests/md/test-mdadm.sh @@ -22,7 +22,7 @@ set -e rm -f md-test1.img md-test2.img md-test3.img md-test4.img -../fish/guestfish <<EOF +../../fish/guestfish <<EOF # Add four empty disks sparse md-test1.img 100M sparse md-test2.img 100M @@ -92,15 +92,15 @@ write /r5t3/baz "testing" EOF -eval `../fish/guestfish --listen` -../fish/guestfish --remote add-ro md-test1.img -../fish/guestfish --remote add-ro md-test2.img -../fish/guestfish --remote add-ro md-test3.img -../fish/guestfish --remote add-ro md-test4.img -../fish/guestfish --remote run +eval `../../fish/guestfish --listen` +../../fish/guestfish --remote add-ro md-test1.img +../../fish/guestfish --remote add-ro md-test2.img +../../fish/guestfish --remote add-ro md-test3.img +../../fish/guestfish --remote add-ro md-test4.img +../../fish/guestfish --remote run -for md in `../fish/guestfish --remote list-md-devices`; do - ../fish/guestfish --remote md-detail "${md}" > md-detail.out +for md in `../../fish/guestfish --remote list-md-devices`; do + ../../fish/guestfish --remote md-detail "${md}" > md-detail.out sed 's/:\s*/=/' md-detail.out > md-detail.out.sh . md-detail.out.sh @@ -143,24 +143,24 @@ for md in `../fish/guestfish --remote list-md-devices`; do if [ "$error" == "1" ]; then echo "$0: Unexpected output from md-detail for device $md" cat md-detail.out - ../fish/guestfish --remote exit + ../../fish/guestfish --remote exit exit 1 fi done -../fish/guestfish --remote exit +../../fish/guestfish --remote exit -eval `../fish/guestfish --listen` -../fish/guestfish --remote add-ro md-test1.img -../fish/guestfish --remote add-ro md-test2.img -../fish/guestfish --remote add-ro md-test3.img -../fish/guestfish --remote add-ro md-test4.img -../fish/guestfish --remote run +eval `../../fish/guestfish --listen` +../../fish/guestfish --remote add-ro md-test1.img +../../fish/guestfish --remote add-ro md-test2.img +../../fish/guestfish --remote add-ro md-test3.img +../../fish/guestfish --remote add-ro md-test4.img +../../fish/guestfish --remote run -for md in `../fish/guestfish --remote list-md-devices`; do - ../fish/guestfish --remote md-stop "${md}" +for md in `../../fish/guestfish --remote list-md-devices`; do + ../../fish/guestfish --remote md-stop "${md}" done -../fish/guestfish --remote exit +../../fish/guestfish --remote exit rm -f md-detail.out md-test1.img md-test2.img md-test3.img md-test4.img diff --git a/tests/protocol/Makefile.am b/tests/protocol/Makefile.am new file mode 100644 index 00000000..0d899dd9 --- /dev/null +++ b/tests/protocol/Makefile.am @@ -0,0 +1,38 @@ +# libguestfs +# Copyright (C) 2009-2011 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. + +include $(top_srcdir)/subdir-rules.mk + +TESTS = \ + test-both-ends-cancel.sh \ + test-cancellation-download-librarycancels.sh \ + test-cancellation-upload-daemoncancels.sh \ + test-launch-race.pl \ + test-qemudie-killsub.sh \ + test-qemudie-midcommand.sh \ + test-qemudie-synch.sh + +random_val := $(shell awk 'BEGIN{srand(); print 1+int(255*rand())}' < /dev/null) + +TESTS_ENVIRONMENT = \ + MALLOC_PERTURB_=$(random_val) \ + LD_LIBRARY_PATH=$(top_builddir)/src/.libs \ + LIBGUESTFS_PATH=$(top_builddir)/appliance \ + TMPDIR=$(top_builddir) + +EXTRA_DIST = \ + $(TESTS) diff --git a/regressions/test-both-ends-cancel.sh b/tests/protocol/test-both-ends-cancel.sh index aa39226a..accc0191 100755 --- a/regressions/test-both-ends-cancel.sh +++ b/tests/protocol/test-both-ends-cancel.sh @@ -24,7 +24,7 @@ set -e rm -f test1.img -../fish/guestfish -N disk <<EOF +../../fish/guestfish -N disk <<EOF -tar-in /tmp/nosuchfile /blah ping-daemon EOF diff --git a/regressions/test-cancellation-download-librarycancels.sh b/tests/protocol/test-cancellation-download-librarycancels.sh index 117794db..a1198c4a 100755 --- a/regressions/test-cancellation-download-librarycancels.sh +++ b/tests/protocol/test-cancellation-download-librarycancels.sh @@ -31,7 +31,7 @@ rm -f test.img size=$(awk 'BEGIN{ srand(); print int(16*1024*rand()) }') echo "$0: test size $size (bytes)" -../fish/guestfish <<EOF +../../fish/guestfish <<EOF # We want the file to be fully allocated. alloc test.img 10M run diff --git a/regressions/test-cancellation-upload-daemoncancels.sh b/tests/protocol/test-cancellation-upload-daemoncancels.sh index 179ea30a..61172e58 100755 --- a/regressions/test-cancellation-upload-daemoncancels.sh +++ b/tests/protocol/test-cancellation-upload-daemoncancels.sh @@ -24,7 +24,7 @@ set -e rm -f test1.img -../fish/guestfish -N fs -m /dev/sda1 <<'EOF' +../../fish/guestfish -N fs -m /dev/sda1 <<'EOF' # Upload image, daemon should cancel because the image is too large # to upload into itself. -upload test.img /test diff --git a/regressions/test-launch-race.pl b/tests/protocol/test-launch-race.pl index 5a660cee..5a660cee 100755 --- a/regressions/test-launch-race.pl +++ b/tests/protocol/test-launch-race.pl diff --git a/regressions/test-qemudie-killsub.sh b/tests/protocol/test-qemudie-killsub.sh index 8ee7ae82..093e73de 100755 --- a/regressions/test-qemudie-killsub.sh +++ b/tests/protocol/test-qemudie-killsub.sh @@ -22,7 +22,7 @@ set -e rm -f test1.img -../fish/guestfish -N disk <<'EOF' +../../fish/guestfish -N disk <<'EOF' # Kill the subprocess. kill-subprocess diff --git a/regressions/test-qemudie-launchfail.sh b/tests/protocol/test-qemudie-launchfail.sh index e3fcb827..4dcd671e 100755 --- a/regressions/test-qemudie-launchfail.sh +++ b/tests/protocol/test-qemudie-launchfail.sh @@ -22,7 +22,7 @@ set -e rm -f test.img -../fish/guestfish <<'EOF' +../../fish/guestfish <<'EOF' alloc test.img 10M append "root=/dev/null" diff --git a/regressions/test-qemudie-midcommand.sh b/tests/protocol/test-qemudie-midcommand.sh index cdf3f038..73c3b8e6 100755 --- a/regressions/test-qemudie-midcommand.sh +++ b/tests/protocol/test-qemudie-midcommand.sh @@ -22,7 +22,7 @@ set -e rm -f test.pid test1.img -../fish/guestfish -N disk <<'EOF' +../../fish/guestfish -N disk <<'EOF' # Kill the subprocess after a short wait. pid | cat > test.pid ! sleep 2 ; kill $(cat test.pid) & diff --git a/regressions/test-qemudie-synch.sh b/tests/protocol/test-qemudie-synch.sh index 697c83bd..fb4e25f3 100755 --- a/regressions/test-qemudie-synch.sh +++ b/tests/protocol/test-qemudie-synch.sh @@ -22,7 +22,7 @@ set -e rm -f test.pid test1.img -../fish/guestfish -N disk <<'EOF' +../../fish/guestfish -N disk <<'EOF' # Kill subprocess. pid | cat > test.pid ! kill $(cat test.pid) ; sleep 2 diff --git a/tests/qemu/qemu-snapshot-isolation.sh b/tests/qemu/qemu-snapshot-isolation.sh index 384706c2..70b68392 100755 --- a/tests/qemu/qemu-snapshot-isolation.sh +++ b/tests/qemu/qemu-snapshot-isolation.sh @@ -33,7 +33,7 @@ test3_md5sum="$(md5sum test3.img | awk '{print $1}')" # The vitally important calls are 'add-drive-ro' and # 'add-drive-opts ... readonly:true'. -../fish/guestfish <<'EOF' +../../fish/guestfish <<'EOF' add-drive-ro test1.img add-drive-opts test2.img format:raw readonly:true add-drive-opts test3.img format:qcow2 readonly:true diff --git a/regressions/Makefile.am b/tests/regressions/Makefile.am index 00c25f1e..e43d9e9f 100644 --- a/regressions/Makefile.am +++ b/tests/regressions/Makefile.am @@ -15,14 +15,9 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -# Regression tests and other important tests which are not -# specific to the C API. We can write these more easily in -# higher level languages than C. - include $(top_srcdir)/subdir-rules.mk TESTS = \ - tell-user-to-ignore-errors.sh \ rhbz501893 \ rhbz503169c13.sh \ rhbz557655.sh \ @@ -31,42 +26,7 @@ TESTS = \ rhbz580246.sh \ rhbz602997.sh \ rhbz690819.sh \ - test-add-domain.sh \ - test-both-ends-cancel.sh \ - test-cancellation-download-librarycancels.sh \ - test-cancellation-upload-daemoncancels.sh \ - test-copy.sh \ - test-find0.sh \ - test-guestfish-a.sh \ - test-guestfish-d.sh \ - test-guestfish-escapes.sh \ - test-guestfish-events.sh \ - test-guestfish-tilde.sh \ - test-inspect-fstab.sh \ - test-inspect-fstab-md.sh \ - test-launch-race.pl \ - test-list-filesystems.sh \ - test-list-md-devices.sh \ - test-luks.sh \ - test-luks-list.sh \ - test-lvm-filtering.sh \ - test-lvm-mapping.pl \ - test-mdadm.sh \ - test-noexec-stack.pl \ - test-qemudie-killsub.sh \ - test-qemudie-midcommand.sh \ - test-qemudie-synch.sh \ - test-read_file.sh \ - test-remote.sh \ - test-reopen.sh \ - test-stringlist.sh \ - test-upload-to-dir.sh - -SKIPPED_TESTS = \ - test-bootbootboot.sh - -FAILING_TESTS = \ - test-qemudie-launchfail.sh + test-noexec-stack.pl random_val := $(shell awk 'BEGIN{srand(); print 1+int(255*rand())}' < /dev/null) @@ -89,8 +49,6 @@ rhbz501893_LDADD = \ $(top_builddir)/src/libguestfs.la EXTRA_DIST = \ - $(FAILING_TESTS) \ - $(SKIPPED_TESTS) \ $(TESTS) \ rhbz557655-expected.stdout \ rhbz557655-expected.stderr diff --git a/regressions/rhbz501893.c b/tests/regressions/rhbz501893.c index 86e85e58..86e85e58 100644 --- a/regressions/rhbz501893.c +++ b/tests/regressions/rhbz501893.c diff --git a/regressions/rhbz503169c13.sh b/tests/regressions/rhbz503169c13.sh index f1cfa5e8..1f3c1521 100755 --- a/regressions/rhbz503169c13.sh +++ b/tests/regressions/rhbz503169c13.sh @@ -28,7 +28,7 @@ set -e rm -f test1.img -../fish/guestfish -N fs -m /dev/sda1 <<EOF +../../fish/guestfish -N fs -m /dev/sda1 <<EOF mkdir /dev -command /ignore-this-error unmount-all diff --git a/regressions/rhbz557655-expected.stderr b/tests/regressions/rhbz557655-expected.stderr index 4f88ee8d..4f88ee8d 100644 --- a/regressions/rhbz557655-expected.stderr +++ b/tests/regressions/rhbz557655-expected.stderr diff --git a/regressions/rhbz557655-expected.stdout b/tests/regressions/rhbz557655-expected.stdout index 80bc8bc3..80bc8bc3 100644 --- a/regressions/rhbz557655-expected.stdout +++ b/tests/regressions/rhbz557655-expected.stdout diff --git a/regressions/rhbz557655.sh b/tests/regressions/rhbz557655.sh index df3ceaa0..682ef725 100755 --- a/regressions/rhbz557655.sh +++ b/tests/regressions/rhbz557655.sh @@ -24,7 +24,7 @@ set -e rm -f test.out test.err export LANG=C -../fish/guestfish >> test.out 2>> test.err <<EOF +../../fish/guestfish >> test.out 2>> test.err <<EOF # set-memsize is just a convenient non-daemon function that # takes a single integer argument. set-memsize 0 @@ -48,7 +48,7 @@ get-memsize -set-memsize 123L EOF -../fish/guestfish -N fs -m /dev/sda1 >> test.out 2>> test.err <<EOF +../../fish/guestfish -N fs -m /dev/sda1 >> test.out 2>> test.err <<EOF touch /test # truncate-size takes an Int64 argument diff --git a/regressions/rhbz576879.sh b/tests/regressions/rhbz576879.sh index 6b7219cf..852183d3 100755 --- a/regressions/rhbz576879.sh +++ b/tests/regressions/rhbz576879.sh @@ -24,7 +24,7 @@ set -e rm -f test1.img -../fish/guestfish -N disk <<EOF +../../fish/guestfish -N disk <<EOF -upload $srcdir/rhbz576879.sh /test.sh # Shouldn't lose synchronization, so next command should work: ping-daemon diff --git a/regressions/rhbz578407.sh b/tests/regressions/rhbz578407.sh index cc010b76..5fe2cc11 100755 --- a/regressions/rhbz578407.sh +++ b/tests/regressions/rhbz578407.sh @@ -23,7 +23,7 @@ set -e -guestfish=../fish/guestfish +guestfish=../../fish/guestfish # Start remote guestfish. eval `$guestfish --listen 2>/dev/null` diff --git a/regressions/rhbz580246.sh b/tests/regressions/rhbz580246.sh index 0e5dbc6e..847ced6a 100755 --- a/regressions/rhbz580246.sh +++ b/tests/regressions/rhbz580246.sh @@ -29,7 +29,7 @@ dd if=/dev/zero of=test.img bs=1M count=2 tar cf test.tar test.img output=$( -../fish/guestfish 2>&1 <<'EOF' +../../fish/guestfish 2>&1 <<'EOF' add test.img run mkfs ext2 /dev/sda diff --git a/regressions/rhbz602997.sh b/tests/regressions/rhbz602997.sh index 61b9df60..401211d9 100755 --- a/regressions/rhbz602997.sh +++ b/tests/regressions/rhbz602997.sh @@ -22,7 +22,7 @@ set -e export LANG=C -guestfish=../fish/guestfish +guestfish=../../fish/guestfish rm -f test.img test.output diff --git a/regressions/rhbz690819.sh b/tests/regressions/rhbz690819.sh index 251cc8d3..a706285c 100755 --- a/regressions/rhbz690819.sh +++ b/tests/regressions/rhbz690819.sh @@ -27,7 +27,7 @@ rm -f test.img truncate -s 100M test.img -../fish/guestfish <<EOF +../../fish/guestfish <<EOF add-drive-with-if test.img ide run mkfs ext3 /dev/sda diff --git a/regressions/rhbz727178.sh b/tests/regressions/rhbz727178.sh index bf42015a..90b5994e 100755 --- a/regressions/rhbz727178.sh +++ b/tests/regressions/rhbz727178.sh @@ -23,7 +23,7 @@ set -e export LANG=C -guestfish=../fish/guestfish +guestfish=../../fish/guestfish output=rhbz727178.output rm -f binaries.tmp $output diff --git a/regressions/test-noexec-stack.pl b/tests/regressions/test-noexec-stack.pl index 6de0b570..6de0b570 100755 --- a/regressions/test-noexec-stack.pl +++ b/tests/regressions/test-noexec-stack.pl |