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, Junio C Hamano wrote:

> Johannes Schindelin <Johannes.Schindelin@xxxxxx> writes:
> 
> > This patch adds the ability to use valgrind's memcheck tool to
> > diagnose memory problems in git while running the test scripts....
> 
> Hmmm, why do I haf to suffer with these new warnings from the tests?
> 
>   $ sh t2012-checkout-last.sh --valgrind -v -i
>   warning: templates not found /git/git.git/t/valgrind/bin/templates/blt/
>   Initialized empty Git repository in /git/git.git/t/trash directory.t2012-checkout-last/.git/
>   mv: cannot stat `.git/hooks': No such file or directory
>   * expecting success:
>           echo hello >world &&
> 
> Am I using the patch incorrectly somehow?

Nope, I overlooked that GIT_EXEC_PATH was used by test-lib also to 
determine the location of the templates.  Will squash this in (which 
makes a function out of the symlink business, and also fixes the error 
that git-gui/ was tested if it is a script; "head" complained that it is 
not a file):

-- snipsnap --
 t/test-lib.sh |   22 ++++++++++++++--------
 1 files changed, 14 insertions(+), 8 deletions(-)

diff --git a/t/test-lib.sh b/t/test-lib.sh
index f031905..6acc6e0 100644
--- a/t/test-lib.sh
+++ b/t/test-lib.sh
@@ -487,6 +487,14 @@ then
 	PATH=$TEST_DIRECTORY/..:$PATH
 	GIT_EXEC_PATH=$TEST_DIRECTORY/..
 else
+	make_symlink () {
+		test -h "$2" &&
+		test "$1" = "$(readlink "$2")" || {
+			rm -f "$2" &&
+			ln -s "$1" "$2"
+		}
+	}
+
 	# override all git executables in PATH and TEST_DIRECTORY/..
 	GIT_VALGRIND=$TEST_DIRECTORY/valgrind/bin
 	mkdir -p "$GIT_VALGRIND"
@@ -498,12 +506,13 @@ else
 		while read file
 		do
 			# handle only executables
-			test -x "$file" && test ! -d "$file" || continue
+			test -x "$file" || continue
 
 			base=$(basename "$file")
 			symlink_target=$TEST_DIRECTORY/../$base
 			# do not override scripts
 			if test -x "$symlink_target" &&
+			    test ! -d "$symlink_target" &&
 			    test "#!" != "$(head -c 2 < "$symlink_target")"
 			then
 				symlink_target=../valgrind.sh
@@ -513,19 +522,16 @@ else
 				symlink_target=../unprocessed-script
 			esac
 			# 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
-				rm -f "$GIT_VALGRIND"/"$base" || exit
-				ln -s "$symlink_target" "$GIT_VALGRIND"/"$base"
-			fi
+			make_symlink "$symlink_target" "$GIT_VALGRIND/$base" ||
+			exit
 		done
 	done
 	IFS=$OLDIFS
 	PATH=$GIT_VALGRIND:$PATH
 	GIT_EXEC_PATH=$GIT_VALGRIND
 	export GIT_VALGRIND
+
+	make_symlink ../../../templates "$GIT_VALGRIND"/templates || exit
 fi
 GIT_TEMPLATE_DIR=$(pwd)/../templates/blt
 unset GIT_CONFIG
-- 
1.6.1.442.g38a50

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