Thread (47 messages) 47 messages, 4 authors, 1d ago

Re: [PATCH v2 05/12] t/unit-tests: introduce test helper to write reftable blocks

From: Christian Couder <hidden>
Date: 2026-07-02 09:31:37

On Mon, Jun 29, 2026 at 11:02 AM Patrick Steinhardt [off-list ref] wrote:
quoted hunk ↗ jump to hunk
Introduce a new test helper that allows us to write reftable blocks.
This helper will be used by subsequent commits.

Suggested-by: Christian Couder <redacted>
Signed-off-by: Patrick Steinhardt <redacted>
---
 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.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help