@matheusbsbs / matheus-bagliano / commits / efd92ffd31
Fork 0

Valgrind support: check for more than just programming errors

This patch makes --valgrind try to override _all_ Git binaries in the PATH, and it makes it an error to call *.sh and *.perl scripts directly. While it is not strictly necessary to look through the whole PATH to find git binaries to override, it is in line with running an expensive test (which valgrind is) to make extra sure that only binaries are tested that actually come from the git.git checkout. In the same spirit, we can test that neither our test suite nor our scripts try to run the *.sh or *.perl scripts directly. It's more like a "because we can" than a "this is tightly connected to valgrind", but in the author's opinion "because we can" is "so we should" in this case. Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Johannes Schindelin committed Feb 4, 2009 at 00:26 UTC efd92ffd316d03360e1c8a348091e4f50f749d6f
1 file changed +15
t/test-lib.sh
+15
@@ -531,6 +531,10 @@ else
531 then
532 symlink_target=../valgrind.sh
533 fi
534 + case "$base" in
535 + *.sh|*.perl)
536 + symlink_target=../unprocessed-script
537 + esac
538 # create the link, or replace it if it is out of date
539 make_symlink "$symlink_target" "$GIT_VALGRIND/bin/$base" || exit
540 }
@@ -542,6 +546,17 @@ else
546 do
547 make_valgrind_symlink $file
548 done
549 + OLDIFS=$IFS
550 + IFS=:
551 + for path in $PATH
552 + do
553 + ls "$path"/git-* 2> /dev/null |
554 + while read file
555 + do
556 + make_valgrind_symlink "$file"
557 + done
558 + done
559 + IFS=$OLDIFS
560 PATH=$GIT_VALGRIND/bin:$PATH
561 GIT_EXEC_PATH=$GIT_VALGRIND/bin
562 export GIT_VALGRIND