qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Kevin Wolf <kwolf@redhat.com>
To: qemu-devel@nongnu.org
Cc: kwolf@redhat.com
Subject: [Qemu-devel] [PATCH 2/2] qemu-iotests: Valgrind support
Date: Thu, 12 Jul 2012 16:27:29 +0200	[thread overview]
Message-ID: <1342103249-20888-3-git-send-email-kwolf@redhat.com> (raw)
In-Reply-To: <1342103249-20888-1-git-send-email-kwolf@redhat.com>

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>
---
 tests/qemu-iotests/common    |   11 +++++++++++
 tests/qemu-iotests/common.rc |   10 ++++++++++
 2 files changed, 21 insertions(+), 0 deletions(-)

diff --git a/tests/qemu-iotests/common b/tests/qemu-iotests/common
index eeb70cb..1f6fdf5 100644
--- a/tests/qemu-iotests/common
+++ b/tests/qemu-iotests/common
@@ -41,6 +41,7 @@ sortme=false
 expunge=true
 have_test_arg=false
 randomize=false
+valgrind=false
 rm -f $tmp.list $tmp.tmp $tmp.sed
 
 export IMGFMT=raw
@@ -212,6 +213,11 @@ testlist options
 	    xpand=false
 	    ;;
 
+    -valgrind)
+        valgrind=true
+	    xpand=false
+        ;;
+
 	-g)	# -g group ... pick from group file
 	    group=true
 	    xpand=false
@@ -345,3 +351,8 @@ fi
 [ "$QEMU" = "" ] && _fatal "qemu not found"
 [ "$QEMU_IMG" = "" ] && _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
diff --git a/tests/qemu-iotests/common.rc b/tests/qemu-iotests/common.rc
index e535874..5e3a524 100644
--- a/tests/qemu-iotests/common.rc
+++ b/tests/qemu-iotests/common.rc
@@ -53,6 +53,16 @@ else
     TEST_IMG=$IMGPROTO:$TEST_DIR/t.$IMGFMT
 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()
 {
     if [ -n "$1" ]; then
-- 
1.7.6.5

  parent reply	other threads:[~2012-07-12 14:27 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-07-12 14:27 [Qemu-devel] [PATCH 0/2] qemu-iotests: valgrind support Kevin Wolf
2012-07-12 14:27 ` [Qemu-devel] [PATCH 1/2] coroutine-ucontext: Help valgrind understand coroutines Kevin Wolf
2012-07-12 17:07   ` Stefan Weil
2012-07-13  8:45     ` Kevin Wolf
2012-07-13  8:53       ` Kevin Wolf
2012-07-12 17:14   ` Peter Maydell
2012-07-13  8:36     ` Kevin Wolf
2012-07-13 15:31   ` [Qemu-devel] [PATCH v2 " Kevin Wolf
2012-07-13 15:37     ` Peter Maydell
2012-07-13 16:06       ` Kevin Wolf
2012-07-13 16:13         ` Eric Blake
2012-07-13 16:18           ` Kevin Wolf
2012-07-12 14:27 ` Kevin Wolf [this message]
2012-07-12 16:51 ` [Qemu-devel] [PATCH 0/2] qemu-iotests: valgrind support Paolo Bonzini
2012-07-12 17:14   ` Stefan Weil

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1342103249-20888-3-git-send-email-kwolf@redhat.com \
    --to=kwolf@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).