*~
*.a
+test1.img
+test2.img
+test.err
+test.out
ABOUT-NLS
aclocal.m4
align/stamp-virt-alignment-scan.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
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
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
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
po/Makefile.in
python/Makefile
python/examples/Makefile
- regressions/Makefile
rescue/Makefile
resize/Makefile
ruby/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
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)
{
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)
{
EXTRA_DIST = \
$(BUILT_SOURCES) \
+ $(TESTS) \
rc_protocol.x \
guestfish.pod \
guestfish-bash-completion.sh \
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
+++ /dev/null
-#!/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
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>.
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.
--- /dev/null
+# 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)
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
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
--- /dev/null
+# 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)
rm -f test1.img test2.img
-actual=$(../fish/guestfish <<'EOF'
+actual=$(../../fish/guestfish <<'EOF'
sparse test1.img 1G
sparse test2.img 1G
--- /dev/null
+# 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
# 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
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
# 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
set -e
output=$(
-../fish/guestfish <<EOF
+../../fish/guestfish <<EOF
# Add 2 empty disks
sparse md-test1.img 100M
sparse md-test2.img 100M
# 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
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
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
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
-#!/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)
rm -f test1.img
-../fish/guestfish -N disk <<EOF
+../../fish/guestfish -N disk <<EOF
-tar-in /tmp/nosuchfile /blah
ping-daemon
EOF
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
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
rm -f test1.img
-../fish/guestfish -N disk <<'EOF'
+../../fish/guestfish -N disk <<'EOF'
# Kill the subprocess.
kill-subprocess
rm -f test.img
-../fish/guestfish <<'EOF'
+../../fish/guestfish <<'EOF'
alloc test.img 10M
append "root=/dev/null"
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) &
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
# 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
# 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 \
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)
$(top_builddir)/src/libguestfs.la
EXTRA_DIST = \
- $(FAILING_TESTS) \
- $(SKIPPED_TESTS) \
$(TESTS) \
rhbz557655-expected.stdout \
rhbz557655-expected.stderr
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
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
-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
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
set -e
-guestfish=../fish/guestfish
+guestfish=../../fish/guestfish
# Start remote guestfish.
eval `$guestfish --listen 2>/dev/null`
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
set -e
export LANG=C
-guestfish=../fish/guestfish
+guestfish=../../fish/guestfish
rm -f test.img test.output
truncate -s 100M test.img
-../fish/guestfish <<EOF
+../../fish/guestfish <<EOF
add-drive-with-if test.img ide
run
mkfs ext3 /dev/sda
set -e
export LANG=C
-guestfish=../fish/guestfish
+guestfish=../../fish/guestfish
output=rhbz727178.output
rm -f binaries.tmp $output