From: "Ævar Arnfjörð Bjarmason" <avarab@gmail.com>
To: git@vger.kernel.org
Cc: "Junio C Hamano" <gitster@pobox.com>,
"Taylor Blau" <me@ttaylorr.com>,
"Ævar Arnfjörð Bjarmason" <avarab@gmail.com>
Subject: [PATCH v3 2/4] test-lib: correct commentary on TEST_DIRECTORY overriding
Date: Mon, 21 Feb 2022 16:58:33 +0100 [thread overview]
Message-ID: <patch-v3-2.4-33a628e9c3a-20220221T155656Z-avarab@gmail.com> (raw)
In-Reply-To: <cover-v3-0.4-00000000000-20220221T155656Z-avarab@gmail.com>
Correct a misleading comment added by me in 62f539043c7 (test-lib:
Allow overriding of TEST_DIRECTORY, 2010-08-19).
Between that comment and the later addition of
85176d72513 (test-lib.sh: convert $TEST_DIRECTORY to an absolute path,
2013-11-17) the comments were on the wrong arms of the "if". I.e. the
"allow tests to override this" was on the "test -z" arm.
But more importantly this could be read allowing the "$TEST_DIRECTORY"
to be some path outside of t/. As explained in the updated comment
that's impossible, rather it was meant for *tests* that ran outside of
t/, i.e. the "t0000-basic.sh" tests that use "lib-subtest.sh".
Those tests have a different working directory, but they set the
"TEST_DIRECTORY" to the same path for bootstrapping. The comments now
reflect that, and further comment on why we have a hard dependency on
this.
Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
---
t/test-lib.sh | 17 ++++++++++++-----
1 file changed, 12 insertions(+), 5 deletions(-)
diff --git a/t/test-lib.sh b/t/test-lib.sh
index 55f263a02d3..77c3fabd041 100644
--- a/t/test-lib.sh
+++ b/t/test-lib.sh
@@ -19,13 +19,20 @@
# t/ subdirectory and are run in 'trash directory' subdirectory.
if test -z "$TEST_DIRECTORY"
then
- # We allow tests to override this, in case they want to run tests
- # outside of t/, e.g. for running tests on the test library
- # itself.
- TEST_DIRECTORY=$(pwd)
-else
# ensure that TEST_DIRECTORY is an absolute path so that it
# is valid even if the current working directory is changed
+ TEST_DIRECTORY=$(pwd)
+else
+ # The TEST_DIRECTORY will always be the path to the "t"
+ # directory in the git.git checkout. This is overridden by
+ # e.g. t/lib-subtest.sh, but only because its $(pwd) is
+ # different. Those tests still set "$TEST_DIRECTORY" to the
+ # same path.
+ #
+ # See use of "$GIT_BUILD_DIR" and "$TEST_DIRECTORY" below for
+ # hard assumptions about "$GIT_BUILD_DIR/t" existing and being
+ # the "$TEST_DIRECTORY", and e.g. "$TEST_DIRECTORY/helper"
+ # needing to exist.
TEST_DIRECTORY=$(cd "$TEST_DIRECTORY" && pwd) || exit 1
fi
if test -z "$TEST_OUTPUT_DIRECTORY"
--
2.35.1.1132.ga1fe46f8690
next prev parent reply other threads:[~2022-02-21 15:59 UTC|newest]
Thread overview: 39+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-02-18 21:01 [PATCH 0/4] test-lib: improve LSAN + ASAN stack traces Ævar Arnfjörð Bjarmason
2022-02-18 21:01 ` [PATCH 1/4] test-lib: add XSAN_OPTIONS, inherit [AL]SAN_OPTIONS Ævar Arnfjörð Bjarmason
2022-02-18 23:20 ` Junio C Hamano
2022-02-19 2:41 ` Taylor Blau
2022-02-19 2:48 ` Ævar Arnfjörð Bjarmason
2022-02-19 2:57 ` Taylor Blau
2022-02-19 3:02 ` Ævar Arnfjörð Bjarmason
2022-02-19 3:51 ` Taylor Blau
2022-02-18 21:01 ` [PATCH 2/4] test-lib: make $GIT_BUILD_DIR an absolute path Ævar Arnfjörð Bjarmason
2022-02-18 23:30 ` Junio C Hamano
2022-02-19 1:58 ` Ævar Arnfjörð Bjarmason
2022-02-19 11:29 ` [PATCH v2 0/4] test-lib: improve LSAN + ASAN stack traces Ævar Arnfjörð Bjarmason
2022-02-19 11:29 ` [PATCH v2 1/4] test-lib: add GIT_XSAN_OPTIONS, inherit [AL]SAN_OPTIONS Ævar Arnfjörð Bjarmason
2022-02-20 7:52 ` Junio C Hamano
2022-02-19 11:29 ` [PATCH v2 2/4] test-lib: correct commentary on TEST_DIRECTORY overriding Ævar Arnfjörð Bjarmason
2022-02-19 11:29 ` [PATCH v2 3/4] test-lib: make $GIT_BUILD_DIR an absolute path Ævar Arnfjörð Bjarmason
2022-02-19 11:29 ` [PATCH v2 4/4] test-lib: add "fast_unwind_on_malloc=0" to LSAN_OPTIONS Ævar Arnfjörð Bjarmason
2022-02-21 2:30 ` [PATCH v2 0/4] test-lib: improve LSAN + ASAN stack traces Taylor Blau
2022-02-21 15:58 ` [PATCH v3 " Ævar Arnfjörð Bjarmason
2022-02-21 15:58 ` [PATCH v3 1/4] test-lib: add GIT_SAN_OPTIONS, inherit [AL]SAN_OPTIONS Ævar Arnfjörð Bjarmason
2022-02-21 15:58 ` Ævar Arnfjörð Bjarmason [this message]
2022-02-21 15:58 ` [PATCH v3 3/4] test-lib: make $GIT_BUILD_DIR an absolute path Ævar Arnfjörð Bjarmason
2022-02-21 17:29 ` Taylor Blau
2022-02-21 18:55 ` Ævar Arnfjörð Bjarmason
2022-02-22 7:19 ` Junio C Hamano
2022-02-22 10:14 ` Ævar Arnfjörð Bjarmason
2022-02-23 20:16 ` Junio C Hamano
2022-02-24 9:14 ` Ævar Arnfjörð Bjarmason
2022-02-24 20:05 ` Junio C Hamano
2022-02-21 15:58 ` [PATCH v3 4/4] test-lib: add "fast_unwind_on_malloc=0" to LSAN_OPTIONS Ævar Arnfjörð Bjarmason
2022-02-21 17:32 ` Taylor Blau
2022-02-21 18:59 ` Ævar Arnfjörð Bjarmason
2022-02-21 17:16 ` [PATCH v3 0/4] test-lib: improve LSAN + ASAN stack traces Junio C Hamano
2022-02-21 18:55 ` Ævar Arnfjörð Bjarmason
2022-02-27 10:25 ` [PATCH v4 " Ævar Arnfjörð Bjarmason
2022-02-27 10:25 ` [PATCH v4 1/4] test-lib: add GIT_SAN_OPTIONS, inherit [AL]SAN_OPTIONS Ævar Arnfjörð Bjarmason
2022-02-27 10:25 ` [PATCH v4 2/4] test-lib: correct and assert TEST_DIRECTORY overriding Ævar Arnfjörð Bjarmason
2022-02-27 10:25 ` [PATCH v4 3/4] test-lib: make $GIT_BUILD_DIR an absolute path Ævar Arnfjörð Bjarmason
2022-02-27 10:25 ` [PATCH v4 4/4] test-lib: add "fast_unwind_on_malloc=0" to LSAN_OPTIONS Ævar Arnfjörð Bjarmason
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=patch-v3-2.4-33a628e9c3a-20220221T155656Z-avarab@gmail.com \
--to=avarab@gmail.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=me@ttaylorr.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.
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 NNTP newsgroup(s).