From: Stefano Lattarini <stefano.lattarini@gmail.com>
To: Jeff King <peff@peff.net>
Cc: Ramkumar Ramachandra <artagnon@gmail.com>,
Git List <git@vger.kernel.org>
Subject: Re: How do I run tests under Valgrind?
Date: Sat, 22 Sep 2012 15:03:58 +0200 [thread overview]
Message-ID: <505DB73E.2020108@gmail.com> (raw)
In-Reply-To: <20120921204907.GA22977@sigill.intra.peff.net>
On 09/21/2012 10:49 PM, Jeff King wrote:
>
> Oh. It sounds like setting $SHELL to zsh is really the problem, then. If
> it is not Bourne-compatible when called as "zsh", then it really should
> be called in a way that turns on compatibility mode (bash will do this
> when called as "sh", but you can also do it with "bash --posix").
>
AFAIK, if Zsh is called as "sh", it too will run in Bourne compatibility
mode; not sure how to force this compatibility from the command line though
(albeit I'd guess there is some way to do so).
As further reference, here is the trick autoconf uses to (try to) put Zsh
in Bourne compatibility mode after it has been invoked:
if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
emulate sh
NULLCMD=:
# Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which
# is contrary to our usage. Disable this feature.
alias -g '${1+"$@"}'='"$@"'
setopt NO_GLOB_SUBST
fi
You might think to use something like that in 't/test-lib.sh' (and other "shell
libraries" of the testsuite), but sadly that would not be enough; this excerpt
from the Automake suite shows why:
# If Zsh is not started directly in POSIX-compatibility mode, it has some
# incompatibilities in the handling of $0 that conflict with our usage;
# i.e., $0 inside a file sourced with the '.' builtin is temporarily set
# to the name of the sourced file. Work around that. The apparently
# useless 'eval' here is needed by at least dash 0.5.2, to prevent it
# from bailing out with an error like "Syntax error: Bad substitution".
# Note that a bug in some versions of Zsh prevents us from resetting $0
# in a sourced script, so the use of $argv0. For more info see:
# <http://www.zsh.org/mla/workers/2009/msg01140.html>
eval 'argv0=${functrace[-1]%:*}' && test -f "$argv0" || {
echo "Cannot determine the path of running test script." >&2
echo "Your Zsh (version $ZSH_VERSION) is probably too old." >&2
exit 99
}
Since I see that '$0' is used in (at least) 't/perf/perf-lib.sh' and
't/test-lib.sh', you'd need to copy the snippet above (or write an
equivalent one) in those files, and change them to use '$argv0' instead
of '$0' in few (but not all) places. Not sure whether it's worth it
though -- given that you seems to have solved the issue already with a
simpler change, I'd say it's not.
Regards,
Stefano
next prev parent reply other threads:[~2012-09-22 13:05 UTC|newest]
Thread overview: 37+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-09-17 17:01 How do I run tests under Valgrind? Ramkumar Ramachandra
2012-09-17 17:20 ` Jeff King
2012-09-17 17:23 ` Ramkumar Ramachandra
2012-09-17 17:35 ` Jeff King
2012-09-17 17:39 ` Ramkumar Ramachandra
2012-09-17 17:44 ` Jeff King
2012-09-17 17:55 ` Johannes Sixt
2012-09-17 17:57 ` Jeff King
2012-09-17 18:28 ` Ramkumar Ramachandra
[not found] ` <CALkWK0mkBbY7dUyaZAqqKE3ZMfE_xU6em_KCOKM9nsTjUP-9pA@mail.gmail.com>
2012-09-17 18:29 ` Jeff King
2012-09-21 19:31 ` Ramkumar Ramachandra
2012-09-21 19:58 ` Ramkumar Ramachandra
2012-09-21 20:13 ` Stefano Lattarini
2012-09-21 20:17 ` Ramkumar Ramachandra
2012-09-21 20:46 ` Ramkumar Ramachandra
2012-09-21 20:49 ` Jeff King
2012-09-22 13:03 ` Stefano Lattarini [this message]
2012-09-22 17:47 ` Jeff King
2012-09-22 18:20 ` Stefano Lattarini
2012-09-22 20:24 ` Junio C Hamano
2012-09-21 20:52 ` [PATCH] t/test-lib.sh: do not trust $SHELL Ramkumar Ramachandra
2012-09-21 20:58 ` Jeff King
2012-09-21 21:07 ` Ramkumar Ramachandra
2012-09-21 21:12 ` Jeff King
2012-09-21 21:34 ` Ramkumar Ramachandra
2012-09-21 21:57 ` Andreas Schwab
2012-09-21 22:30 ` Junio C Hamano
2012-09-22 4:26 ` Ramkumar Ramachandra
2012-09-22 4:52 ` Junio C Hamano
2012-09-22 4:54 ` Ramkumar Ramachandra
2012-09-22 4:57 ` Ramkumar Ramachandra
2012-09-22 20:16 ` Junio C Hamano
2012-09-26 3:49 ` Ramkumar Ramachandra
2012-09-21 21:59 ` Junio C Hamano
2012-09-21 22:15 ` Jeff King
2012-09-21 21:08 ` Andreas Schwab
2012-09-21 21:13 ` Jeff King
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=505DB73E.2020108@gmail.com \
--to=stefano.lattarini@gmail.com \
--cc=artagnon@gmail.com \
--cc=git@vger.kernel.org \
--cc=peff@peff.net \
/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).