From: Christian Couder Date: Thu, 02 Jul 2026 09:31:25 GMT Subject: Re: [PATCH v2 05/12] t/unit-tests: introduce test helper to write reftable blocks Message-ID: In-Reply-To: <20260629-pks-reftable-hardening-v2-5-b0228e7d908d@pks.im> On Mon, Jun 29, 2026 at 11:02 AM Patrick Steinhardt wrote: > > Introduce a new test helper that allows us to write reftable blocks. > This helper will be used by subsequent commits. > > Suggested-by: Christian Couder > Signed-off-by: Patrick Steinhardt > --- > t/unit-tests/u-reftable-block.c | 47 ++++++++++++++++++++++++----------------- > 1 file changed, 28 insertions(+), 19 deletions(-) > > diff --git a/t/unit-tests/u-reftable-block.c b/t/unit-tests/u-reftable-block.c > index f4bded7d26..f4e926ce3a 100644 > --- a/t/unit-tests/u-reftable-block.c > +++ b/t/unit-tests/u-reftable-block.c > @@ -14,6 +14,31 @@ license that can be found in the LICENSE file or at > #include "reftable/reftable-error.h" > #include "strbuf.h" > > +static int cl_reftable_write_block(struct reftable_buf *buf, > + uint8_t block_type, > + struct reftable_record *recs, > + size_t nrecs) Yeah, I suggested: int cl_reftable_write_block(struct reftable_buf *buf, uint8_t block_type, size_t block_size, uint32_t header_off, struct reftable_record *recs, size_t nrecs) which accepts `size_t block_size` and `uint32_t header_off` as arguments, so that more existing tests could be refactored using cl_reftable_write_block(). Your choice to not have these extra arguments is reasonable though, as they are not needed for the code that your series adds, and they make the implementation of cl_reftable_write_block() a bit more complex. Also they can still be added in the future if we really want to clean up more existing tests. This version of your series looks good to me now. Thanks.