git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jeff King <peff@peff.net>
To: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Cc: Junio C Hamano <gitster@pobox.com>, git@vger.kernel.org
Subject: Re: [PATCH 1/2 v2] Add valgrind support in test scripts
Date: Wed, 21 Jan 2009 14:02:01 -0500	[thread overview]
Message-ID: <20090121190201.GA21686@coredump.intra.peff.net> (raw)
In-Reply-To: <alpine.DEB.1.00.0901210209580.19014@racer>

On Wed, Jan 21, 2009 at 02:10:17AM +0100, Johannes Schindelin wrote:

> 	- symbolic links are inspected for correct targets now, and if they
> 	  point somewhere else than expected, they are removed (this can
> 	  error out if the file could not be removed) and recreated.

Now you _do_ have a race on this, and triggering it will cause you to
run a random version of git from your PATH, not using valgrind (instead
of running the version from the repo using valgrind). Something like:

  A: execvp("git-foo")
  B: oops, "git-foo" is out of date
  B: rm $GIT_VALGRIND/git-foo
  A: look for $GIT_VALGRIND/git-foo; not there
  A: look for $PATH[1]/git-foo; ok, there it is
  B: ln -s ../../git-valgrind $GIT_VALGRIND/git-foo

> +--valgrind::
> +	Execute all Git binaries with valgrind and stop on errors (the
> +	exit code will be 126).

It doesn't necessarily stop: it just causes the command to fail, which
causes the test to fail. Which _will_ stop if you have "-i".

Also, you might want to mention that valgrind errors go to stderr, so
using "-v" is helpful.

> +	# override all git executables in PATH and TEST_DIRECTORY/..
> +	GIT_VALGRIND=$TEST_DIRECTORY/valgrind/bin

I think you should leave GIT_VALGRIND pointing to the main valgrind
directory. That way it is more convenient for people using
GIT_VALGRIND_OPTIONS to make use of GIT_VALGRIND without having to ".."
everything (for example, they may want to pick and choose suppressions
to load for their platform).

> +			case "$base" in
> +			*.sh|*.perl)
> +				symlink_target=../unprocessed-script
> +			esac

AFAIK, this triggers an error if I try to call "git-foo.perl" directly.
What does this have to do with valgrind? Why does this error checking
happen when I run --valgrind, but _not_ otherwise?

And yes, I know the answer is "because it's easy to do here, since
--valgrind is munging the PATH anyway". But my point is that that is an
_implementation_ detail, and the external behavior to a user is
nonsensical.

The fact that there are other uses for munging the PATH than valgrind
implies to me that we should _always_ be munging the PATH like this to
catch these sorts of errors. And then "--valgrind" can just change the
way we munge.

> +			# create the link, or replace it if it is out of date
> +			if test ! -h "$GIT_VALGRIND"/"$base" ||
> +			    test "$symlink_target" != \
> +					"$(readlink "$GIT_VALGRIND"/"$base")"
> +			then

readlink is not portable; it's part of GNU coreutils. Right now valgrind
basically only runs on Linux, which I think generally means that
readlink will be available (though I have no idea if there are
distributions that vary in this). However, there is an experimental
valgrind port to FreeBSD and NetBSD, which are unlikely to have
readlink.

-Peff

  parent reply	other threads:[~2009-01-21 19:03 UTC|newest]

Thread overview: 73+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-01-19  9:13 What's cooking in git.git (Jan 2009, #04; Mon, 19) Junio C Hamano
2009-01-19 11:54 ` Kjetil Barvik
2009-01-19 13:09   ` Johannes Schindelin
2009-01-19 13:08 ` Johannes Schindelin
2009-01-20  4:44   ` Jeff King
2009-01-20 13:51     ` valgrind patches, was " Johannes Schindelin
2009-01-20 14:19       ` Jeff King
2009-01-20 14:50         ` Johannes Schindelin
2009-01-20 15:04           ` [PATCH 1/2] Add valgrind support in test scripts Johannes Schindelin
2009-01-20 15:05             ` [PATCH 2/2] valgrind: ignore ldso errors Johannes Schindelin
2009-01-21  0:12             ` [PATCH 1/2] Add valgrind support in test scripts Jeff King
2009-01-21  0:41               ` Johannes Schindelin
2009-01-21  1:10               ` [PATCH 1/2 v2] " Johannes Schindelin
2009-01-21  1:11                 ` [INTERDIFF of PATCH " Johannes Schindelin
2009-01-21  8:48                 ` [PATCH " Junio C Hamano
2009-01-21 12:21                   ` Johannes Schindelin
2009-01-21 19:02                 ` Jeff King [this message]
2009-01-21 20:49                   ` Johannes Schindelin
2009-01-21 21:53                     ` Jeff King
2009-01-21 22:38                       ` Johannes Schindelin
2009-01-25 23:18                         ` [PATCH 0/3] Valgrind support Johannes Schindelin
2009-01-25 23:18                           ` [PATCH v3 1/3] Add valgrind support in test scripts Johannes Schindelin
2009-01-25 23:29                             ` Jeff King
2009-01-25 23:35                               ` Johannes Schindelin
2009-01-25 23:42                                 ` Jeff King
2009-01-25 23:19                           ` [PATCH v3 2/3] valgrind: ignore ldso and more libz errors Johannes Schindelin
2009-01-25 23:32                             ` Jeff King
2009-01-26  0:02                               ` Johannes Schindelin
2009-01-26  0:14                                 ` Jeff King
2009-01-25 23:20                           ` [PATCH 3/3] Valgrind support: check for more than just programming errors Johannes Schindelin
2009-01-25 23:42                             ` Jeff King
2009-01-26  0:43                               ` Johannes Schindelin
2009-01-21 22:31                     ` [PATCH] valgrind tests: be super-super paranoid when creating symlinks Johannes Schindelin
2009-01-20 23:24           ` valgrind patches, was Re: What's cooking in git.git (Jan 2009, #04; Mon, 19) Jeff King
2009-01-21  0:10             ` Johannes Schindelin
2009-01-21  0:15               ` Jeff King
2009-01-21  0:28                 ` Johannes Schindelin
2009-01-21  0:37                   ` Jeff King
2009-01-21  1:26                     ` Johannes Schindelin
2009-01-21  1:36                       ` [PATCH 2/2 v2] valgrind: ignore ldso errors Johannes Schindelin
2009-01-21 19:09                         ` Jeff King
2009-01-21 20:51                           ` Johannes Schindelin
2009-01-21 19:07                       ` valgrind patches, was Re: What's cooking in git.git (Jan 2009, #04; Mon, 19) Jeff King
2009-01-21 22:17                         ` Johannes Schindelin
2009-01-21 23:57                           ` Jeff King
2009-01-22  0:42                           ` Junio C Hamano
2009-01-22  0:59                             ` Jeff King
2009-01-22  5:02                               ` Johannes Schindelin
2009-01-22  5:39                                 ` Jeff King
2009-01-27  2:50                           ` Valgrind updates Johannes Schindelin
2009-01-27  3:38                             ` Linus Torvalds
2009-01-27  4:26                               ` Johannes Schindelin
2009-01-27  4:46                                 ` Johannes Schindelin
2009-01-27 13:14                                 ` Mark Brown
2009-01-27 16:54                                   ` Johannes Schindelin
2009-01-27 18:55                                     ` Linus Torvalds
2009-01-27 21:52                                       ` Johannes Schindelin
2009-01-29  1:56                                         ` Linus Torvalds
2009-01-29 14:22                                           ` Johannes Schindelin
2009-01-28 23:06                                       ` Mark Adler
2009-01-28 23:27                                         ` Johannes Schindelin
2009-01-29  0:15                                           ` Mark Adler
2009-01-29 14:14                                             ` Johannes Schindelin
2009-01-29 14:54                                               ` Johannes Schindelin
2009-01-27  4:48                               ` Jeff King
2009-01-27  9:31                                 ` Johannes Schindelin
2009-01-20  4:30 ` What's cooking in git.git (Jan 2009, #04; Mon, 19) Jeff King
2009-01-20  4:40 ` Jeff King
2009-01-20  7:04   ` Junio C Hamano
2009-01-20  7:55   ` Johannes Sixt
2009-01-20 14:18     ` Jeff King
2009-01-20  5:17 ` Boyd Stephen Smith Jr.
2009-01-20  8:57   ` Thomas Rast

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=20090121190201.GA21686@coredump.intra.peff.net \
    --to=peff@peff.net \
    --cc=Johannes.Schindelin@gmx.de \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    /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).