run test suite without dashed git-commands in PATH
Only put bin-wrappers in the PATH (not GIT_EXEC_PATH), to emulate the default installed user environment, and ensure all the programs run correctly in such an environment. This is now the default, although it can be overridden with a --with-dashes test option when running tests. Signed-off-by: Matthew Ogilvie <mmogilvi_git@miniinfo.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Matthew Ogilvie committed
Dec 2, 2009 at 22:14 UTC
e4597aae6590cbd6c868c0406ac5521221c4f465
2 files changed
+30
-12
t/README
+9
@@ -75,6 +75,15 @@ appropriately before running "make".
75
As the names depend on the tests' file names, it is safe to
76
run the tests with this option in parallel.
77
78
+--with-dashes::
79
+ By default tests are run without dashed forms of
80
+ commands (like git-commit) in the PATH (it only uses
81
+ wrappers from ../bin-wrappers). Use this option to include
82
+ the build directory (..) in the PATH, which contains all
83
+ the dashed forms of commands. This option is currently
84
+ implied by other options like --valgrind and
85
+ GIT_TEST_INSTALLED.
86
+
87
You can also set the GIT_TEST_INSTALLED environment variable to
88
the bindir of an existing git installation to test that installation.
89
You still need to have built this git sandbox, from which various
t/test-lib.sh
+21
-12
@@ -105,6 +105,8 @@ do
105
verbose=t; shift ;;
106
-q|--q|--qu|--qui|--quie|--quiet)
107
quiet=t; shift ;;
108
+ --with-dashes)
109
+ with_dashes=t; shift ;;
110
--no-color)
111
color=; shift ;;
112
--no-python)
@@ -551,19 +553,8 @@ test_done () {
553
# Test the binaries we have just built. The tests are kept in
554
# t/ subdirectory and are run in 'trash directory' subdirectory.
555
TEST_DIRECTORY=$(pwd)
554
-if test -z "$valgrind"
556
+if test -n "$valgrind"
557
then
556
- if test -z "$GIT_TEST_INSTALLED"
557
- then
558
- PATH=$TEST_DIRECTORY/..:$PATH
559
- GIT_EXEC_PATH=$TEST_DIRECTORY/..
560
- else
561
- GIT_EXEC_PATH=$($GIT_TEST_INSTALLED/git --exec-path) ||
562
- error "Cannot run git from $GIT_TEST_INSTALLED."
563
- PATH=$GIT_TEST_INSTALLED:$TEST_DIRECTORY/..:$PATH
564
- GIT_EXEC_PATH=${GIT_TEST_EXEC_PATH:-$GIT_EXEC_PATH}
565
- fi
566
-else
558
make_symlink () {
559
test -h "$2" &&
560
test "$1" = "$(readlink "$2")" || {
@@ -625,6 +616,24 @@ else
616
PATH=$GIT_VALGRIND/bin:$PATH
617
GIT_EXEC_PATH=$GIT_VALGRIND/bin
618
export GIT_VALGRIND
619
+elif test -n "$GIT_TEST_INSTALLED" ; then
620
+ GIT_EXEC_PATH=$($GIT_TEST_INSTALLED/git --exec-path) ||
621
+ error "Cannot run git from $GIT_TEST_INSTALLED."
622
+ PATH=$GIT_TEST_INSTALLED:$TEST_DIRECTORY/..:$PATH
623
+ GIT_EXEC_PATH=${GIT_TEST_EXEC_PATH:-$GIT_EXEC_PATH}
624
+else # normal case, use ../bin-wrappers only unless $with_dashes:
625
+ git_bin_dir="$TEST_DIRECTORY/../bin-wrappers"
626
+ if ! test -x "$git_bin_dir/git" ; then
627
+ if test -z "$with_dashes" ; then
628
+ say "$git_bin_dir/git is not executable; using GIT_EXEC_PATH"
629
+ fi
630
+ with_dashes=t
631
+ fi
632
+ PATH="$git_bin_dir:$PATH"
633
+ GIT_EXEC_PATH=$TEST_DIRECTORY/..
634
+ if test -n "$with_dashes" ; then
635
+ PATH="$TEST_DIRECTORY/..:$PATH"
636
+ fi
637
fi
638
GIT_TEMPLATE_DIR=$(pwd)/../templates/blt
639
unset GIT_CONFIG