Re: [PATCH 1/2 v2] Add valgrind support in test scripts

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxx>
---
 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

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux