git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH v3 03/10] t/unit-tests: convert reftable block test to use clar

From
Patrick Steinhardt <ps@pks.im>
Date
Jun 3, 2025, 14:18 UTC
Message-ID
<aD8EOE1BWWfXxOij@pks.im>
In-Reply-To
<20250602122559.208780-4-kuforiji98@gmail.com>
On Mon, Jun 02, 2025 at 01:25:51PM +0100, Seyi Kuforiji wrote:
Show 25 quoted lines
> diff --git a/t/unit-tests/t-reftable-block.c b/t/unit-tests/u-reftable-block.c
> similarity index 74%
> rename from t/unit-tests/t-reftable-block.c
> rename to t/unit-tests/u-reftable-block.c
> index 52f1dae1c9..5d1419b801 100644
> --- a/t/unit-tests/t-reftable-block.c
> +++ b/t/unit-tests/u-reftable-block.c
> @@ -6,14 +6,15 @@ license that can be found in the LICENSE file or at
>  https://developers.google.com/open-source/licenses/bsd
>  */
>  
> -#include "test-lib.h"
> +#include "unit-test.h"
> +#include "lib-reftable-clar.h"
>  #include "reftable/block.h"
>  #include "reftable/blocksource.h"
>  #include "reftable/constants.h"
>  #include "reftable/reftable-error.h"
>  #include "strbuf.h"
>  
> -static void t_ref_block_read_write(void)
> +void test_reftable_block__index_read_write(void)
>  {
>  	const int header_off = 21; /* random */
>  	struct reftable_record recs[30];

The name here still looks wrong to me. This is about writing ref blocks, not index blocks.

Show 12 quoted lines
> @@ -220,12 +222,12 @@ static void t_obj_block_read_write(void)
>  	struct reftable_buf block_data = REFTABLE_BUF_INIT;
>  
>  	REFTABLE_CALLOC_ARRAY(block_data.buf, block_size);
> -	check(block_data.buf != NULL);
> +	cl_assert(block_data.buf != NULL);
>  	block_data.len = block_size;
>  
>  	ret = block_writer_init(&bw, REFTABLE_BLOCK_TYPE_OBJ, (uint8_t *) block_data.buf, block_size,
>  				header_off, hash_size(REFTABLE_HASH_SHA1));
> -	check(!ret);
> +	cl_assert(ret == 0);

All of these could be retained as `cl_assert(!ret)`, which is more idiomatic in our codebase. Either that, or these should use `cl_assert_equal_i()` to give better diagnostics.

Patrick
Previous: Seyi KuforijiNext: Seyi Kuforiji
Message 9 of 26 in “t/unit-tests: convert unit-tests to use clar”
  1. 00/10 t/unit-tests: convert unit-tests to use clarSeyi Kuforiji, Jun 2, 2025
  2. 01/10 t/unit-tests: implement clar specific reftable test helper functionsSeyi Kuforiji, Jun 2, 2025
  3. Kristoffer HaugsbakkJun 2, 2025
  4. 02/10 t/unit-tests: convert reftable basics test to use clar test frameworkSeyi Kuforiji, Jun 2, 2025
  5. Patrick SteinhardtJun 3, 2025
  6. Seyi KuforijiJun 3, 2025
  7. Patrick SteinhardtJun 3, 2025
  8. 03/10 t/unit-tests: convert reftable block test to use clarSeyi Kuforiji, Jun 2, 2025
  9. Patrick SteinhardtJun 3, 2025
  10. 04/10 t/unit-tests: convert reftable merged test to use clarSeyi Kuforiji, Jun 2, 2025
  11. 05/10 t/unit-tests: convert reftable pq test to use clarSeyi Kuforiji, Jun 2, 2025
  12. 06/10 t/unit-tests: convert reftable table test to use clarSeyi Kuforiji, Jun 2, 2025
  13. Junio C HamanoJun 2, 2025
  14. Seyi KuforijiJun 3, 2025
  15. Junio C HamanoJun 3, 2025
  16. 07/10 t/unit-tests: convert reftable readwrite test to use clarSeyi Kuforiji, Jun 2, 2025
  17. 08/10 t/unit-tests: convert reftable record test to use clarSeyi Kuforiji, Jun 2, 2025
  18. 09/10 t/unit-tests: convert reftable stack test to use clarSeyi Kuforiji, Jun 2, 2025
  19. 10/10 t/unit-tests: finalize migration of reftable-related testsSeyi Kuforiji, Jun 2, 2025
  20. Patrick SteinhardtJun 3, 2025
  21. Seyi KuforijiJun 5, 2025
  22. Patrick SteinhardtJun 5, 2025
  23. Junio C HamanoJun 5, 2025
  24. Junio C HamanoJun 3, 2025
  25. Seyi KuforijiJun 4, 2025
  26. Seyi KuforijiJun 4, 2025

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.