From: Junio C Hamano Date: Fri, 27 Dec 2024 05:46:51 GMT Subject: Re: [PATCH 4/4] t-reftable-merged: check realloc errors Message-ID: In-Reply-To: <6084c017-9557-478b-b485-a1c1a21842e7@web.de> René Scharfe 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 > --- > 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