qemu-iotests: Valgrind support
check -valgrind wraps all qemu-io calls with valgrind. This makes it a bit easier to debug problems that occur somewhere deep in a test case. Signed-off-by: Kevin Wolf <kwolf@redhat.com> Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
This commit is contained in:
parent
3f4349dc8b
commit
2f24e8fb8d
@ -41,6 +41,7 @@ sortme=false
|
|||||||
expunge=true
|
expunge=true
|
||||||
have_test_arg=false
|
have_test_arg=false
|
||||||
randomize=false
|
randomize=false
|
||||||
|
valgrind=false
|
||||||
rm -f $tmp.list $tmp.tmp $tmp.sed
|
rm -f $tmp.list $tmp.tmp $tmp.sed
|
||||||
|
|
||||||
export IMGFMT=raw
|
export IMGFMT=raw
|
||||||
@ -212,6 +213,11 @@ testlist options
|
|||||||
xpand=false
|
xpand=false
|
||||||
;;
|
;;
|
||||||
|
|
||||||
|
-valgrind)
|
||||||
|
valgrind=true
|
||||||
|
xpand=false
|
||||||
|
;;
|
||||||
|
|
||||||
-g) # -g group ... pick from group file
|
-g) # -g group ... pick from group file
|
||||||
group=true
|
group=true
|
||||||
xpand=false
|
xpand=false
|
||||||
@ -345,3 +351,8 @@ fi
|
|||||||
[ "$QEMU" = "" ] && _fatal "qemu not found"
|
[ "$QEMU" = "" ] && _fatal "qemu not found"
|
||||||
[ "$QEMU_IMG" = "" ] && _fatal "qemu-img not found"
|
[ "$QEMU_IMG" = "" ] && _fatal "qemu-img not found"
|
||||||
[ "$QEMU_IO" = "" ] && _fatal "qemu-img not found"
|
[ "$QEMU_IO" = "" ] && _fatal "qemu-img not found"
|
||||||
|
|
||||||
|
if $valgrind; then
|
||||||
|
export REAL_QEMU_IO="$QEMU_IO_PROG"
|
||||||
|
export QEMU_IO_PROG=valgrind_qemu_io
|
||||||
|
fi
|
||||||
|
@ -53,6 +53,16 @@ else
|
|||||||
TEST_IMG=$IMGPROTO:$TEST_DIR/t.$IMGFMT
|
TEST_IMG=$IMGPROTO:$TEST_DIR/t.$IMGFMT
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
function valgrind_qemu_io()
|
||||||
|
{
|
||||||
|
valgrind --log-file=/tmp/$$.valgrind --error-exitcode=99 $REAL_QEMU_IO "$@"
|
||||||
|
if [ $? != 0 ]; then
|
||||||
|
cat /tmp/$$.valgrind
|
||||||
|
fi
|
||||||
|
rm -f /tmp/$$.valgrind
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
_optstr_add()
|
_optstr_add()
|
||||||
{
|
{
|
||||||
if [ -n "$1" ]; then
|
if [ -n "$1" ]; then
|
||||||
|
Loading…
Reference in New Issue
Block a user