From: Junio C Hamano <gitster@pobox.com>
To: "René Scharfe" <l.s.r@web.de>
Cc: Git List <git@vger.kernel.org>, Patrick Steinhardt <ps@pks.im>
Subject: Re: [PATCH 4/4] t-reftable-merged: check realloc errors
Date: Thu, 26 Dec 2024 21:46:51 -0800 [thread overview]
Message-ID: <xmqqplldvfsk.fsf@gitster.g> (raw)
In-Reply-To: <6084c017-9557-478b-b485-a1c1a21842e7@web.de> ("René Scharfe"'s message of "Wed, 25 Dec 2024 19:38:49 +0100")
René Scharfe <l.s.r@web.de> writes:
> Report reallocation errors in unit tests, like everywhere else.
OK. That's good for consistency if anything else.
We have a test framework for doing unit test at such low level, yet
we cannot really write tests that validates that the right thing
happens when a particular realloc() call returns NULL, which feels
somewhat disappointing, but that is not a fault of this series.
Thanks.
>
> Signed-off-by: René Scharfe <l.s.r@web.de>
> ---
> t/unit-tests/t-reftable-merged.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/t/unit-tests/t-reftable-merged.c b/t/unit-tests/t-reftable-merged.c
> index a12bd0e1a3..60836f80d6 100644
> --- a/t/unit-tests/t-reftable-merged.c
> +++ b/t/unit-tests/t-reftable-merged.c
> @@ -178,7 +178,7 @@ static void t_merged_refs(void)
> if (err > 0)
> break;
>
> - REFTABLE_ALLOC_GROW(out, len + 1, cap);
> + check(!REFTABLE_ALLOC_GROW(out, len + 1, cap));
> out[len++] = ref;
> }
> reftable_iterator_destroy(&it);
> @@ -459,7 +459,7 @@ static void t_merged_logs(void)
> if (err > 0)
> break;
>
> - REFTABLE_ALLOC_GROW(out, len + 1, cap);
> + check(!REFTABLE_ALLOC_GROW(out, len + 1, cap));
> out[len++] = log;
> }
> reftable_iterator_destroy(&it);
> --
> 2.47.1
next prev parent reply other threads:[~2024-12-27 5:46 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-12-25 18:33 [PATCH 0/4] reftable: fix realloc error handling René Scharfe
2024-12-25 18:38 ` [PATCH 1/4] reftable: avoid leaks on realloc error René Scharfe
2024-12-27 5:39 ` Junio C Hamano
2024-12-27 10:33 ` Patrick Steinhardt
2024-12-27 20:16 ` René Scharfe
2024-12-30 6:29 ` Patrick Steinhardt
2024-12-25 18:38 ` [PATCH 2/4] reftable: fix allocation count " René Scharfe
2024-12-27 10:33 ` Patrick Steinhardt
2024-12-27 20:16 ` René Scharfe
2024-12-27 20:16 ` René Scharfe
2024-12-25 18:38 ` [PATCH 3/4] reftable: handle realloc error in parse_names() René Scharfe
2024-12-25 18:38 ` [PATCH 4/4] t-reftable-merged: check realloc errors René Scharfe
2024-12-27 5:46 ` Junio C Hamano [this message]
2024-12-27 10:34 ` Patrick Steinhardt
2024-12-27 20:16 ` René Scharfe
2024-12-27 10:34 ` [PATCH 0/4] reftable: fix realloc error handling Patrick Steinhardt
2024-12-27 16:02 ` Junio C Hamano
2024-12-28 9:43 ` [PATCH v2 " René Scharfe
2024-12-28 9:47 ` [PATCH v2 1/4] reftable: avoid leaks on realloc error René Scharfe
2024-12-30 7:25 ` Patrick Steinhardt
2024-12-28 9:48 ` [PATCH v2 2/4] reftable: fix allocation count " René Scharfe
2024-12-28 9:48 ` [PATCH v2 3/4] reftable: handle realloc error in parse_names() René Scharfe
2024-12-30 7:25 ` Patrick Steinhardt
2024-12-28 9:49 ` [PATCH v2 4/4] t-reftable-merged: handle realloc errors René Scharfe
2024-12-30 7:25 ` [PATCH v2 0/4] reftable: fix realloc error handling Patrick Steinhardt
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=xmqqplldvfsk.fsf@gitster.g \
--to=gitster@pobox.com \
--cc=git@vger.kernel.org \
--cc=l.s.r@web.de \
--cc=ps@pks.im \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.