#!/bin/sh
# Exercise a bug whereby defining a valid domain could kill libvirtd.
# The bug can also be exercised with a simple define/dumpxml pair to virsh.
test -z "$srcdir" && srcdir=$(pwd)
test -z "$abs_top_srcdir" && abs_top_srcdir=$(pwd)/..
test -z "$abs_top_builddir" && abs_top_builddir=$(pwd)/..
if test "$VERBOSE" = yes; then
set -x
$abs_top_builddir/tools/virsh --version
fi
. "$srcdir/test-lib.sh"
fail=0
# Domain definition from Cole Robinson.
cat <<\EOF > D.xml || fail=1
D
aaa3ae22-fed2-bfbd-ac02-3bea3bcfad82
262144
262144
1
hvm
destroy
restart
destroy
/usr/bin/qemu-kvm
EOF
url=test:///default
$abs_top_builddir/tools/virsh --connect "$url" 'define D.xml; dumpxml D' > out 2>&1 || fail=1
cat > exp <