From: Junio C Hamano <gitster@pobox.com>
To: "Ævar Arnfjörð Bjarmason" <avarab@gmail.com>
Cc: git@vger.kernel.org
Subject: Re: [PATCH] test: make SYMLINKS prerequisite more robust
Date: Thu, 09 Feb 2023 14:54:46 -0800 [thread overview]
Message-ID: <xmqqlel6laa1.fsf@gitster.g> (raw)
In-Reply-To: <230209.86ttzvy405.gmgdl@evledraar.gmail.com> ("Ævar Arnfjörð Bjarmason"'s message of "Thu, 09 Feb 2023 03:15:07 +0100")
Ævar Arnfjörð Bjarmason <avarab@gmail.com> writes:
>> We
>> are testing "git" with the test suite, so even if with some magic
>> that is still unknown to compat/mingw.h it knows how to read what
>> "ln -s x y" left in "y", until compat/mingw.h::readlink() learns the
>> same trick, asking Perl to decide SYMLINKS prerequisite would not
>> help our test scripts at all.
>
> We could always see if they return the same answer :) But not worth
> pursuing in this case.
Actually we probably should test if "git" can create a symbolic
link, because that is what matters more than what "ln -s" can or
cannot do. We also are interested in the "symbolic link" does
behave as a symbolic link, i.e. writing into it should modify the
contents of the target of the link.
In any case, here is what I have in mind. There is only a symbolic
link 'y' without 'x' (because this happens in a new and empty
directory for evaluating the lazy prerequisite), redirecting output
from the command, which should be 'x', into 'y' will vivify file 'x'
with contents also 'x', and reading 'y' should yield 'x' because it
points at 'x'.
diff --git c/t/test-lib.sh w/t/test-lib.sh
index 6db377f68b..3fb5957bd2 100644
--- c/t/test-lib.sh
+++ w/t/test-lib.sh
@@ -1773,7 +1773,9 @@ test_lazy_prereq PIPE '
test_lazy_prereq SYMLINKS '
# test whether the filesystem supports symbolic links
- ln -s x y && test -h y
+ ln -s x y && test -h y && test-tool readlink y >y &&
+ test "$(cat y)" = x &&
+ test "$(cat x)" = x
'
test_lazy_prereq SYMLINKS_WINDOWS '
next prev parent reply other threads:[~2023-02-09 22:55 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-02-08 19:40 [PATCH] test: make SYMLINKS prerequisite more robust Junio C Hamano
2023-02-08 23:09 ` Ævar Arnfjörð Bjarmason
2023-02-09 1:56 ` Junio C Hamano
2023-02-09 2:15 ` Ævar Arnfjörð Bjarmason
2023-02-09 22:54 ` Junio C Hamano [this message]
2023-02-10 17:31 ` Junio C Hamano
2023-02-10 19:39 ` Ævar Arnfjörð Bjarmason
2023-02-13 9:12 ` Johannes Schindelin
2023-02-13 18:07 ` Junio C Hamano
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=xmqqlel6laa1.fsf@gitster.g \
--to=gitster@pobox.com \
--cc=avarab@gmail.com \
--cc=git@vger.kernel.org \
/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).