Re: [PATCH 1/2 v2] Add valgrind support in test scripts
- From
Johannes Schindelin <johannes.schindelin@gmx.de>
- Date
- Jan 21, 2009, 22:38 UTC
- Message-ID
- <alpine.DEB.1.00.0901212332030.3586@pacific.mpi-cbg.de>
- In-Reply-To
- <20090121215318.GA9107@sigill.intra.peff.net>
Hi,
On Wed, 21 Jan 2009, Jeff King wrote:
> Actually, I am wrong. There is a stripped-down readlink that has shipped > with FreeBSD (since 4.10) and NetBSD (since 1.6). So while readlink > isn't portable, I think it should generally work on platforms supported > by valgrind.
A pity. I was already working on this patch:
-- snipsnap -- [PATCH] valgrind tests: provide a "readlink" function for systems which lack it
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de> --- t/test-lib.sh | 17 +++++++++++++++++ 1 files changed, 17 insertions(+), 0 deletions(-)
diff --git a/t/test-lib.sh b/t/test-lib.sh index 07e657e..c2199e7 100644 --- a/t/test-lib.sh +++ b/t/test-lib.sh @@ -487,7 +487,24 @@ then PATH=$TEST_DIRECTORY/..:$PATH GIT_EXEC_PATH=$TEST_DIRECTORY/.. else + readlink -h 2> /dev/null + if test $? = 127 + then + readlink () { + ls -l "$1" | + sed -e "s/-> \(.*\)$/\1/g" + # cannot use s/.* -> //, because of + # ln -s "a -> b" "c -> d" + } + fi + make_symlink () { + case "$1" in + *" -> "*) + die "You must be kidding me ($1)." + ;; + esac + test -h "$2" && test "$1" = "$(readlink "$2")" || { # be super paranoid
-- 1.6.1.442.g112f5