tests: Split regressions -> various subdirectories of tests/
authorRichard W.M. Jones <rjones@redhat.com>
Thu, 22 Dec 2011 11:35:43 +0000 (11:35 +0000)
committerRichard W.M. Jones <rjones@redhat.com>
Thu, 22 Dec 2011 13:04:41 +0000 (13:04 +0000)
55 files changed:
.gitignore
Makefile.am
configure.ac
daemon/debug.c
fish/Makefile.am
fish/test-add-domain.sh [moved from regressions/test-add-domain.sh with 100% similarity]
fish/test-copy.sh [moved from regressions/test-copy.sh with 100% similarity]
fish/test-find0.sh [moved from regressions/test-find0.sh with 100% similarity]
fish/test-guestfish-a.sh [moved from regressions/test-guestfish-a.sh with 100% similarity]
fish/test-guestfish-d.sh [moved from regressions/test-guestfish-d.sh with 100% similarity]
fish/test-guestfish-escapes.sh [moved from regressions/test-guestfish-escapes.sh with 100% similarity]
fish/test-guestfish-events.sh [moved from regressions/test-guestfish-events.sh with 100% similarity]
fish/test-guestfish-tilde.sh [moved from regressions/test-guestfish-tilde.sh with 100% similarity]
fish/test-read_file.sh [moved from regressions/test-read_file.sh with 100% similarity]
fish/test-remote.sh [moved from regressions/test-remote.sh with 100% similarity]
fish/test-reopen.sh [moved from regressions/test-reopen.sh with 100% similarity]
fish/test-stringlist.sh [moved from regressions/test-stringlist.sh with 100% similarity]
fish/test-upload-to-dir.sh [moved from regressions/test-upload-to-dir.sh with 100% similarity]
regressions/tell-user-to-ignore-errors.sh [deleted file]
src/guestfs.pod
tests/luks/Makefile.am [new file with mode: 0644]
tests/luks/test-luks-list.sh [moved from regressions/test-luks-list.sh with 97% similarity]
tests/luks/test-luks.sh [moved from regressions/test-luks.sh with 97% similarity]
tests/lvm/Makefile.am [new file with mode: 0644]
tests/lvm/test-lvm-filtering.sh [moved from regressions/test-lvm-filtering.sh with 97% similarity]
tests/lvm/test-lvm-mapping.pl [moved from regressions/test-lvm-mapping.pl with 100% similarity]
tests/md/Makefile.am [new file with mode: 0644]
tests/md/test-inspect-fstab-md.sh [moved from regressions/test-inspect-fstab-md.sh with 91% similarity]
tests/md/test-inspect-fstab.sh [moved from regressions/test-inspect-fstab.sh with 97% similarity]
tests/md/test-list-filesystems.sh [moved from regressions/test-list-filesystems.sh with 98% similarity]
tests/md/test-list-md-devices.sh [moved from regressions/test-list-md-devices.sh with 94% similarity]
tests/md/test-mdadm.sh [moved from regressions/test-mdadm.sh with 79% similarity]
tests/protocol/Makefile.am [moved from regressions/test-bootbootboot.sh with 55% similarity, mode: 0644]
tests/protocol/test-both-ends-cancel.sh [moved from regressions/test-both-ends-cancel.sh with 96% similarity]
tests/protocol/test-cancellation-download-librarycancels.sh [moved from regressions/test-cancellation-download-librarycancels.sh with 98% similarity]
tests/protocol/test-cancellation-upload-daemoncancels.sh [moved from regressions/test-cancellation-upload-daemoncancels.sh with 95% similarity]
tests/protocol/test-launch-race.pl [moved from regressions/test-launch-race.pl with 100% similarity]
tests/protocol/test-qemudie-killsub.sh [moved from regressions/test-qemudie-killsub.sh with 96% similarity]
tests/protocol/test-qemudie-launchfail.sh [moved from regressions/test-qemudie-launchfail.sh with 97% similarity]
tests/protocol/test-qemudie-midcommand.sh [moved from regressions/test-qemudie-midcommand.sh with 96% similarity]
tests/protocol/test-qemudie-synch.sh [moved from regressions/test-qemudie-synch.sh with 96% similarity]
tests/qemu/qemu-snapshot-isolation.sh
tests/regressions/Makefile.am [moved from regressions/Makefile.am with 61% similarity]
tests/regressions/rhbz501893.c [moved from regressions/rhbz501893.c with 100% similarity]
tests/regressions/rhbz503169c13.sh [moved from regressions/rhbz503169c13.sh with 96% similarity]
tests/regressions/rhbz557655-expected.stderr [moved from regressions/rhbz557655-expected.stderr with 100% similarity]
tests/regressions/rhbz557655-expected.stdout [moved from regressions/rhbz557655-expected.stdout with 100% similarity]
tests/regressions/rhbz557655.sh [moved from regressions/rhbz557655.sh with 95% similarity]
tests/regressions/rhbz576879.sh [moved from regressions/rhbz576879.sh with 95% similarity]
tests/regressions/rhbz578407.sh [moved from regressions/rhbz578407.sh with 97% similarity]
tests/regressions/rhbz580246.sh [moved from regressions/rhbz580246.sh with 97% similarity]
tests/regressions/rhbz602997.sh [moved from regressions/rhbz602997.sh with 98% similarity]
tests/regressions/rhbz690819.sh [moved from regressions/rhbz690819.sh with 97% similarity]
tests/regressions/rhbz727178.sh [moved from regressions/rhbz727178.sh with 97% similarity]
tests/regressions/test-noexec-stack.pl [moved from regressions/test-noexec-stack.pl with 100% similarity]

index c322a27..9271d74 100644 (file)
@@ -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
index 5c8ff67..31da875 100644 (file)
@@ -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
index ac09844..33d2aea 100644 (file)
@@ -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
 
index bb91c9e..31cef46 100644 (file)
@@ -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)
 {
index c940c2b..2624a7d 100644 (file)
@@ -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
similarity index 100%
rename from regressions/test-copy.sh
rename to fish/test-copy.sh
similarity index 100%
rename from regressions/test-find0.sh
rename to fish/test-find0.sh
diff --git a/regressions/tell-user-to-ignore-errors.sh b/regressions/tell-user-to-ignore-errors.sh
deleted file mode 100755 (executable)
index 6564288..0000000
+++ /dev/null
@@ -1,26 +0,0 @@
-#!/bin/bash -
-# libguestfs
-# Copyright (C) 2010 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.
-
-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
index 45f6329..8576065 100644 (file)
@@ -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/tests/luks/Makefile.am b/tests/luks/Makefile.am
new file mode 100644 (file)
index 0000000..2bc21ed
--- /dev/null
@@ -0,0 +1,33 @@
+# 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-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)
similarity index 97%
rename from regressions/test-luks-list.sh
rename to tests/luks/test-luks-list.sh
index 9385a4c..80ff6e7 100755 (executable)
@@ -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
similarity index 97%
rename from regressions/test-luks.sh
rename to tests/luks/test-luks.sh
index fcf9d70..a9edca0 100755 (executable)
@@ -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/tests/lvm/Makefile.am b/tests/lvm/Makefile.am
new file mode 100644 (file)
index 0000000..290f6b3
--- /dev/null
@@ -0,0 +1,33 @@
+# 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-lvm-filtering.sh \
+       test-lvm-mapping.pl
+
+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)
similarity index 97%
rename from regressions/test-lvm-filtering.sh
rename to tests/lvm/test-lvm-filtering.sh
index 7644bbe..d5ae8d5 100755 (executable)
@@ -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/tests/md/Makefile.am b/tests/md/Makefile.am
new file mode 100644 (file)
index 0000000..c778956
--- /dev/null
@@ -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
similarity index 91%
rename from regressions/test-inspect-fstab-md.sh
rename to tests/md/test-inspect-fstab-md.sh
index da163fc..2a6cb6a 100755 (executable)
@@ -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
similarity index 97%
rename from regressions/test-inspect-fstab.sh
rename to tests/md/test-inspect-fstab.sh
index 332cde0..72a11fa 100755 (executable)
 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
similarity index 98%
rename from regressions/test-list-filesystems.sh
rename to tests/md/test-list-filesystems.sh
index 353cdd0..9aea21a 100755 (executable)
@@ -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
similarity index 94%
rename from regressions/test-list-md-devices.sh
rename to tests/md/test-list-md-devices.sh
index 0216ca9..99283be 100755 (executable)
@@ -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
similarity index 79%
rename from regressions/test-mdadm.sh
rename to tests/md/test-mdadm.sh
index 7314ca5..e7f5775 100755 (executable)
@@ -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
old mode 100755 (executable)
new mode 100644 (file)
similarity index 55%
rename from regressions/test-bootbootboot.sh
rename to tests/protocol/Makefile.am
index 476cfdb..0d899dd
@@ -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
 # 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-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
 
-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)
similarity index 96%
rename from regressions/test-both-ends-cancel.sh
rename to tests/protocol/test-both-ends-cancel.sh
index aa39226..accc019 100755 (executable)
@@ -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
@@ -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
@@ -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
similarity index 96%
rename from regressions/test-qemudie-killsub.sh
rename to tests/protocol/test-qemudie-killsub.sh
index 8ee7ae8..093e73d 100755 (executable)
@@ -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
 
similarity index 97%
rename from regressions/test-qemudie-launchfail.sh
rename to tests/protocol/test-qemudie-launchfail.sh
index e3fcb82..4dcd671 100755 (executable)
@@ -22,7 +22,7 @@ set -e
 
 rm -f test.img
 
-../fish/guestfish <<'EOF'
+../../fish/guestfish <<'EOF'
 alloc test.img 10M
 
 append "root=/dev/null"
similarity index 96%
rename from regressions/test-qemudie-midcommand.sh
rename to tests/protocol/test-qemudie-midcommand.sh
index cdf3f03..73c3b8e 100755 (executable)
@@ -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) &
similarity index 96%
rename from regressions/test-qemudie-synch.sh
rename to tests/protocol/test-qemudie-synch.sh
index 697c83b..fb4e25f 100755 (executable)
@@ -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
index 384706c..70b6839 100755 (executable)
@@ -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
similarity index 61%
rename from regressions/Makefile.am
rename to tests/regressions/Makefile.am
index 00c25f1..e43d9e9 100644 (file)
 # 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
similarity index 96%
rename from regressions/rhbz503169c13.sh
rename to tests/regressions/rhbz503169c13.sh
index f1cfa5e..1f3c152 100755 (executable)
@@ -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
similarity index 95%
rename from regressions/rhbz557655.sh
rename to tests/regressions/rhbz557655.sh
index df3ceaa..682ef72 100755 (executable)
@@ -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
similarity index 95%
rename from regressions/rhbz576879.sh
rename to tests/regressions/rhbz576879.sh
index 6b7219c..852183d 100755 (executable)
@@ -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
similarity index 97%
rename from regressions/rhbz578407.sh
rename to tests/regressions/rhbz578407.sh
index cc010b7..5fe2cc1 100755 (executable)
@@ -23,7 +23,7 @@
 
 set -e
 
-guestfish=../fish/guestfish
+guestfish=../../fish/guestfish
 
 # Start remote guestfish.
 eval `$guestfish --listen 2>/dev/null`
similarity index 97%
rename from regressions/rhbz580246.sh
rename to tests/regressions/rhbz580246.sh
index 0e5dbc6..847ced6 100755 (executable)
@@ -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
similarity index 98%
rename from regressions/rhbz602997.sh
rename to tests/regressions/rhbz602997.sh
index 61b9df6..401211d 100755 (executable)
@@ -22,7 +22,7 @@
 set -e
 export LANG=C
 
-guestfish=../fish/guestfish
+guestfish=../../fish/guestfish
 
 rm -f test.img test.output
 
similarity index 97%
rename from regressions/rhbz690819.sh
rename to tests/regressions/rhbz690819.sh
index 251cc8d..a706285 100755 (executable)
@@ -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
similarity index 97%
rename from regressions/rhbz727178.sh
rename to tests/regressions/rhbz727178.sh
index bf42015..90b5994 100755 (executable)
@@ -23,7 +23,7 @@
 set -e
 export LANG=C
 
-guestfish=../fish/guestfish
+guestfish=../../fish/guestfish
 output=rhbz727178.output
 
 rm -f binaries.tmp $output