git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Jeff King <peff@peff.net>
To: git@vger.kernel.org
Subject: valgrind test script integration
Date: Sat, 12 Jan 2008 06:10:44 -0500	[thread overview]
Message-ID: <20080112111044.GA24257@coredump.intra.peff.net> (raw)
In-Reply-To: <20080112090432.GA6134@coredump.intra.peff.net>

On Sat, Jan 12, 2008 at 04:04:32AM -0500, Jeff King wrote:

> I couldn't reproduce this just running the test, but running it under
> valgrind showed a memory access error. Fix is below.

BTW, this could have been caught automagically if we had valgrind
integration in the test scripts. Below is a rudimentary patch to do so.
I'm not that familiar with valgrind, so input from those more
knowledgeable is appreciated, and maybe we can get something official
post-1.5.4.

You can use it like "./t7300-clean.sh -m"; each call to 'git' is run
through valgrind, and returns an error if the original program had an
error, or if valgrind turned up any errors.

It of course runs horribly slowly. I've just kicked off a

  make GIT_TEST_OPTS='-i -m'

now. A few caveats:

 - It barfs on _any_ valgrind error. On my Debian unstable system,
   anything that touches nss ends up with an error deep in the dlopen
   code.  Therefore to make this useful, I had to put

     {
       dl hack
       Memcheck:Addr4
       obj:/lib/ld-2.7.so
     }

   into /usr/lib/valgrind/default.supp

   We should maybe have a 'git.supp' error suppression file, but in this
   case, the error really seems to be platform-specific.

 - We only catch calls to 'git', not 'git-foo' (and in fact for that
   reason this doesn't catch the t7300 bug by itself, since that uses
   git-clean). A follow-on patch will deal with this.

---
 t/test-lib.sh |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)

diff --git a/t/test-lib.sh b/t/test-lib.sh
index 90b6844..415e918 100644
--- a/t/test-lib.sh
+++ b/t/test-lib.sh
@@ -84,6 +84,8 @@ do
 	--no-python)
 		# noop now...
 		shift ;;
+	-m|--m|--me|--mem|--memc|--memch|--memche|--memchec|--memcheck)
+		alias git='memcheck git'; shift ;;
 	*)
 		break ;;
 	esac
@@ -120,6 +122,12 @@ say () {
 	say_color info "$*"
 }
 
+memcheck() {
+	valgrind -q --error-exitcode=1 --leak-check=no "$@" && return 0
+	echo >&2 valgrind failure: "$@"
+	return 1
+}
+
 test "${test_description}" != "" ||
 error "Test script did not set test_description."
 
-- 
1.5.4.rc3.1.g027628-dirty

  parent reply	other threads:[~2008-01-12 11:12 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-01-12  7:11 [ANNOUNCE] GIT 1.5.4-rc3 Junio C Hamano
2008-01-12  7:26 ` Ismail Dönmez
2008-01-12  7:34   ` Junio C Hamano
2008-01-12  7:47     ` Ismail Dönmez
2008-01-12  8:04       ` Junio C Hamano
2008-01-12  9:04       ` Jeff King
2008-01-12  9:05         ` Jeff King
2008-01-12 11:10         ` Jeff King [this message]
2008-01-12 11:36           ` valgrind test script integration Jeff King
2008-01-12 17:10             ` Johannes Schindelin
2008-01-12 18:12               ` Jeff King
2008-01-12 13:01         ` [ANNOUNCE] GIT 1.5.4-rc3 René Scharfe
2008-01-12 13:10         ` Ismail Dönmez
2008-01-12 16:57         ` Johannes Schindelin
2008-01-12 18:09           ` Jeff King
2008-01-12 19:09         ` Junio C Hamano
2008-01-12 14:24 ` Roger C. Soares
2008-01-12 19:13   ` Junio C Hamano
     [not found] ` <7vsl13wmas.fsf-jO8aZxhGsIagbBziECNbOZn29agUkmeCHZ5vskTnxNA@public.gmane.org>
2008-01-13 14:41   ` Steffen Prohaska
2008-01-21  2:37 ` [ANNOUNCE] GIT 1.5.4-rc4 Junio C Hamano
     [not found]   ` <7vsl0r3nvc.fsf-jO8aZxhGsIagbBziECNbOZn29agUkmeCHZ5vskTnxNA@public.gmane.org>
2008-01-21 22:22     ` Steffen Prohaska
     [not found]       ` <BB330DC7-9F38-4D41-85A2-D475701B6083-wjoc1KHpMeg@public.gmane.org>
2008-01-22  1:21         ` Johannes Schindelin
     [not found]           ` <alpine.LSU.1.00.0801220121300.5731-OGWIkrnhIhzN0uC3ymp8PA@public.gmane.org>
2008-01-22  5:50             ` Steffen Prohaska
2008-01-28 10:56   ` [ANNOUNCE] GIT 1.5.4-rc5 Junio C Hamano
2008-01-28 18:38     ` Jeff King
2008-01-29  0:36       ` Gustaf Hendeby
2008-01-29  1:25       ` Junio C Hamano
2008-01-29  1:29         ` Jeff King
2008-01-29  6:06     ` Steffen Prohaska

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

  List information: http://vger.kernel.org/majordomo-info.html

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

  git send-email \
    --in-reply-to=20080112111044.GA24257@coredump.intra.peff.net \
    --to=peff@peff.net \
    --cc=git@vger.kernel.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.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

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 read-only IMAP folder(s) and NNTP newsgroup(s).