git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: "Ævar Arnfjörð Bjarmason" <avarab@gmail.com>
To: git@vger.kernel.org
Cc: "Junio C Hamano" <gitster@pobox.com>,
	"Ævar Arnfjörð Bjarmason" <avarab@gmail.com>
Subject: [PATCH v3 2/4] test-lib: Use "$GIT_BUILD_DIR" instead of "$TEST_DIRECTORY"/../
Date: Thu, 19 Aug 2010 16:08:10 +0000	[thread overview]
Message-ID: <1282234092-27429-3-git-send-email-avarab@gmail.com> (raw)
In-Reply-To: <1282138473-15613-1-git-send-email-avarab@gmail.com>

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>
---
 t/test-lib.sh |   29 +++++++++++++++--------------
 1 files changed, 15 insertions(+), 14 deletions(-)

diff --git a/t/test-lib.sh b/t/test-lib.sh
index 0e460f9..689aa29 100644
--- a/t/test-lib.sh
+++ b/t/test-lib.sh
@@ -685,7 +685,7 @@ test_create_repo () {
 	repo="$1"
 	mkdir -p "$repo"
 	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?"
 	mv .git/hooks .git/hooks-disabled
 	cd "$owd"
@@ -748,6 +748,8 @@ test_done () {
 # Test the binaries we have just built.  The tests are kept in
 # t/ subdirectory and are run in 'trash directory' subdirectory.
 TEST_DIRECTORY=$(pwd)
+GIT_BUILD_DIR="$TEST_DIRECTORY"/..
+
 if test -n "$valgrind"
 then
 	make_symlink () {
@@ -774,7 +776,7 @@ then
 		test -x "$1" || return
 
 		base=$(basename "$1")
-		symlink_target=$TEST_DIRECTORY/../$base
+		symlink_target=$GIT_BUILD_DIR/$base
 		# do not override scripts
 		if test -x "$symlink_target" &&
 		    test ! -d "$symlink_target" &&
@@ -793,7 +795,7 @@ then
 	# override all git executables in TEST_DIRECTORY/..
 	GIT_VALGRIND=$TEST_DIRECTORY/valgrind
 	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
 		make_valgrind_symlink $file
 	done
@@ -814,10 +816,10 @@ then
 elif test -n "$GIT_TEST_INSTALLED" ; then
 	GIT_EXEC_PATH=$($GIT_TEST_INSTALLED/git --exec-path)  ||
 	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}
 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 -z "$with_dashes" ; then
 			say "$git_bin_dir/git is not executable; using GIT_EXEC_PATH"
@@ -825,13 +827,12 @@ else # normal case, use ../bin-wrappers only unless $with_dashes:
 		with_dashes=t
 	fi
 	PATH="$git_bin_dir:$PATH"
-	GIT_EXEC_PATH=$TEST_DIRECTORY/..
+	GIT_EXEC_PATH=$GIT_BUILD_DIR
 	if test -n "$with_dashes" ; then
-		PATH="$TEST_DIRECTORY/..:$PATH"
+		PATH="$GIT_BUILD_DIR:$PATH"
 	fi
 fi
-GIT_BUILD_DIR="$TEST_DIRECTORY"/..
-GIT_TEMPLATE_DIR="$TEST_DIRECTORY"/../templates/blt
+GIT_TEMPLATE_DIR="$GIT_BUILD_DIR"/templates/blt
 unset GIT_CONFIG
 GIT_CONFIG_NOSYSTEM=1
 GIT_CONFIG_NOGLOBAL=1
@@ -849,22 +850,22 @@ then
 	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
-test -d "$TEST_DIRECTORY"/../templates/blt || {
+test -d "$GIT_BUILD_DIR"/templates/blt || {
 	error "You haven't built things yet, have you?"
 }
 
 if test -z "$GIT_TEST_INSTALLED" && test -z "$NO_PYTHON"
 then
-	GITPYTHONLIB="$TEST_DIRECTORY/../git_remote_helpers/build/lib"
+	GITPYTHONLIB="$GIT_BUILD_DIR/git_remote_helpers/build/lib"
 	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?"
 	}
 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 'Run "make test-chmtime" in the source (toplevel) directory'
 	exit 1
-- 
1.7.2.1.446.g168052

  parent reply	other threads:[~2010-08-19 16:08 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-08-17  9:43 [PATCH] t/t0000-basic.sh: Don't run a passing TODO unless TEST_PASSING_TODO=1 Ævar Arnfjörð Bjarmason
2010-08-17 17:57 ` Sverre Rabbelier
2010-08-17 19:12   ` Junio C Hamano
2010-08-18 13:34     ` [PATCH v2 0/4] Support for running tests outside t/ + don't run a TODO test Ævar Arnfjörð Bjarmason
2010-08-19 16:05       ` Ævar Arnfjörð Bjarmason
2010-08-19 16:05       ` [PATCH v2 1/4] test-lib: Use $TEST_DIRECTORY or $GIT_BUILD_DIR instead of $(pwd) and ../ Ævar Arnfjörð Bjarmason
2010-08-19 16:05       ` [PATCH v2 2/4] test-lib: Use "$GIT_BUILD_DIR" instead of "$TEST_DIRECTORY"/../ Ævar Arnfjörð Bjarmason
2010-08-19 16:06       ` [PATCH v2 3/4] test-lib: Allow overriding of TEST_DIRECTORY Ævar Arnfjörð Bjarmason
2010-08-19 16:06       ` [PATCH v2 4/4] t/t0000-basic.sh: Run the passing TODO test inside its own test-lib Ævar Arnfjörð Bjarmason
2010-08-19 16:08       ` [PATCH v3 0/4] Support for running tests outside t/ + don't run a TODO test Ævar Arnfjörð Bjarmason
2010-08-19 16:18         ` Jeff King
2010-08-19 16:08       ` [PATCH v3 1/4] test-lib: Use $TEST_DIRECTORY or $GIT_BUILD_DIR instead of $(pwd) and ../ Ævar Arnfjörð Bjarmason
2010-08-19 16:08       ` Ævar Arnfjörð Bjarmason [this message]
2010-08-19 16:08       ` [PATCH v3 3/4] test-lib: Allow overriding of TEST_DIRECTORY Ævar Arnfjörð Bjarmason
2010-08-19 16:08       ` [PATCH v3 4/4] t/t0000-basic.sh: Run the passing TODO test inside its own test-lib Ævar Arnfjörð Bjarmason
2010-08-18 13:34     ` [PATCH v2 1/4] test-lib: Use $TEST_DIRECTORY or $GIT_BUILD_DIR instead of $(pwd) and ../ Ævar Arnfjörð Bjarmason
2010-08-18 13:34     ` [PATCH v2 2/4] test-lib: Use "$GIT_BUILD_DIR" instead of "$TEST_DIRECTORY"/../ Ævar Arnfjörð Bjarmason
2010-08-18 13:34     ` [PATCH v2 3/4] test-lib: Allow overriding of TEST_DIRECTORY Ævar Arnfjörð Bjarmason
2010-08-18 13:34     ` [PATCH v2 4/4] t/t0000-basic.sh: Run the passing TODO test inside its own test-lib Ævar Arnfjörð Bjarmason
2010-08-19 17:39       ` Sverre Rabbelier

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1282234092-27429-3-git-send-email-avarab@gmail.com \
    --to=avarab@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).