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

[PATCH v4 6/7] t-reftable-merged: use reftable_ref_record_equal to compare ref records

From
CPChandra Pratap <chandrapratap3519@gmail.com>
Date
Jul 12, 2024, 05:39 UTC
Message-ID
<20240712055041.6476-7-chandrapratap3519@gmail.com>
In-Reply-To
<20240712055041.6476-1-chandrapratap3519@gmail.com>

In the test t_merged_single_record() defined in t-reftable-merged.c, the 'input' and 'expected' ref records are checked for equality by comparing their update indices. It is very much possible for two different ref records to have the same update indices. Use reftable_ref_record_equal() instead for a stronger check.

Mentored-by: Patrick Steinhardt <ps@pks.im>
Mentored-by: Christian Couder <chriscool@tuxfamily.org>
Signed-off-by: Chandra Pratap <chandrapratap3519@gmail.com>
---
 t/unit-tests/t-reftable-merged.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/t/unit-tests/t-reftable-merged.c b/t/unit-tests/t-reftable-merged.c
index 065b359200..9f9275f871 100644
--- a/t/unit-tests/t-reftable-merged.c
+++ b/t/unit-tests/t-reftable-merged.c
@@ -158,7 +158,7 @@ static void t_merged_single_record(void)
 
 	err = reftable_iterator_next_ref(&it, &ref);
 	check(!err);
-	check_int(ref.update_index, ==, 2);
+	check(reftable_ref_record_equal(&r2[0], &ref, GIT_SHA1_RAWSZ));
 	reftable_ref_record_release(&ref);
 	reftable_iterator_destroy(&it);
 	readers_destroy(readers, 3);
-- 
2.45.GIT
Previous: Chandra PratapNext: Chandra Pratap
Message 40 of 41 in “t: port reftable/merged_test.c to the unit testing framework”
  1. Chandra PratapJul 3, 2024
  2. 1/5 t: move reftable/merged_test.c to the unit testing frameworkChandra Pratap, Jul 3, 2024
  3. Karthik NayakJul 5, 2024
  4. Chandra PratapJul 6, 2024
  5. 2/5 t: harmonize t-reftable-merged.c with coding guidelinesChandra Pratap, Jul 3, 2024
  6. Karthik NayakJul 5, 2024
  7. 3/5 t-reftable-merged: add tests for reftable_merged_table_max_update_indexChandra Pratap, Jul 3, 2024
  8. 4/5 t-reftable-merged: use reftable_ref_record_equal to compare ref recordsChandra Pratap, Jul 3, 2024
  9. Karthik NayakJul 5, 2024
  10. 5/5 t-reftable-merged: add test for REFTABLE_FORMAT_ERRORChandra Pratap, Jul 3, 2024
  11. Karthik NayakJul 5, 2024
  12. [GSoC][PATCH v2 0/7] t: port reftable/merged_test.c to the unit testing frameworkChandra Pratap, Jul 9, 2024
  13. 1/7 t: move reftable/merged_test.c to the unit testing frameworkChandra Pratap, Jul 9, 2024
  14. Justin ToblerJul 9, 2024
  15. 2/7 t: harmonize t-reftable-merged.c with coding guidelinesChandra Pratap, Jul 9, 2024
  16. 3/7 t-reftable-merged: improve the test t_merged_single_record()Chandra Pratap, Jul 9, 2024
  17. 4/7 t-reftable-merged: improve the const-correctness of helper functionsChandra Pratap, Jul 9, 2024
  18. 5/7 t-reftable-merged: add tests for reftable_merged_table_max_update_indexChandra Pratap, Jul 9, 2024
  19. 6/7 t-reftable-merged: use reftable_ref_record_equal to compare ref recordsChandra Pratap, Jul 9, 2024
  20. 7/7 t-reftable-merged: add test for REFTABLE_FORMAT_ERRORChandra Pratap, Jul 9, 2024
  21. Karthik NayakJul 10, 2024
  22. Karthik NayakJul 10, 2024
  23. Junio C HamanoJul 11, 2024
  24. [GSoC][PATCH v3 0/7] t: port reftable/merged_test.c to the unit testing frameworkChandra Pratap, Jul 11, 2024
  25. 1/7 t: move reftable/merged_test.c to the unit testing frameworkChandra Pratap, Jul 11, 2024
  26. 2/7 t: harmonize t-reftable-merged.c with coding guidelinesChandra Pratap, Jul 11, 2024
  27. Junio C HamanoJul 11, 2024
  28. 3/7 t-reftable-merged: improve the test t_merged_single_record()Chandra Pratap, Jul 11, 2024
  29. 4/7 t-reftable-merged: improve the const-correctness of helper functionsChandra Pratap, Jul 11, 2024
  30. 5/7 t-reftable-merged: add tests for reftable_merged_table_max_update_indexChandra Pratap, Jul 11, 2024
  31. 6/7 t-reftable-merged: use reftable_ref_record_equal to compare ref recordsChandra Pratap, Jul 11, 2024
  32. 7/7 t-reftable-merged: add test for REFTABLE_FORMAT_ERRORChandra Pratap, Jul 11, 2024
  33. [GSoC][PATCH v4 0/7] t: port reftable/merged_test.c to the unit testing frameworkChandra Pratap, Jul 12, 2024
  34. 1/7 t: move reftable/merged_test.c to the unit testing frameworkChandra Pratap, Jul 12, 2024
  35. 2/7 t: harmonize t-reftable-merged.c with coding guidelinesChandra Pratap, Jul 12, 2024
  36. 3/7 t-reftable-merged: improve the test t_merged_single_record()Chandra Pratap, Jul 12, 2024
  37. 4/7 t-reftable-merged: improve the const-correctness of helper functionsChandra Pratap, Jul 12, 2024
  38. Patrick SteinhardtJul 24, 2024
  39. 5/7 t-reftable-merged: add tests for reftable_merged_table_max_update_indexChandra Pratap, Jul 12, 2024
  40. 6/7 t-reftable-merged: use reftable_ref_record_equal to compare ref recordsChandra Pratap, Jul 12, 2024
  41. 7/7 t-reftable-merged: add test for REFTABLE_FORMAT_ERRORChandra Pratap, Jul 12, 2024

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.