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)
rm -f test1.img
dd if=/dev/zero of=test1.img bs=1024k count=10
-export LIBGUESTFS_PATH=../appliance
-
../fish/guestfish -a test1.img <<EOF
launch
ll /../dev/console
rm -f test1.img
dd if=/dev/zero of=test1.img bs=1024k count=10
-export LIBGUESTFS_PATH=../appliance
-
../fish/guestfish -a test1.img <<EOF
run
sfdisk /dev/sda 0 0 0 ,
if [ -n "$1" ]; then n=$1; fi
export LIBGUESTFS_DEBUG=1
-export LIBGUESTFS_PATH=../appliance
for i in $(seq 1 $n); do
echo Test boot $i of $n ...
--- /dev/null
+#!/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 from the kill-subprocess command.
+
+set -e
+
+rm -f test.img
+
+../fish/guestfish <<'EOF'
+alloc test.img 10M
+run
+
+# Kill the subprocess.
+kill-subprocess
+
+# 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.img
# along with this program; if not, write to the Free Software
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-# XXX Unfortunately we can't enable this by default since it
-# requires './configure --enable-debug-command'
+# Test if we can handle qemu failure during launch.
-./fish/guestfish <<EOF
-alloc /tmp/test.img 100M
-run
+set -e
+
+rm -f test.img
-# Force a segfault inside the daemon.
--debug segv ''
+../fish/guestfish <<'EOF'
+alloc test.img 10M
+
+append "root=/dev/null"
+-run
# We should now be able to rerun the subprocess.
+append ""
run
ping-daemon
EOF
+
+rm -f test.img
--- /dev/null
+#!/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 in the middle of a command.
+
+set -e
+
+rm -f test.pid test.img
+
+../fish/guestfish <<'EOF'
+alloc test.img 10M
+run
+
+# Kill the subprocess after a short wait.
+pid | cat > 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
--- /dev/null
+#!/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