@matheusbsbs / matheus-bagliano / commits / 6cec5c6835
Fork 0

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>

Ævar Arnfjörð Bjarmason committed Aug 19, 2010 at 16:08 UTC 6cec5c683535c8eacf6055064c9c5753b47bb031
1 file changed +15 -14
t/test-lib.sh
+15 -14
@@ -648,7 +648,7 @@ test_create_repo () {
648 repo="$1"
649 mkdir -p "$repo"
650 cd "$repo" || error "Cannot setup test environment"
651 - "$GIT_EXEC_PATH/git-init" "--template=$TEST_DIRECTORY/../templates/blt/" >&3 2>&4 ||
651 + "$GIT_EXEC_PATH/git-init" "--template=$GIT_BUILD_DIR/templates/blt/" >&3 2>&4 ||
652 error "cannot run git init -- have you built things yet?"
653 mv .git/hooks .git/hooks-disabled
654 cd "$owd"
@@ -711,6 +711,8 @@ test_done () {
711 # Test the binaries we have just built. The tests are kept in
712 # t/ subdirectory and are run in 'trash directory' subdirectory.
713 TEST_DIRECTORY=$(pwd)
714 +GIT_BUILD_DIR="$TEST_DIRECTORY"/..
715 +
716 if test -n "$valgrind"
717 then
718 make_symlink () {
@@ -737,7 +739,7 @@ then
739 test -x "$1" || return
740
741 base=$(basename "$1")
740 - symlink_target=$TEST_DIRECTORY/../$base
742 + symlink_target=$GIT_BUILD_DIR/$base
743 # do not override scripts
744 if test -x "$symlink_target" &&
745 test ! -d "$symlink_target" &&
@@ -756,7 +758,7 @@ then
758 # override all git executables in TEST_DIRECTORY/..
759 GIT_VALGRIND=$TEST_DIRECTORY/valgrind
760 mkdir -p "$GIT_VALGRIND"/bin
759 - for file in $TEST_DIRECTORY/../git* $TEST_DIRECTORY/../test-*
761 + for file in $GIT_BUILD_DIR/git* $GIT_BUILD_DIR/test-*
762 do
763 make_valgrind_symlink $file
764 done
@@ -777,10 +779,10 @@ then
779 elif test -n "$GIT_TEST_INSTALLED" ; then
780 GIT_EXEC_PATH=$($GIT_TEST_INSTALLED/git --exec-path) ||
781 error "Cannot run git from $GIT_TEST_INSTALLED."
780 - PATH=$GIT_TEST_INSTALLED:$TEST_DIRECTORY/..:$PATH
782 + PATH=$GIT_TEST_INSTALLED:$GIT_BUILD_DIR:$PATH
783 GIT_EXEC_PATH=${GIT_TEST_EXEC_PATH:-$GIT_EXEC_PATH}
784 else # normal case, use ../bin-wrappers only unless $with_dashes:
783 - git_bin_dir="$TEST_DIRECTORY/../bin-wrappers"
785 + git_bin_dir="$GIT_BUILD_DIR/bin-wrappers"
786 if ! test -x "$git_bin_dir/git" ; then
787 if test -z "$with_dashes" ; then
788 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:
790 with_dashes=t
791 fi
792 PATH="$git_bin_dir:$PATH"
791 - GIT_EXEC_PATH=$TEST_DIRECTORY/..
793 + GIT_EXEC_PATH=$GIT_BUILD_DIR
794 if test -n "$with_dashes" ; then
793 - PATH="$TEST_DIRECTORY/..:$PATH"
795 + PATH="$GIT_BUILD_DIR:$PATH"
796 fi
797 fi
796 -GIT_BUILD_DIR="$TEST_DIRECTORY"/..
797 -GIT_TEMPLATE_DIR="$TEST_DIRECTORY"/../templates/blt
798 +GIT_TEMPLATE_DIR="$GIT_BUILD_DIR"/templates/blt
799 unset GIT_CONFIG
800 GIT_CONFIG_NOSYSTEM=1
801 GIT_CONFIG_NOGLOBAL=1
@@ -812,22 +813,22 @@ then
813 fi
814 fi
815
815 -GITPERLLIB="$TEST_DIRECTORY"/../perl/blib/lib:"$TEST_DIRECTORY"/../perl/blib/arch/auto/Git
816 +GITPERLLIB="$GIT_BUILD_DIR"/perl/blib/lib:"$GIT_BUILD_DIR"/perl/blib/arch/auto/Git
817 export GITPERLLIB
817 -test -d "$TEST_DIRECTORY"/../templates/blt || {
818 +test -d "$GIT_BUILD_DIR"/templates/blt || {
819 error "You haven't built things yet, have you?"
820 }
821
822 if test -z "$GIT_TEST_INSTALLED" && test -z "$NO_PYTHON"
823 then
823 - GITPYTHONLIB="$TEST_DIRECTORY/../git_remote_helpers/build/lib"
824 + GITPYTHONLIB="$GIT_BUILD_DIR/git_remote_helpers/build/lib"
825 export GITPYTHONLIB
825 - test -d "$TEST_DIRECTORY"/../git_remote_helpers/build || {
826 + test -d "$GIT_BUILD_DIR"/git_remote_helpers/build || {
827 error "You haven't built git_remote_helpers yet, have you?"
828 }
829 fi
830
830 -if ! test -x "$TEST_DIRECTORY"/../test-chmtime; then
831 +if ! test -x "$GIT_BUILD_DIR"/test-chmtime; then
832 echo >&2 'You need to build test-chmtime:'
833 echo >&2 'Run "make test-chmtime" in the source (toplevel) directory'
834 exit 1