t/unit-tests: convert unit-tests to use clar
Subsystems (2)
cover t/unit-tests: convert unit-tests to use clar
Hello,
This small patch series marks the final batch of our existing unit test files transitioned to the Clar testing framework. It covers all the reftable-related test files, and is part of our ongoing effort to standardize our testing framework to enhance its maintainability.
Thanks
Seyi
Seyi Kuforiji (9):
t/unit-tests: adapt lib-reftable{c,h} helper functions to clar t/unit-tests: convert reftable basics test to use clar test framework t/unit-tests: convert reftable block test to use clar t/unit-tests: convert reftable merged test to use clar t/unit-tests: convert reftable pq test to use clar t/unit-tests: convert reftable reader test to use clar t/unit-tests: convert reftable readwrite test to use clar t/unit-tests: convert reftable record test to use clar t/unit-tests: convert reftable stack test to use clar
Makefile | 20 +- t/meson.build | 21 +- t/unit-tests/lib-reftable.c | 26 +- t/unit-tests/lib-reftable.h | 6 +- t/unit-tests/t-reftable-basics.c | 219 ---- t/unit-tests/t-reftable-block.c | 383 ------- t/unit-tests/t-reftable-merged.c | 546 ---------- t/unit-tests/t-reftable-pq.c | 161 --- t/unit-tests/t-reftable-reader.c | 96 -- t/unit-tests/t-reftable-readwrite.c | 985 ------------------ t/unit-tests/t-reftable-record.c | 585 ----------- t/unit-tests/t-reftable-stack.c | 1451 --------------------------- t/unit-tests/u-reftable-basics.c | 195 ++++ t/unit-tests/u-reftable-block.c | 373 +++++++ t/unit-tests/u-reftable-merged.c | 515 ++++++++++ t/unit-tests/u-reftable-pq.c | 152 +++ t/unit-tests/u-reftable-reader.c | 78 ++ t/unit-tests/u-reftable-readwrite.c | 870 ++++++++++++++++ t/unit-tests/u-reftable-record.c | 565 +++++++++++ t/unit-tests/u-reftable-stack.c | 1247 +++++++++++++++++++++++ 20 files changed, 4031 insertions(+), 4463 deletions(-) delete mode 100644 t/unit-tests/t-reftable-basics.c delete mode 100644 t/unit-tests/t-reftable-block.c delete mode 100644 t/unit-tests/t-reftable-merged.c delete mode 100644 t/unit-tests/t-reftable-pq.c delete mode 100644 t/unit-tests/t-reftable-reader.c delete mode 100644 t/unit-tests/t-reftable-readwrite.c delete mode 100644 t/unit-tests/t-reftable-record.c delete mode 100644 t/unit-tests/t-reftable-stack.c create mode 100644 t/unit-tests/u-reftable-basics.c create mode 100644 t/unit-tests/u-reftable-block.c create mode 100644 t/unit-tests/u-reftable-merged.c create mode 100644 t/unit-tests/u-reftable-pq.c create mode 100644 t/unit-tests/u-reftable-reader.c create mode 100644 t/unit-tests/u-reftable-readwrite.c create mode 100644 t/unit-tests/u-reftable-record.c create mode 100644 t/unit-tests/u-reftable-stack.c
Signature · 1 line
2.43.0
PATCH 1/9 t/unit-tests: adapt lib-reftable{c,h} helper functions to clar
Helper functions defined in t/unit-tests/lib-reftable.{c,h} are required for the reftable-related test files to run efficeintly. In the current implementation these functions are designed to conform with our homegrown unit-testing structure. So in other to convert the reftable test files, there is need for a clar specific implementation of these helper functions.
type cast for (size_t i = 0; i < (size_t)stats->ref_stats.blocks; i++) Adapt functions in lib-reftable.{c,h} to use clar. These functions conform with the clar testing framework and become available for all reftable-related test files implemented using the clar testing framework, which requires them. This will be used by subsequent commits.
--- Makefile | 4 ++-- t/meson.build | 4 ++-- t/unit-tests/lib-reftable.c | 26 +++++++++++++------------- t/unit-tests/lib-reftable.h | 6 +++--- 4 files changed, 20 insertions(+), 20 deletions(-)
Makefile +2 -2
@@ -1371,8 +1371,9 @@ CLAR_TEST_SUITES += u-urlmatch-normalization CLAR_TEST_PROG = $(UNIT_TEST_BIN)/unit-tests$(X) CLAR_TEST_OBJS = $(patsubst %,$(UNIT_TEST_DIR)/%.o,$(CLAR_TEST_SUITES)) CLAR_TEST_OBJS += $(UNIT_TEST_DIR)/clar/clar.o -CLAR_TEST_OBJS += $(UNIT_TEST_DIR)/unit-test.o CLAR_TEST_OBJS += $(UNIT_TEST_DIR)/lib-oid.o +CLAR_TEST_OBJS += $(UNIT_TEST_DIR)/lib-reftable.o +CLAR_TEST_OBJS += $(UNIT_TEST_DIR)/unit-test.o UNIT_TEST_PROGRAMS += t-reftable-basics UNIT_TEST_PROGRAMS += t-reftable-block
@@ -1384,7 +1385,6 @@ UNIT_TEST_PROGRAMS += t-reftable-record UNIT_TEST_PROGRAMS += t-reftable-stack UNIT_TEST_PROGS = $(patsubst %,$(UNIT_TEST_BIN)/%$X,$(UNIT_TEST_PROGRAMS)) UNIT_TEST_OBJS += $(UNIT_TEST_DIR)/test-lib.o -UNIT_TEST_OBJS += $(UNIT_TEST_DIR)/lib-reftable.o # xdiff and reftable libs may in turn depend on what is in libgit.a GITLIBS = common-main.o $(LIB_FILE) $(XDIFF_LIB) $(REFTABLE_LIB) $(LIB_FILE)
t/meson.build +2 -2
@@ -18,8 +18,9 @@ clar_test_suites = [ clar_sources = [ 'unit-tests/clar/clar.c', + 'unit-tests/lib-oid.c', + 'unit-tests/lib-reftable.c', 'unit-tests/unit-test.c', - 'unit-tests/lib-oid.c' ] clar_decls_h = custom_target(
@@ -69,7 +70,6 @@ foreach unit_test_program : unit_test_programs unit_test = executable(unit_test_name, sources: [ 'unit-tests/test-lib.c', - 'unit-tests/lib-reftable.c', unit_test_program, ], dependencies: [libgit_commonmain],
t/unit-tests/lib-reftable.c +13 -13
@@ -1,12 +1,12 @@#define DISABLE_SIGN_COMPARE_WARNINGS #include "lib-reftable.h" -#include "test-lib.h" +#include "unit-test.h" #include "reftable/constants.h" #include "reftable/writer.h" #include "strbuf.h" -void t_reftable_set_hash (uint8_t *p,int i,enum reftable_hash id) +void cl_reftable_set_hash (uint8_t *p,int i,enum reftable_hash id) {memset (p, (uint8_t )i,hash_size (id)); }
@@ -22,17 +22,17 @@ static int strbuf_writer_flush(void *arg UNUSED)return 0 ; } -struct reftable_writer *t_reftable_strbuf_writer (struct reftable_buf *buf, +struct reftable_writer *cl_reftable_strbuf_writer (struct reftable_buf *buf,struct reftable_write_options *opts) {struct reftable_writer *writer;int ret =reftable_writer_new (&writer, &strbuf_writer_write, &strbuf_writer_flush, buf, opts); -check (!ret); +cl_assert (ret ==0 );return writer; } -void t_reftable_write_to_buf(struct reftable_buf *buf, +void cl_reftable_write_to_buf(struct reftable_buf *buf, struct reftable_ref_record *refs, size_t nrefs, struct reftable_log_record *logs,
@@ -64,35 +64,35 @@ void t_reftable_write_to_buf(struct reftable_buf *buf, min = ui; } - writer =t_reftable_strbuf_writer (buf, &opts); + writer =cl_reftable_strbuf_writer (buf, &opts);reftable_writer_set_limits (writer, min, max);if (nrefs) { ret =reftable_writer_add_refs (writer, refs, nrefs); - check_int(ret, ==, 0); +cl_assert_equal_i (ret,0 ); }if (nlogs) { ret =reftable_writer_add_logs (writer, logs, nlogs); - check_int(ret, ==, 0); +cl_assert_equal_i (ret,0 ); } ret =reftable_writer_close (writer); - check_int(ret, ==, 0); +cl_assert_equal_i (ret,0 ); stats =reftable_writer_stats (writer); -for (size_t i =0 ; i < stats->ref_stats.blocks; i++) { +for (size_t i =0 ; i < (size_t )stats->ref_stats.blocks; i++) {size_t off = i * (opts.block_size ? opts.block_size :DEFAULT_BLOCK_SIZE );if (!off) off =header_size (opts.hash_id ==REFTABLE_HASH_SHA256 ?2 :1 ); - check_char(buf->buf[off], ==, 'r'); +cl_assert (buf->buf[off] =='r' ); }if (nrefs) - check_int(stats->ref_stats.blocks, >, 0); +cl_assert (stats->ref_stats.blocks >0 );if (nlogs) - check_int(stats->log_stats.blocks, >, 0); +cl_assert (stats->log_stats.blocks >0 );reftable_writer_free (writer); }
t/unit-tests/lib-reftable.h +3 -3
@@ -6,12 +6,12 @@struct reftable_buf ; -void t_reftable_set_hash (uint8_t *p,int i,enum reftable_hash id); +void cl_reftable_set_hash (uint8_t *p,int i,enum reftable_hash id); -struct reftable_writer *t_reftable_strbuf_writer (struct reftable_buf *buf, +struct reftable_writer *cl_reftable_strbuf_writer (struct reftable_buf *buf,struct reftable_write_options *opts); -void t_reftable_write_to_buf(struct reftable_buf *buf, +void cl_reftable_write_to_buf(struct reftable_buf *buf, struct reftable_ref_record *refs, size_t nrecords, struct reftable_log_record *logs,
Signature · 1 line
2.43.0
Re: [PATCH 1/9] t/unit-tests: adapt lib-reftable{c,h} helper functions to clar
Quoted 13 lines · Seyi Kuforiji
Helper functions defined in
t/unit-tests/lib-reftable.{c,h}are required for the reftable-related test files to run efficeintly. In the current implementation these functions are designed to conform with our homegrown unit-testing structure. So in other to convert the reftable test files, there is need for a clar specific implementation of these helper functions.type cast
for (size_t i = 0; i < (size_t)stats->ref_stats.blocks; i++)Adapt functions in lib-reftable.{c,h} to use clar. These functions conform with the clar testing framework and become available for all reftable-related test files implemented using the clar testing framework, which requires them. This will be used by subsequent commits.
Quoted 7 lines
Signed-off-by Seyi Kuforiji <[email protected]>--- Makefile | 4 ++-- t/meson.build | 4 ++-- t/unit-tests/lib-reftable.c | 26 +++++++++++++------------- t/unit-tests/lib-reftable.h | 6 +++--- 4 files changed, 20 insertions(+), 20 deletions(-)
With this step (and nothing else, as this is the first patch in the series) applied to 'master', I see tons of these errors:
CC t/unit-tests/t-reftable-merged.ot/unit-tests/t-reftable-merged.c: In function 'merged_table_from_records':t/unit-tests/t-reftable-merged.c:37:17: error: implicit declaration of function 't_reftable_write_to_buf'; did you mean 'cl_reftable_write_to_buf'? [-Wimplicit-function-declaration]
37 | t_reftable_write_to_buf(&buf[i], refs[i], sizes[i], NULL, 0, &opts);
| ^~~~~~~~~~~~~~~~~~~~~~~
| cl_reftable_write_to_bufRe: [PATCH 1/9] t/unit-tests: adapt lib-reftable{c,h} helper functions to clar
Quoted 27 lines · Junio C Hamano
Quoted 13 lines · Seyi Kuforiji
Helper functions defined in
t/unit-tests/lib-reftable.{c,h}are required for the reftable-related test files to run efficeintly. In the current implementation these functions are designed to conform with our homegrown unit-testing structure. So in other to convert the reftable test files, there is need for a clar specific implementation of these helper functions.type cast
for (size_t i = 0; i < (size_t)stats->ref_stats.blocks; i++)Adapt functions in lib-reftable.{c,h} to use clar. These functions conform with the clar testing framework and become available for all reftable-related test files implemented using the clar testing framework, which requires them. This will be used by subsequent commits.Quoted 7 lines
Signed-off-by Seyi Kuforiji <[email protected]>--- Makefile | 4 ++-- t/meson.build | 4 ++-- t/unit-tests/lib-reftable.c | 26 +++++++++++++------------- t/unit-tests/lib-reftable.h | 6 +++--- 4 files changed, 20 insertions(+), 20 deletions(-)With this step (and nothing else, as this is the first patch in the series) applied to 'master', I see tons of these errors:
Quoted 7 lines
CC
t/unit-tests/t-reftable-merged.ot/unit-tests/t-reftable-merged.c: In function 'merged_table_from_records':t/unit-tests/t-reftable-merged.c:37:17: error: implicit declaration of function 't_reftable_write_to_buf'; did you mean 'cl_reftable_write_to_buf'? [-Wimplicit-function-declaration]37 | t_reftable_write_to_buf(&buf[i], refs[i], sizes[i], NULL, 0, &opts); | ^~~~~~~~~~~~~~~~~~~~~~~ | cl_reftable_write_to_buf
Hi Junio,
Yes, that is expected, as there are reftable test files that depend on the old function names. I navigated this by temporarily porting the functions into the t/unit-tests/unit-test{c,h} file to convert the files and moved them back as soon as I was done converting them. Would it be better to leave them in t/unit-tests/unit-test{c,h} and then create a final patch that migrates them into the `t/unit-tests/lib-reftable{c,h} file?
Thanks
Seyi
Re: [PATCH 1/9] t/unit-tests: adapt lib-reftable{c,h} helper functions to clar
Quoted 14 lines · Seyi Chamber
Quoted 10 lines · Junio C Hamano
With this step (and nothing else, as this is the first patch in the series) applied to 'master', I see tons of these errors:
CC
t/unit-tests/t-reftable-merged.ot/unit-tests/t-reftable-merged.c: In function 'merged_table_from_records':t/unit-tests/t-reftable-merged.c:37:17: error: implicit declaration of function 't_reftable_write_to_buf'; did you mean 'cl_reftable_write_to_buf'? [-Wimplicit-function-declaration]37 | t_reftable_write_to_buf(&buf[i], refs[i], sizes[i], NULL, 0, &opts); | ^~~~~~~~~~~~~~~~~~~~~~~ | cl_reftable_write_to_bufHi Junio,
Quoted 7 lines
Yes, that is expected, as there are
reftabletest files that depend on the old function names. I navigated this by temporarily porting the functions into thet/unit-tests/unit-test{c,h}file to convert the files and moved them back as soon as I was done converting them. Would it be better to leave them int/unit-tests/unit-test{c,h}and then create a final patch that migrates them into the `t/unit-tests/lib-reftable{c,h} file?
We do want the Git history to be fully bisectable so that it is easy for contributors to find out where a specific bug has been introduced. And for the history to be bisectable, we must ensure that every single commit builds and passes our test suite. You can do that e.g. via git rebase $BASE_COMMIT -x 'make -j$(nproc) test, which builds and tests every single commit in your commit series.
So yes, this should be adapted so that the initial commit introduces the new helpers without removing the old helpers yet so that the unit tests that haven't yet been converted continue to build and test just fine.
Thanks!
Patrick
Re: [PATCH 1/9] t/unit-tests: adapt lib-reftable{c,h} helper functions to clar
Quoted 10 lines · Patrick Steinhardt
We do want the Git history to be fully bisectable so that it is easy for contributors to find out where a specific bug has been introduced. And for the history to be bisectable, we must ensure that every single commit builds and passes our test suite. You can do that e.g. via
git rebase $BASE_COMMIT -x 'make -j$(nproc) test, which builds and tests every single commit in your commit series.So yes, this should be adapted so that the initial commit introduces the new helpers without removing the old helpers yet so that the unit tests that haven't yet been converted continue to build and test just fine.
I started writing the same and thought somebody else may have already responded, and found yours. Very well said.
Thanks for spelling out the expectations we have in this project and explaining how to achieve that goal.
PATCH 2/9 t/unit-tests: convert reftable basics test to use clar test framework
In reply to Seyi KuforijiAdapt reftable basics test file to clar by using clar assertions where necessary.Break up test edge case to improve modularity and clarity.
--- Makefile | 2 +- t/meson.build | 2 +- t/unit-tests/t-reftable-basics.c | 219 ------------------------------- t/unit-tests/u-reftable-basics.c | 195 +++++++++++++++++++++++++++ 4 files changed, 197 insertions(+), 221 deletions(-) delete mode 100644 t/unit-tests/t-reftable-basics.c create mode 100644 t/unit-tests/u-reftable-basics.c
Makefile +1 -1
@@ -1362,6 +1362,7 @@ CLAR_TEST_SUITES += u-oid-array CLAR_TEST_SUITES += u-oidmap CLAR_TEST_SUITES += u-oidtree CLAR_TEST_SUITES += u-prio-queue +CLAR_TEST_SUITES += u-reftable-basics CLAR_TEST_SUITES += u-reftable-tree CLAR_TEST_SUITES += u-strbuf CLAR_TEST_SUITES += u-strcmp-offset
@@ -1375,7 +1376,6 @@ CLAR_TEST_OBJS += $(UNIT_TEST_DIR)/lib-oid.o CLAR_TEST_OBJS += $(UNIT_TEST_DIR)/lib-reftable.o CLAR_TEST_OBJS += $(UNIT_TEST_DIR)/unit-test.o -UNIT_TEST_PROGRAMS += t-reftable-basics UNIT_TEST_PROGRAMS += t-reftable-block UNIT_TEST_PROGRAMS += t-reftable-merged UNIT_TEST_PROGRAMS += t-reftable-pq
t/meson.build +1 -1
@@ -8,6 +8,7 @@ clar_test_suites = [ 'unit-tests/u-oidmap.c', 'unit-tests/u-oidtree.c', 'unit-tests/u-prio-queue.c', + 'unit-tests/u-reftable-basics.c', 'unit-tests/u-reftable-tree.c', 'unit-tests/u-strbuf.c', 'unit-tests/u-strcmp-offset.c',
@@ -55,7 +56,6 @@ clar_unit_tests = executable('unit-tests', test('unit-tests', clar_unit_tests) unit_test_programs = [ - 'unit-tests/t-reftable-basics.c', 'unit-tests/t-reftable-block.c', 'unit-tests/t-reftable-merged.c', 'unit-tests/t-reftable-pq.c',
t/unit-tests/t-reftable-basics.c deleted +0 -219
219 lines not on this page · raw message
t/unit-tests/u-reftable-basics.c new file +195 -0
195 lines not on this page · raw message
Signature · 1 line
2.43.0
PATCH 3/9 t/unit-tests: convert reftable block test to use clar
In reply to Seyi KuforijiAdapt reftable block test file to use clar testing framework by using clar assertions where necessary.
--- Makefile | 2 +- t/meson.build | 2 +- t/unit-tests/t-reftable-block.c | 383 -------------------------------- t/unit-tests/u-reftable-block.c | 373 +++++++++++++++++++++++++++++++ 4 files changed, 375 insertions(+), 385 deletions(-) delete mode 100644 t/unit-tests/t-reftable-block.c create mode 100644 t/unit-tests/u-reftable-block.c
Makefile +1 -1
@@ -1363,6 +1363,7 @@ CLAR_TEST_SUITES += u-oidmap CLAR_TEST_SUITES += u-oidtree CLAR_TEST_SUITES += u-prio-queue CLAR_TEST_SUITES += u-reftable-basics +CLAR_TEST_SUITES += u-reftable-block CLAR_TEST_SUITES += u-reftable-tree CLAR_TEST_SUITES += u-strbuf CLAR_TEST_SUITES += u-strcmp-offset
@@ -1376,7 +1377,6 @@ CLAR_TEST_OBJS += $(UNIT_TEST_DIR)/lib-oid.o CLAR_TEST_OBJS += $(UNIT_TEST_DIR)/lib-reftable.o CLAR_TEST_OBJS += $(UNIT_TEST_DIR)/unit-test.o -UNIT_TEST_PROGRAMS += t-reftable-block UNIT_TEST_PROGRAMS += t-reftable-merged UNIT_TEST_PROGRAMS += t-reftable-pq UNIT_TEST_PROGRAMS += t-reftable-reader
t/meson.build +1 -1
@@ -9,6 +9,7 @@ clar_test_suites = [ 'unit-tests/u-oidtree.c', 'unit-tests/u-prio-queue.c', 'unit-tests/u-reftable-basics.c', + 'unit-tests/u-reftable-block.c', 'unit-tests/u-reftable-tree.c', 'unit-tests/u-strbuf.c', 'unit-tests/u-strcmp-offset.c',
@@ -56,7 +57,6 @@ clar_unit_tests = executable('unit-tests', test('unit-tests', clar_unit_tests) unit_test_programs = [ - 'unit-tests/t-reftable-block.c', 'unit-tests/t-reftable-merged.c', 'unit-tests/t-reftable-pq.c', 'unit-tests/t-reftable-reader.c',
t/unit-tests/t-reftable-block.c deleted +0 -383
383 lines not on this page · raw message
t/unit-tests/u-reftable-block.c new file +373 -0
373 lines not on this page · raw message
Signature · 1 line
2.43.0
PATCH 4/9 t/unit-tests: convert reftable merged test to use clar
In reply to Seyi KuforijiAdapt reftable merged test file to use clar testing framework by using clar assertions where necessary.
--- Makefile | 2 +- t/meson.build | 2 +- t/unit-tests/t-reftable-merged.c | 546 ------------------------------- t/unit-tests/u-reftable-merged.c | 515 +++++++++++++++++++++++++++++ 4 files changed, 517 insertions(+), 548 deletions(-) delete mode 100644 t/unit-tests/t-reftable-merged.c create mode 100644 t/unit-tests/u-reftable-merged.c
Makefile +1 -1
@@ -1364,6 +1364,7 @@ CLAR_TEST_SUITES += u-oidtree CLAR_TEST_SUITES += u-prio-queue CLAR_TEST_SUITES += u-reftable-basics CLAR_TEST_SUITES += u-reftable-block +CLAR_TEST_SUITES += u-reftable-merged CLAR_TEST_SUITES += u-reftable-tree CLAR_TEST_SUITES += u-strbuf CLAR_TEST_SUITES += u-strcmp-offset
@@ -1377,7 +1378,6 @@ CLAR_TEST_OBJS += $(UNIT_TEST_DIR)/lib-oid.o CLAR_TEST_OBJS += $(UNIT_TEST_DIR)/lib-reftable.o CLAR_TEST_OBJS += $(UNIT_TEST_DIR)/unit-test.o -UNIT_TEST_PROGRAMS += t-reftable-merged UNIT_TEST_PROGRAMS += t-reftable-pq UNIT_TEST_PROGRAMS += t-reftable-reader UNIT_TEST_PROGRAMS += t-reftable-readwrite
t/meson.build +1 -1
@@ -10,6 +10,7 @@ clar_test_suites = [ 'unit-tests/u-prio-queue.c', 'unit-tests/u-reftable-basics.c', 'unit-tests/u-reftable-block.c', + 'unit-tests/u-reftable-merged.c', 'unit-tests/u-reftable-tree.c', 'unit-tests/u-strbuf.c', 'unit-tests/u-strcmp-offset.c',
@@ -57,7 +58,6 @@ clar_unit_tests = executable('unit-tests', test('unit-tests', clar_unit_tests) unit_test_programs = [ - 'unit-tests/t-reftable-merged.c', 'unit-tests/t-reftable-pq.c', 'unit-tests/t-reftable-reader.c', 'unit-tests/t-reftable-readwrite.c',
t/unit-tests/t-reftable-merged.c deleted +0 -546
546 lines not on this page · raw message
t/unit-tests/u-reftable-merged.c new file +515 -0
515 lines not on this page · raw message
Signature · 1 line
2.43.0
PATCH 5/9 t/unit-tests: convert reftable pq test to use clar
In reply to Seyi KuforijiAdapt reftable priority queue test file to use clar by using clar assertions where necessary.
--- Makefile | 2 +- t/meson.build | 2 +- t/unit-tests/t-reftable-pq.c | 161 ----------------------------------- t/unit-tests/u-reftable-pq.c | 152 +++++++++++++++++++++++++++++++++ 4 files changed, 154 insertions(+), 163 deletions(-) delete mode 100644 t/unit-tests/t-reftable-pq.c create mode 100644 t/unit-tests/u-reftable-pq.c
Makefile +1 -1
@@ -1365,6 +1365,7 @@ CLAR_TEST_SUITES += u-prio-queue CLAR_TEST_SUITES += u-reftable-basics CLAR_TEST_SUITES += u-reftable-block CLAR_TEST_SUITES += u-reftable-merged +CLAR_TEST_SUITES += u-reftable-pq CLAR_TEST_SUITES += u-reftable-tree CLAR_TEST_SUITES += u-strbuf CLAR_TEST_SUITES += u-strcmp-offset
@@ -1378,7 +1379,6 @@ CLAR_TEST_OBJS += $(UNIT_TEST_DIR)/lib-oid.o CLAR_TEST_OBJS += $(UNIT_TEST_DIR)/lib-reftable.o CLAR_TEST_OBJS += $(UNIT_TEST_DIR)/unit-test.o -UNIT_TEST_PROGRAMS += t-reftable-pq UNIT_TEST_PROGRAMS += t-reftable-reader UNIT_TEST_PROGRAMS += t-reftable-readwrite UNIT_TEST_PROGRAMS += t-reftable-record
t/meson.build +1 -1
@@ -11,6 +11,7 @@ clar_test_suites = [ 'unit-tests/u-reftable-basics.c', 'unit-tests/u-reftable-block.c', 'unit-tests/u-reftable-merged.c', + 'unit-tests/u-reftable-pq.c', 'unit-tests/u-reftable-tree.c', 'unit-tests/u-strbuf.c', 'unit-tests/u-strcmp-offset.c',
@@ -58,7 +59,6 @@ clar_unit_tests = executable('unit-tests', test('unit-tests', clar_unit_tests) unit_test_programs = [ - 'unit-tests/t-reftable-pq.c', 'unit-tests/t-reftable-reader.c', 'unit-tests/t-reftable-readwrite.c', 'unit-tests/t-reftable-record.c',
t/unit-tests/t-reftable-pq.c deleted +0 -161
161 lines not on this page · raw message
t/unit-tests/u-reftable-pq.c new file +152 -0
152 lines not on this page · raw message
Signature · 1 line
2.43.0
PATCH 6/9 t/unit-tests: convert reftable reader test to use clar
In reply to Seyi KuforijiAdapt reftable reader test file to use clar by using clar assertions where necessary.
--- Makefile | 2 +- t/meson.build | 2 +- t/unit-tests/t-reftable-reader.c | 96 -------------------------------- t/unit-tests/u-reftable-reader.c | 78 ++++++++++++++++++++++++++ 4 files changed, 80 insertions(+), 98 deletions(-) delete mode 100644 t/unit-tests/t-reftable-reader.c create mode 100644 t/unit-tests/u-reftable-reader.c
Makefile +1 -1
@@ -1366,6 +1366,7 @@ CLAR_TEST_SUITES += u-reftable-basics CLAR_TEST_SUITES += u-reftable-block CLAR_TEST_SUITES += u-reftable-merged CLAR_TEST_SUITES += u-reftable-pq +CLAR_TEST_SUITES += u-reftable-reader CLAR_TEST_SUITES += u-reftable-tree CLAR_TEST_SUITES += u-strbuf CLAR_TEST_SUITES += u-strcmp-offset
@@ -1379,7 +1380,6 @@ CLAR_TEST_OBJS += $(UNIT_TEST_DIR)/lib-oid.o CLAR_TEST_OBJS += $(UNIT_TEST_DIR)/lib-reftable.o CLAR_TEST_OBJS += $(UNIT_TEST_DIR)/unit-test.o -UNIT_TEST_PROGRAMS += t-reftable-reader UNIT_TEST_PROGRAMS += t-reftable-readwrite UNIT_TEST_PROGRAMS += t-reftable-record UNIT_TEST_PROGRAMS += t-reftable-stack
t/meson.build +1 -1
@@ -12,6 +12,7 @@ clar_test_suites = [ 'unit-tests/u-reftable-block.c', 'unit-tests/u-reftable-merged.c', 'unit-tests/u-reftable-pq.c', + 'unit-tests/u-reftable-reader.c', 'unit-tests/u-reftable-tree.c', 'unit-tests/u-strbuf.c', 'unit-tests/u-strcmp-offset.c',
@@ -59,7 +60,6 @@ clar_unit_tests = executable('unit-tests', test('unit-tests', clar_unit_tests) unit_test_programs = [ - 'unit-tests/t-reftable-reader.c', 'unit-tests/t-reftable-readwrite.c', 'unit-tests/t-reftable-record.c', 'unit-tests/t-reftable-stack.c',
t/unit-tests/t-reftable-reader.c deleted +0 -96
96 lines not on this page · raw message
t/unit-tests/u-reftable-reader.c new file +78 -0
78 lines not on this page · raw message
Signature · 1 line
2.43.0
PATCH 7/9 t/unit-tests: convert reftable readwrite test to use clar
In reply to Seyi KuforijiAdapt reftable readwrite test file to use clar by using clar assertions where necessary.
--- Makefile | 2 +- t/meson.build | 2 +- t/unit-tests/t-reftable-readwrite.c | 985 ---------------------------- t/unit-tests/u-reftable-readwrite.c | 870 ++++++++++++++++++++++++ 4 files changed, 872 insertions(+), 987 deletions(-) delete mode 100644 t/unit-tests/t-reftable-readwrite.c create mode 100644 t/unit-tests/u-reftable-readwrite.c
Makefile +1 -1
@@ -1367,6 +1367,7 @@ CLAR_TEST_SUITES += u-reftable-block CLAR_TEST_SUITES += u-reftable-merged CLAR_TEST_SUITES += u-reftable-pq CLAR_TEST_SUITES += u-reftable-reader +CLAR_TEST_SUITES += u-reftable-readwrite CLAR_TEST_SUITES += u-reftable-tree CLAR_TEST_SUITES += u-strbuf CLAR_TEST_SUITES += u-strcmp-offset
@@ -1380,7 +1381,6 @@ CLAR_TEST_OBJS += $(UNIT_TEST_DIR)/lib-oid.o CLAR_TEST_OBJS += $(UNIT_TEST_DIR)/lib-reftable.o CLAR_TEST_OBJS += $(UNIT_TEST_DIR)/unit-test.o -UNIT_TEST_PROGRAMS += t-reftable-readwrite UNIT_TEST_PROGRAMS += t-reftable-record UNIT_TEST_PROGRAMS += t-reftable-stack UNIT_TEST_PROGS = $(patsubst %,$(UNIT_TEST_BIN)/%$X,$(UNIT_TEST_PROGRAMS))
t/meson.build +1 -1
@@ -13,6 +13,7 @@ clar_test_suites = [ 'unit-tests/u-reftable-merged.c', 'unit-tests/u-reftable-pq.c', 'unit-tests/u-reftable-reader.c', + 'unit-tests/u-reftable-readwrite.c', 'unit-tests/u-reftable-tree.c', 'unit-tests/u-strbuf.c', 'unit-tests/u-strcmp-offset.c',
@@ -60,7 +61,6 @@ clar_unit_tests = executable('unit-tests', test('unit-tests', clar_unit_tests) unit_test_programs = [ - 'unit-tests/t-reftable-readwrite.c', 'unit-tests/t-reftable-record.c', 'unit-tests/t-reftable-stack.c', ]
t/unit-tests/t-reftable-readwrite.c deleted +0 -985
985 lines not on this page · raw message
t/unit-tests/u-reftable-readwrite.c new file +870 -0
870 lines not on this page · raw message
Signature · 1 line
2.43.0
PATCH 8/9 t/unit-tests: convert reftable record test to use clar
In reply to Seyi KuforijiAdapt reftable record test file to use clar by using clar assertions where necessary.
--- Makefile | 2 +- t/meson.build | 2 +- t/unit-tests/t-reftable-record.c | 585 ------------------------------- t/unit-tests/u-reftable-record.c | 565 +++++++++++++++++++++++++++++ 4 files changed, 567 insertions(+), 587 deletions(-) delete mode 100644 t/unit-tests/t-reftable-record.c create mode 100644 t/unit-tests/u-reftable-record.c
Makefile +1 -1
@@ -1368,6 +1368,7 @@ CLAR_TEST_SUITES += u-reftable-merged CLAR_TEST_SUITES += u-reftable-pq CLAR_TEST_SUITES += u-reftable-reader CLAR_TEST_SUITES += u-reftable-readwrite +CLAR_TEST_SUITES += u-reftable-record CLAR_TEST_SUITES += u-reftable-tree CLAR_TEST_SUITES += u-strbuf CLAR_TEST_SUITES += u-strcmp-offset
@@ -1381,7 +1382,6 @@ CLAR_TEST_OBJS += $(UNIT_TEST_DIR)/lib-oid.o CLAR_TEST_OBJS += $(UNIT_TEST_DIR)/lib-reftable.o CLAR_TEST_OBJS += $(UNIT_TEST_DIR)/unit-test.o -UNIT_TEST_PROGRAMS += t-reftable-record UNIT_TEST_PROGRAMS += t-reftable-stack UNIT_TEST_PROGS = $(patsubst %,$(UNIT_TEST_BIN)/%$X,$(UNIT_TEST_PROGRAMS)) UNIT_TEST_OBJS += $(UNIT_TEST_DIR)/test-lib.o
t/meson.build +1 -1
@@ -14,6 +14,7 @@ clar_test_suites = [ 'unit-tests/u-reftable-pq.c', 'unit-tests/u-reftable-reader.c', 'unit-tests/u-reftable-readwrite.c', + 'unit-tests/u-reftable-record.c', 'unit-tests/u-reftable-tree.c', 'unit-tests/u-strbuf.c', 'unit-tests/u-strcmp-offset.c',
@@ -61,7 +62,6 @@ clar_unit_tests = executable('unit-tests', test('unit-tests', clar_unit_tests) unit_test_programs = [ - 'unit-tests/t-reftable-record.c', 'unit-tests/t-reftable-stack.c', ]
t/unit-tests/t-reftable-record.c deleted +0 -585
585 lines not on this page · raw message
t/unit-tests/u-reftable-record.c new file +565 -0
565 lines not on this page · raw message
Signature · 1 line
2.43.0
PATCH 9/9 t/unit-tests: convert reftable stack test to use clar
In reply to Seyi KuforijiAdapt reftable stack test file to use clar by using clar assertions where necessary.
This marks the end of all unit tests migrated away from the unit-tests/t-*.c pattern, there are no longer any files matching that glob. Remove the sanity check for t-*.c files to prevent Meson configuration errors during CI and local builds.
--- Makefile | 2 +- t/meson.build | 3 +- t/unit-tests/t-reftable-stack.c | 1451 ------------------------------- t/unit-tests/u-reftable-stack.c | 1247 ++++++++++++++++++++++++++ 4 files changed, 1249 insertions(+), 1454 deletions(-) delete mode 100644 t/unit-tests/t-reftable-stack.c create mode 100644 t/unit-tests/u-reftable-stack.c
Makefile +1 -1
@@ -1369,6 +1369,7 @@ CLAR_TEST_SUITES += u-reftable-pq CLAR_TEST_SUITES += u-reftable-reader CLAR_TEST_SUITES += u-reftable-readwrite CLAR_TEST_SUITES += u-reftable-record +CLAR_TEST_SUITES += u-reftable-stack CLAR_TEST_SUITES += u-reftable-tree CLAR_TEST_SUITES += u-strbuf CLAR_TEST_SUITES += u-strcmp-offset
@@ -1382,7 +1383,6 @@ CLAR_TEST_OBJS += $(UNIT_TEST_DIR)/lib-oid.o CLAR_TEST_OBJS += $(UNIT_TEST_DIR)/lib-reftable.o CLAR_TEST_OBJS += $(UNIT_TEST_DIR)/unit-test.o -UNIT_TEST_PROGRAMS += t-reftable-stack UNIT_TEST_PROGS = $(patsubst %,$(UNIT_TEST_BIN)/%$X,$(UNIT_TEST_PROGRAMS)) UNIT_TEST_OBJS += $(UNIT_TEST_DIR)/test-lib.o
t/meson.build +1 -2
@@ -15,6 +15,7 @@ clar_test_suites = [ 'unit-tests/u-reftable-reader.c', 'unit-tests/u-reftable-readwrite.c', 'unit-tests/u-reftable-record.c', + 'unit-tests/u-reftable-stack.c', 'unit-tests/u-reftable-tree.c', 'unit-tests/u-strbuf.c', 'unit-tests/u-strcmp-offset.c',
@@ -62,7 +63,6 @@ clar_unit_tests = executable('unit-tests', test('unit-tests', clar_unit_tests) unit_test_programs = [ - 'unit-tests/t-reftable-stack.c', ] foreach unit_test_program : unit_test_programs
@@ -1102,7 +1102,6 @@ integration_tests = [ # sufficient to catch missing test suites in our CI though. foreach glob, tests : { 't[0-9][0-9][0-9][0-9]-*.sh': integration_tests, - 'unit-tests/t-*.c': unit_test_programs, 'unit-tests/u-*.c': clar_test_suites, } actual_tests = run_command(shell, '-c', 'ls ' + glob,
t/unit-tests/t-reftable-stack.c deleted +0 -1451
1,451 lines not on this page · raw message
t/unit-tests/u-reftable-stack.c new file +1247 -0
1,247 lines not on this page · raw message
Signature · 1 line
2.43.0