From: Richard Jones Date: Mon, 6 Jul 2009 12:10:25 +0000 (+0100) Subject: Introduce regression tests for various qemu failures. X-Git-Tag: 1.0.56~8^2~4 X-Git-Url: http://git.annexia.org/?p=libguestfs.git;a=commitdiff_plain;h=51ecd63944bb1374ebad518d814deaa2096bc365 Introduce regression tests for various qemu failures. Test failure of qemu and recovery of the library: - mid-command - between commands - during launch [test not working yet] - explicitly killed by guestfs_kill_subprocess Also this patch cleans up the other tests in this directory and disables the long-winded test-bootbootboot test. --- diff --git a/regressions/Makefile.am b/regressions/Makefile.am index 78ecfaa..874e898 100644 --- a/regressions/Makefile.am +++ b/regressions/Makefile.am @@ -24,8 +24,21 @@ TESTS = \ rhbz503169c10.sh \ rhbz503169c13.sh \ + test-qemudie-midcommand.sh \ + test-qemudie-killsub.sh \ + test-qemudie-synch.sh + +SKIPPED_TESTS = \ test-bootbootboot.sh +FAILING_TESTS = \ + test-qemudie-launchfail.sh + +TESTS_ENVIRONMENT = \ + LD_LIBRARY_PATH=$(top_builddir)/src/.libs \ + LIBGUESTFS_PATH=$(top_builddir)/appliance + EXTRA_DIST = \ - test-cleanup.sh \ + $(FAILING_TESTS) \ + $(SKIPPED_TESTS) \ $(TESTS) diff --git a/regressions/rhbz503169c10.sh b/regressions/rhbz503169c10.sh index 8cdad50..2cfdbca 100755 --- a/regressions/rhbz503169c10.sh +++ b/regressions/rhbz503169c10.sh @@ -24,8 +24,6 @@ set -e rm -f test1.img dd if=/dev/zero of=test1.img bs=1024k count=10 -export LIBGUESTFS_PATH=../appliance - ../fish/guestfish -a test1.img < test.pid +! sleep 2 ; kill $(cat test.pid) & + +echo "Expect: 'guestfs_sleep reply failed, see earlier error messages'" +-sleep 1000 + +# We should now be able to rerun the subprocess. +run +ping-daemon +EOF + +rm -f test.pid test.img diff --git a/regressions/test-qemudie-synch.sh b/regressions/test-qemudie-synch.sh new file mode 100755 index 0000000..96e879d --- /dev/null +++ b/regressions/test-qemudie-synch.sh @@ -0,0 +1,42 @@ +#!/bin/sh - +# libguestfs +# Copyright (C) 2009 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., 675 Mass Ave, Cambridge, MA 02139, USA. + +# Test if we can handle qemu death synchronously. + +set -e + +rm -f test.pid test.img + +../fish/guestfish <<'EOF' +alloc test.img 10M +run + +# Kill subprocess. +pid | cat > test.pid +! kill $(cat test.pid) ; sleep 2 + +# XXX The following sleep should NOT be necessary. +echo "Expect an error from the next command" +-sleep 1 + +# We should now be able to rerun the subprocess. +run +ping-daemon +EOF + +rm -f test.pid test.img