git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH 1/3] tests: use "$TEST_DIRECTORY" instead of ".."

From
Jeff King <peff@peff.net>
Date
Aug 9, 2009, 08:37 UTC
Message-ID
<20090809083752.GA8250@coredump.intra.peff.net>
In-Reply-To
<20090809083518.GA8147@coredump.intra.peff.net>

The $TEST_DIRECTORY variable allows tests to find the top-level test directory regardless of the current working directory.

In the past, this has been used to accomodate tests which change directories, but it is also the first step to being able to move trash directories outside of the $TEST_DIRECTORY hierarchy.

Signed-off-by: Jeff King <peff@peff.net>
---
 t/t3404-rebase-interactive.sh            |    2 +-
 t/t3411-rebase-preserve-around-merges.sh |    2 +-
 t/t3414-rebase-preserve-onto.sh          |    2 +-
 t/t4020-diff-external.sh                 |    2 +-
 4 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/t/t3404-rebase-interactive.sh b/t/t3404-rebase-interactive.sh
index a973628..4cae019 100755
--- a/t/t3404-rebase-interactive.sh
+++ b/t/t3404-rebase-interactive.sh
@@ -10,7 +10,7 @@ that the result still makes sense.
 '
 . ./test-lib.sh
 
-. ../lib-rebase.sh
+. "$TEST_DIRECTORY"/lib-rebase.sh
 
 set_fake_editor
 
diff --git a/t/t3411-rebase-preserve-around-merges.sh b/t/t3411-rebase-preserve-around-merges.sh
index 6533505..14a23cd 100755
--- a/t/t3411-rebase-preserve-around-merges.sh
+++ b/t/t3411-rebase-preserve-around-merges.sh
@@ -10,7 +10,7 @@ a merge to before the merge.
 '
 . ./test-lib.sh
 
-. ../lib-rebase.sh
+. "$TEST_DIRECTORY"/lib-rebase.sh
 
 set_fake_editor
 
diff --git a/t/t3414-rebase-preserve-onto.sh b/t/t3414-rebase-preserve-onto.sh
index 80019ee..ee0a6cc 100755
--- a/t/t3414-rebase-preserve-onto.sh
+++ b/t/t3414-rebase-preserve-onto.sh
@@ -10,7 +10,7 @@ aren'"'"'t on top of $ONTO, even if they are on top of $UPSTREAM.
 '
 . ./test-lib.sh
 
-. ../lib-rebase.sh
+. "$TEST_DIRECTORY"/lib-rebase.sh
 
 # Set up branches like this:
 # A1---B1---E1---F1---G1
diff --git a/t/t4020-diff-external.sh b/t/t4020-diff-external.sh
index 4ea42e0..a7602cf 100755
--- a/t/t4020-diff-external.sh
+++ b/t/t4020-diff-external.sh
@@ -166,7 +166,7 @@ test_expect_success 'diff --cached' '
 	git update-index --assume-unchanged file &&
 	echo second >file &&
 	git diff --cached >actual &&
-	test_cmp ../t4020/diff.NUL actual
+	test_cmp "$TEST_DIRECTORY"/t4020/diff.NUL actual
 '
 
 test_done
-- 
1.6.4.178.g7a987
Previous: Jeff KingNext: Jeff King
Message 2 of 7 in “moving test trash directories”
  1. 0/3 moving test trash directoriesJeff King, Aug 9, 2009
  2. 1/3 tests: use "$TEST_DIRECTORY" instead of ".."Jeff King, Aug 9, 2009
  3. 2/3 tests: provide $TRASH_DIRECTORY variableJeff King, Aug 9, 2009
  4. 3/3 tests: allow user to specify trash directory locationJeff King, Aug 9, 2009
  5. Johannes SixtAug 9, 2009
  6. Johannes SchindelinAug 9, 2009
  7. 4/3 t/Makefile: include config.makJeff King, Aug 9, 2009

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.