git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] t/Makefile: pass test opts to valgrind target properly
@ 2011-06-17  8:29 Jeff King
  2011-06-17 20:36 ` [PATCH] tests: link shell libraries into valgrind directory Jeff King
  0 siblings, 1 reply; 3+ messages in thread
From: Jeff King @ 2011-06-17  8:29 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git

The valgrind target just reinvokes make with GIT_TEST_OPTS
set to "--valgrind". However, it does this using an
environment variable, which means GIT_TEST_OPTS in your
config.mak would override it, and "make valgrind" would
simply run the test suite without valgrind on.

Instead, we should pass GIT_TEST_OPTS on the command-line,
overriding what's in config.mak, and take care to append to
whatever the user has there already.

Signed-off-by: Jeff King <peff@peff.net>
---
I'm attempting to run the whole test suite under valgrind for 1.7.6-rc2.
It's been a while since I've done a whole run, as there were some false
positives in strspn on recent glibc which I've finally addressed.

We'll see what it comes up with later today. :)

 t/Makefile |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/t/Makefile b/t/Makefile
index 47cbeb6..9046ec9 100644
--- a/t/Makefile
+++ b/t/Makefile
@@ -71,7 +71,7 @@ gitweb-test:
 	$(MAKE) $(TGITWEB)
 
 valgrind:
-	GIT_TEST_OPTS=--valgrind $(MAKE)
+	$(MAKE) GIT_TEST_OPTS="$(GIT_TEST_OPTS) --valgrind"
 
 # Smoke testing targets
 -include ../GIT-VERSION-FILE
-- 
1.7.6.rc1.38.g97f64

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [PATCH] tests: link shell libraries into valgrind directory
  2011-06-17  8:29 [PATCH] t/Makefile: pass test opts to valgrind target properly Jeff King
@ 2011-06-17 20:36 ` Jeff King
  2011-06-17 21:28   ` Junio C Hamano
  0 siblings, 1 reply; 3+ messages in thread
From: Jeff King @ 2011-06-17 20:36 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git

On Fri, Jun 17, 2011 at 04:29:57AM -0400, Jeff King wrote:

> I'm attempting to run the whole test suite under valgrind for 1.7.6-rc2.
> It's been a while since I've done a whole run, as there were some false
> positives in strspn on recent glibc which I've finally addressed.
> 
> We'll see what it comes up with later today. :)

It took about 8 hours to run on my measly quad-core. The good news is
that there were no actual bugs. After fixing the strspn (and some
strcasestr) false positives at the valgrind level, the only patch I
needed to get every test script running successfully was:

-- >8 --
Subject: tests: link shell libraries into valgrind directory

When we run tests under valgrind, we symlink anything
executable that starts with git-* or test-* into a special
valgrind bin directory, and then make that our
GIT_EXEC_PATH.

However, shell libraries like git-sh-setup do not have the
executable bit marked, and did not get symlinked.  This
means that any test looking for shell libraries in our
exec-path would fail to find them, even though that is a
fine thing to do when testing against a regular git build
(or in a git install, for that matter).

t2300 demonstrated this problem. The fix is to symlink these
shell libraries directly into the valgrind directory.

Signed-off-by: Jeff King <peff@peff.net>
---
Another strategy would be to actually check the Makefile variables to
see what to symlink; but that's a pretty big change, and what we have
now works fine (with this exception).

 t/test-lib.sh |    9 +++++++--
 1 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/t/test-lib.sh b/t/test-lib.sh
index 64390d7..8c57a00 100644
--- a/t/test-lib.sh
+++ b/t/test-lib.sh
@@ -884,8 +884,13 @@ then
 	}
 
 	make_valgrind_symlink () {
-		# handle only executables
-		test -x "$1" || return
+		# handle only executables, unless they are shell libraries that
+		# need to be in the exec-path.  We will just use "#!" as a
+		# guess for a shell-script, since we have no idea what the user
+		# may have configured as the shell path.
+		test -x "$1" ||
+		test "#!" = "$(head -c 2 <"$1")" ||
+		return;
 
 		base=$(basename "$1")
 		symlink_target=$GIT_BUILD_DIR/$base
-- 
1.7.6.rc1.38.g97f64

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] tests: link shell libraries into valgrind directory
  2011-06-17 20:36 ` [PATCH] tests: link shell libraries into valgrind directory Jeff King
@ 2011-06-17 21:28   ` Junio C Hamano
  0 siblings, 0 replies; 3+ messages in thread
From: Junio C Hamano @ 2011-06-17 21:28 UTC (permalink / raw)
  To: Jeff King; +Cc: git

Thanks, will queue both.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2011-06-17 21:28 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-06-17  8:29 [PATCH] t/Makefile: pass test opts to valgrind target properly Jeff King
2011-06-17 20:36 ` [PATCH] tests: link shell libraries into valgrind directory Jeff King
2011-06-17 21:28   ` Junio C Hamano

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).