test-lib: Use "$GIT_BUILD_DIR" instead of "$TEST_DIRECTORY"/../
Change code that used $TEST_DIRECTORY/.. to use $GIT_BUILD_DIR instead, the two are equivalent, but the latter is easier to read. This required moving the assignment od GIT_BUILD_DIR to earlier in the test-lib.sh file. Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
parent
aed604c778
commit
6cec5c6835
@ -648,7 +648,7 @@ test_create_repo () {
|
|||||||
repo="$1"
|
repo="$1"
|
||||||
mkdir -p "$repo"
|
mkdir -p "$repo"
|
||||||
cd "$repo" || error "Cannot setup test environment"
|
cd "$repo" || error "Cannot setup test environment"
|
||||||
"$GIT_EXEC_PATH/git-init" "--template=$TEST_DIRECTORY/../templates/blt/" >&3 2>&4 ||
|
"$GIT_EXEC_PATH/git-init" "--template=$GIT_BUILD_DIR/templates/blt/" >&3 2>&4 ||
|
||||||
error "cannot run git init -- have you built things yet?"
|
error "cannot run git init -- have you built things yet?"
|
||||||
mv .git/hooks .git/hooks-disabled
|
mv .git/hooks .git/hooks-disabled
|
||||||
cd "$owd"
|
cd "$owd"
|
||||||
@ -711,6 +711,8 @@ test_done () {
|
|||||||
# Test the binaries we have just built. The tests are kept in
|
# Test the binaries we have just built. The tests are kept in
|
||||||
# t/ subdirectory and are run in 'trash directory' subdirectory.
|
# t/ subdirectory and are run in 'trash directory' subdirectory.
|
||||||
TEST_DIRECTORY=$(pwd)
|
TEST_DIRECTORY=$(pwd)
|
||||||
|
GIT_BUILD_DIR="$TEST_DIRECTORY"/..
|
||||||
|
|
||||||
if test -n "$valgrind"
|
if test -n "$valgrind"
|
||||||
then
|
then
|
||||||
make_symlink () {
|
make_symlink () {
|
||||||
@ -737,7 +739,7 @@ then
|
|||||||
test -x "$1" || return
|
test -x "$1" || return
|
||||||
|
|
||||||
base=$(basename "$1")
|
base=$(basename "$1")
|
||||||
symlink_target=$TEST_DIRECTORY/../$base
|
symlink_target=$GIT_BUILD_DIR/$base
|
||||||
# do not override scripts
|
# do not override scripts
|
||||||
if test -x "$symlink_target" &&
|
if test -x "$symlink_target" &&
|
||||||
test ! -d "$symlink_target" &&
|
test ! -d "$symlink_target" &&
|
||||||
@ -756,7 +758,7 @@ then
|
|||||||
# override all git executables in TEST_DIRECTORY/..
|
# override all git executables in TEST_DIRECTORY/..
|
||||||
GIT_VALGRIND=$TEST_DIRECTORY/valgrind
|
GIT_VALGRIND=$TEST_DIRECTORY/valgrind
|
||||||
mkdir -p "$GIT_VALGRIND"/bin
|
mkdir -p "$GIT_VALGRIND"/bin
|
||||||
for file in $TEST_DIRECTORY/../git* $TEST_DIRECTORY/../test-*
|
for file in $GIT_BUILD_DIR/git* $GIT_BUILD_DIR/test-*
|
||||||
do
|
do
|
||||||
make_valgrind_symlink $file
|
make_valgrind_symlink $file
|
||||||
done
|
done
|
||||||
@ -777,10 +779,10 @@ then
|
|||||||
elif test -n "$GIT_TEST_INSTALLED" ; then
|
elif test -n "$GIT_TEST_INSTALLED" ; then
|
||||||
GIT_EXEC_PATH=$($GIT_TEST_INSTALLED/git --exec-path) ||
|
GIT_EXEC_PATH=$($GIT_TEST_INSTALLED/git --exec-path) ||
|
||||||
error "Cannot run git from $GIT_TEST_INSTALLED."
|
error "Cannot run git from $GIT_TEST_INSTALLED."
|
||||||
PATH=$GIT_TEST_INSTALLED:$TEST_DIRECTORY/..:$PATH
|
PATH=$GIT_TEST_INSTALLED:$GIT_BUILD_DIR:$PATH
|
||||||
GIT_EXEC_PATH=${GIT_TEST_EXEC_PATH:-$GIT_EXEC_PATH}
|
GIT_EXEC_PATH=${GIT_TEST_EXEC_PATH:-$GIT_EXEC_PATH}
|
||||||
else # normal case, use ../bin-wrappers only unless $with_dashes:
|
else # normal case, use ../bin-wrappers only unless $with_dashes:
|
||||||
git_bin_dir="$TEST_DIRECTORY/../bin-wrappers"
|
git_bin_dir="$GIT_BUILD_DIR/bin-wrappers"
|
||||||
if ! test -x "$git_bin_dir/git" ; then
|
if ! test -x "$git_bin_dir/git" ; then
|
||||||
if test -z "$with_dashes" ; then
|
if test -z "$with_dashes" ; then
|
||||||
say "$git_bin_dir/git is not executable; using GIT_EXEC_PATH"
|
say "$git_bin_dir/git is not executable; using GIT_EXEC_PATH"
|
||||||
@ -788,13 +790,12 @@ else # normal case, use ../bin-wrappers only unless $with_dashes:
|
|||||||
with_dashes=t
|
with_dashes=t
|
||||||
fi
|
fi
|
||||||
PATH="$git_bin_dir:$PATH"
|
PATH="$git_bin_dir:$PATH"
|
||||||
GIT_EXEC_PATH=$TEST_DIRECTORY/..
|
GIT_EXEC_PATH=$GIT_BUILD_DIR
|
||||||
if test -n "$with_dashes" ; then
|
if test -n "$with_dashes" ; then
|
||||||
PATH="$TEST_DIRECTORY/..:$PATH"
|
PATH="$GIT_BUILD_DIR:$PATH"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
GIT_BUILD_DIR="$TEST_DIRECTORY"/..
|
GIT_TEMPLATE_DIR="$GIT_BUILD_DIR"/templates/blt
|
||||||
GIT_TEMPLATE_DIR="$TEST_DIRECTORY"/../templates/blt
|
|
||||||
unset GIT_CONFIG
|
unset GIT_CONFIG
|
||||||
GIT_CONFIG_NOSYSTEM=1
|
GIT_CONFIG_NOSYSTEM=1
|
||||||
GIT_CONFIG_NOGLOBAL=1
|
GIT_CONFIG_NOGLOBAL=1
|
||||||
@ -812,22 +813,22 @@ then
|
|||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
GITPERLLIB="$TEST_DIRECTORY"/../perl/blib/lib:"$TEST_DIRECTORY"/../perl/blib/arch/auto/Git
|
GITPERLLIB="$GIT_BUILD_DIR"/perl/blib/lib:"$GIT_BUILD_DIR"/perl/blib/arch/auto/Git
|
||||||
export GITPERLLIB
|
export GITPERLLIB
|
||||||
test -d "$TEST_DIRECTORY"/../templates/blt || {
|
test -d "$GIT_BUILD_DIR"/templates/blt || {
|
||||||
error "You haven't built things yet, have you?"
|
error "You haven't built things yet, have you?"
|
||||||
}
|
}
|
||||||
|
|
||||||
if test -z "$GIT_TEST_INSTALLED" && test -z "$NO_PYTHON"
|
if test -z "$GIT_TEST_INSTALLED" && test -z "$NO_PYTHON"
|
||||||
then
|
then
|
||||||
GITPYTHONLIB="$TEST_DIRECTORY/../git_remote_helpers/build/lib"
|
GITPYTHONLIB="$GIT_BUILD_DIR/git_remote_helpers/build/lib"
|
||||||
export GITPYTHONLIB
|
export GITPYTHONLIB
|
||||||
test -d "$TEST_DIRECTORY"/../git_remote_helpers/build || {
|
test -d "$GIT_BUILD_DIR"/git_remote_helpers/build || {
|
||||||
error "You haven't built git_remote_helpers yet, have you?"
|
error "You haven't built git_remote_helpers yet, have you?"
|
||||||
}
|
}
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if ! test -x "$TEST_DIRECTORY"/../test-chmtime; then
|
if ! test -x "$GIT_BUILD_DIR"/test-chmtime; then
|
||||||
echo >&2 'You need to build test-chmtime:'
|
echo >&2 'You need to build test-chmtime:'
|
||||||
echo >&2 'Run "make test-chmtime" in the source (toplevel) directory'
|
echo >&2 'Run "make test-chmtime" in the source (toplevel) directory'
|
||||||
exit 1
|
exit 1
|
||||||
|
Loading…
Reference in New Issue
Block a user