From: "Ævar Arnfjörð Bjarmason" <avarab@gmail.com>
To: Junio C Hamano <gitster@pobox.com>
Cc: git@vger.kernel.org
Subject: Re: [PATCH] test: make SYMLINKS prerequisite more robust
Date: Thu, 09 Feb 2023 00:09:46 +0100 [thread overview]
Message-ID: <230209.86k00rzqsz.gmgdl@evledraar.gmail.com> (raw)
In-Reply-To: <xmqqwn4sq73f.fsf@gitster.g>
On Wed, Feb 08 2023, Junio C Hamano wrote:
> I see many failures around SYMLINKS prerequisite in Windows tests.
> There are too many to point at, but the pattern seems to be the
> same. Here is one example:
>
> https://github.com/git/git/actions/runs/4127147009/jobs/7130175639#step:5:502
>
> where "ln -s x y && test -h y" succeeds and declares SYMLINKS
> lazy prerequisite is satisfied, but then it fails to run
>
> "ln -s unrelated DS && git update-index --add DS"
>
> with:
>
> error: readlink("DS"): Function not implemented
>
> I wonder if something like this is in order?
I don't have much to contribute on that front, but this is really
missing some "why", this worked before, why is it failing now? Do we
have any idea.
We use "windows-latest", at first I suspected that this was the
2019->2022 migration, which seems to be happening around now:
https://github.blog/changelog/2022-01-11-github-actions-jobs-running-on-windows-latest-are-now-running-on-windows-server-2022/
But looking at a previous successful run on master:
https://github.com/git/git/actions/runs/4089369223/jobs/7052074004
V.s. this current failure:
https://github.com/git/git/actions/runs/4127146869/jobs/7130173444
Shows that both run 2022, and seem to be running the same software,
except that in "set up job" this is different, it was:
Download action repository
'git-for-windows/setup-git-for-windows-sdk@v1'
(SHA:cbe017cd7ae39629bf4e34fce8b1ccd211fec009)
Now:
Download action repository
'git-for-windows/setup-git-for-windows-sdk@v1'
(SHA:848609620edfa4c2fc64838b85fbe19e534236ee)
I have no idea if that's related though...
> diff --git a/t/helper/test-readlink.c b/t/helper/test-readlink.c
> new file mode 100644
> index 0000000000..c300dc8a1a
> --- /dev/null
> +++ b/t/helper/test-readlink.c
> @@ -0,0 +1,19 @@
> +#include "test-tool.h"
> +#include "strbuf.h"
> +
> +static const char *usage_msg = "test-tool readlink file";
> +
> +int cmd__readlink(int ac, const char **av)
> +{
> + struct strbuf buf;
You're leaving the strbuf uninitialized here, use STRBUF_INIT...
> + int ret;
> +
> + if (ac != 2 || !av[1])
> + usage(usage_msg);
> +
> + ret = strbuf_readlink(&buf, av[1], 0);
...it's used here, and there's no implicit strbuf_init() on
strbuf_readlink(). The first thing it does is inspect sb->alloc.
> + if (!ret)
> + printf("%s\n", buf.buf);
Nit: puts(buf.buf);
All in all a simple helper, but isn't this redundant to "test_readlink"?
That requires perl, and once we have this we could just replace it, but
then let's do that here, no?
> diff --git a/t/test-lib.sh b/t/test-lib.sh
> index 01e88781dd..c8094f643b 100644
> --- a/t/test-lib.sh
> +++ b/t/test-lib.sh
> @@ -1773,7 +1773,8 @@ 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 >/dev/null &&
> + test "$(test-tool readlink y)" = x
Why get the exit code, and then proceed to hide the exit code with the
test "$()" pattern, we can just (untested):
echo x >expect &&
test-tool readlink y >actual &&
test_cmp expect actual
If you're trying to avoid leaving litter or cleaning up that's not
needed anymore with these lazy prereqs for a while now (they get their
throw-away temporary directory).
next prev parent reply other threads:[~2023-02-08 23:22 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 [this message]
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
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=230209.86k00rzqsz.gmgdl@evledraar.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).