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

test-lib: Use $TEST_DIRECTORY or $GIT_BUILD_DIR instead of $(pwd) and ../

Change the redundant calls to $(pwd) to use $TEST_DIRECTORY instead. None of these were being executed after we cd'd somewhere else so they weren't actually needed. This also makes it easier to add support for overriding the test library location and run tests in a different directory than t/. 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 aed604c7789146392bb4d4445717388c81c2701f
1 file changed +8 -8
t/test-lib.sh
+8 -8
@@ -793,14 +793,14 @@ else # normal case, use ../bin-wrappers only unless $with_dashes:
793 PATH="$TEST_DIRECTORY/..:$PATH"
794 fi
795 fi
796 -GIT_BUILD_DIR=$(pwd)/..
797 -GIT_TEMPLATE_DIR=$(pwd)/../templates/blt
796 +GIT_BUILD_DIR="$TEST_DIRECTORY"/..
797 +GIT_TEMPLATE_DIR="$TEST_DIRECTORY"/../templates/blt
798 unset GIT_CONFIG
799 GIT_CONFIG_NOSYSTEM=1
800 GIT_CONFIG_NOGLOBAL=1
801 export PATH GIT_EXEC_PATH GIT_TEMPLATE_DIR GIT_CONFIG_NOSYSTEM GIT_CONFIG_NOGLOBAL
802
803 -. ../GIT-BUILD-OPTIONS
803 +. "$GIT_BUILD_DIR"/GIT-BUILD-OPTIONS
804
805 if test -z "$GIT_TEST_CMP"
806 then
@@ -812,22 +812,22 @@ then
812 fi
813 fi
814
815 -GITPERLLIB=$(pwd)/../perl/blib/lib:$(pwd)/../perl/blib/arch/auto/Git
815 +GITPERLLIB="$TEST_DIRECTORY"/../perl/blib/lib:"$TEST_DIRECTORY"/../perl/blib/arch/auto/Git
816 export GITPERLLIB
817 -test -d ../templates/blt || {
817 +test -d "$TEST_DIRECTORY"/../templates/blt || {
818 error "You haven't built things yet, have you?"
819 }
820
821 if test -z "$GIT_TEST_INSTALLED" && test -z "$NO_PYTHON"
822 then
823 - GITPYTHONLIB="$(pwd)/../git_remote_helpers/build/lib"
823 + GITPYTHONLIB="$TEST_DIRECTORY/../git_remote_helpers/build/lib"
824 export GITPYTHONLIB
825 - test -d ../git_remote_helpers/build || {
825 + test -d "$TEST_DIRECTORY"/../git_remote_helpers/build || {
826 error "You haven't built git_remote_helpers yet, have you?"
827 }
828 fi
829
830 -if ! test -x ../test-chmtime; then
830 +if ! test -x "$TEST_DIRECTORY"/../test-chmtime; then
831 echo >&2 'You need to build test-chmtime:'
832 echo >&2 'Run "make test-chmtime" in the source (toplevel) directory'
833 exit 1