From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:60423) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SpKMh-0000Zf-3k for qemu-devel@nongnu.org; Thu, 12 Jul 2012 10:27:41 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SpKMg-0004NN-4w for qemu-devel@nongnu.org; Thu, 12 Jul 2012 10:27:35 -0400 Received: from mx1.redhat.com ([209.132.183.28]:9111) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SpKMf-0004NH-TS for qemu-devel@nongnu.org; Thu, 12 Jul 2012 10:27:34 -0400 Received: from int-mx01.intmail.prod.int.phx2.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id q6CERXj0005720 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Thu, 12 Jul 2012 10:27:33 -0400 From: Kevin Wolf Date: Thu, 12 Jul 2012 16:27:29 +0200 Message-Id: <1342103249-20888-3-git-send-email-kwolf@redhat.com> In-Reply-To: <1342103249-20888-1-git-send-email-kwolf@redhat.com> References: <1342103249-20888-1-git-send-email-kwolf@redhat.com> Subject: [Qemu-devel] [PATCH 2/2] qemu-iotests: Valgrind support List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: 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 --- 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