Message ID | cover.1723712012.git.ps@pks.im (mailing list archive) |
---|---|
Headers | show |
Series | Introduce clar testing framework | expand |
Patrick Steinhardt <ps@pks.im> writes: > Hi, > > this is the fourth version of my patch series that introduces the clar > testing framework for our unit tests. > > Changes compared to v3: > > - Seeing that the overall feedback seems to be rather positive, I've > now dropped the "RFC" prefix. > > - Fix another whitespace-damaged line in the clar unit test. I've > adapted the upstream pull request accordingly. > > - Fix `make hdr-check`, which failed due to the missing dependency on > "clar-decls.h". Similarly, lack of clar.suite still makes "make sparse" fail, it seems. $ make NO_REGEX=NoThanks -j32 sparse ... SP builtin/help.c CC t/unit-tests/ctype.o CC t/unit-tests/strvec.o CC t/unit-tests/clar/clar.o CC t/unit-tests/unit-test.o t/unit-tests/clar/clar.c:209:10: fatal error: clar.suite: No such file or directory 209 | #include "clar.suite" | ^~~~~~~~~~~~ compilation terminated. make: *** [Makefile:2762: t/unit-tests/clar/clar.o] Error 1 make: *** Waiting for unfinished jobs.... The NO_REGEX is there to force us to go check the compat/regex.h as well. > +@@ Makefile: CHK_HDRS = $(filter-out $(EXCEPT_HDRS),$(LIB_H)) > + HCO = $(patsubst %.h,%.hco,$(CHK_HDRS)) > + HCC = $(HCO:hco=hcc) > + > ++$(UNIT_TEST_DIR)/unit-test.hcc: $(UNIT_TEST_DIR)/unit-test.h $(UNIT_TEST_DIR)/clar-decls.h > + %.hcc: %.h > + @echo '#include "git-compat-util.h"' >$@ > + @echo '#include "$<"' >>$@ This is a nice addition. Thanks.
On Thu, Aug 15, 2024 at 09:21:04AM -0700, Junio C Hamano wrote: > Patrick Steinhardt <ps@pks.im> writes: > > > Hi, > > > > this is the fourth version of my patch series that introduces the clar > > testing framework for our unit tests. > > > > Changes compared to v3: > > > > - Seeing that the overall feedback seems to be rather positive, I've > > now dropped the "RFC" prefix. > > > > - Fix another whitespace-damaged line in the clar unit test. I've > > adapted the upstream pull request accordingly. > > > > - Fix `make hdr-check`, which failed due to the missing dependency on > > "clar-decls.h". > > Similarly, lack of clar.suite still makes "make sparse" fail, it > seems. > > $ make NO_REGEX=NoThanks -j32 sparse > ... > SP builtin/help.c > CC t/unit-tests/ctype.o > CC t/unit-tests/strvec.o > CC t/unit-tests/clar/clar.o > CC t/unit-tests/unit-test.o > t/unit-tests/clar/clar.c:209:10: fatal error: clar.suite: No such file or directory > 209 | #include "clar.suite" > | ^~~~~~~~~~~~ > compilation terminated. > make: *** [Makefile:2762: t/unit-tests/clar/clar.o] Error 1 > make: *** Waiting for unfinished jobs.... > > The NO_REGEX is there to force us to go check the compat/regex.h as well. Huh, OK. Wonder why the CI didn't catch this. I'll have another look, thanks. Patrick
Hi, this is the fourth version of my patch series that introduces the clar testing framework for our unit tests. Changes compared to v3: - Seeing that the overall feedback seems to be rather positive, I've now dropped the "RFC" prefix. - Fix another whitespace-damaged line in the clar unit test. I've adapted the upstream pull request accordingly. - Fix `make hdr-check`, which failed due to the missing dependency on "clar-decls.h". Thanks! Patrick Patrick Steinhardt (7): t: do not pass GIT_TEST_OPTS to unit tests with prove t: import the clar unit testing framework t/clar: fix whitespace errors t/clar: fix compatibility with NonStop Makefile: wire up the clar unit testing framework t/unit-tests: convert strvec tests to use clar t/unit-tests: convert ctype tests to use clar .gitignore | 1 + Documentation/technical/unit-tests.txt | 2 + Makefile | 43 +- t/Makefile | 4 +- t/run-test.sh | 2 +- t/unit-tests/.gitignore | 2 + t/unit-tests/clar-generate.awk | 50 ++ t/unit-tests/clar/.github/workflows/ci.yml | 23 + t/unit-tests/clar/COPYING | 15 + t/unit-tests/clar/README.md | 329 ++++++++ t/unit-tests/clar/clar.c | 842 +++++++++++++++++++++ t/unit-tests/clar/clar.h | 173 +++++ t/unit-tests/clar/clar/fixtures.h | 50 ++ t/unit-tests/clar/clar/fs.h | 522 +++++++++++++ t/unit-tests/clar/clar/print.h | 211 ++++++ t/unit-tests/clar/clar/sandbox.h | 159 ++++ t/unit-tests/clar/clar/summary.h | 143 ++++ t/unit-tests/clar/generate.py | 266 +++++++ t/unit-tests/clar/test/.gitignore | 4 + t/unit-tests/clar/test/Makefile | 39 + t/unit-tests/clar/test/clar_test.h | 16 + t/unit-tests/clar/test/main.c | 40 + t/unit-tests/clar/test/main.c.sample | 27 + t/unit-tests/clar/test/resources/test/file | 1 + t/unit-tests/clar/test/sample.c | 84 ++ t/unit-tests/{t-ctype.c => ctype.c} | 71 +- t/unit-tests/{t-strvec.c => strvec.c} | 119 ++- t/unit-tests/unit-test.c | 17 + t/unit-tests/unit-test.h | 3 + 29 files changed, 3160 insertions(+), 98 deletions(-) create mode 100644 t/unit-tests/clar-generate.awk create mode 100644 t/unit-tests/clar/.github/workflows/ci.yml create mode 100644 t/unit-tests/clar/COPYING create mode 100644 t/unit-tests/clar/README.md create mode 100644 t/unit-tests/clar/clar.c create mode 100644 t/unit-tests/clar/clar.h create mode 100644 t/unit-tests/clar/clar/fixtures.h create mode 100644 t/unit-tests/clar/clar/fs.h create mode 100644 t/unit-tests/clar/clar/print.h create mode 100644 t/unit-tests/clar/clar/sandbox.h create mode 100644 t/unit-tests/clar/clar/summary.h create mode 100755 t/unit-tests/clar/generate.py create mode 100644 t/unit-tests/clar/test/.gitignore create mode 100644 t/unit-tests/clar/test/Makefile create mode 100644 t/unit-tests/clar/test/clar_test.h create mode 100644 t/unit-tests/clar/test/main.c create mode 100644 t/unit-tests/clar/test/main.c.sample create mode 100644 t/unit-tests/clar/test/resources/test/file create mode 100644 t/unit-tests/clar/test/sample.c rename t/unit-tests/{t-ctype.c => ctype.c} (71%) rename t/unit-tests/{t-strvec.c => strvec.c} (54%) create mode 100644 t/unit-tests/unit-test.c create mode 100644 t/unit-tests/unit-test.h Range-diff against v3: 1: 78a9cc1162 = 1: 086dd728a7 t: do not pass GIT_TEST_OPTS to unit tests with prove 2: b6c066ee4e = 2: 5c22e0b3b9 t: import the clar unit testing framework 3: 35682b7686 ! 3: e0f99874cc t/clar: fix whitespace errors @@ Commit message Signed-off-by: Patrick Steinhardt <ps@pks.im> + ## t/unit-tests/clar/clar/fs.h ## +@@ t/unit-tests/clar/clar/fs.h: fs_rm_wait(WCHAR *_wpath) + ERROR_PATH_NOT_FOUND == last_error) + return 0; + +- Sleep(RM_RETRY_DELAY * retries * retries); ++ Sleep(RM_RETRY_DELAY * retries * retries); + } + while (retries++ <= RM_RETRY_COUNT); + + ## t/unit-tests/clar/clar/sandbox.h ## @@ t/unit-tests/clar/clar/sandbox.h: find_tmp_path(char *buffer, size_t length) static const size_t var_count = 5; 4: 7a76c21bcb = 4: 75e097dfa4 t/clar: fix compatibility with NonStop 5: 68b3c65951 ! 5: 5b8a64ae79 Makefile: wire up the clar unit testing framework @@ Makefile: endif bin-wrappers/%: wrap-for-bin.sh $(call mkdir_p_parent_template) +@@ Makefile: CHK_HDRS = $(filter-out $(EXCEPT_HDRS),$(LIB_H)) + HCO = $(patsubst %.h,%.hco,$(CHK_HDRS)) + HCC = $(HCO:hco=hcc) + ++$(UNIT_TEST_DIR)/unit-test.hcc: $(UNIT_TEST_DIR)/unit-test.h $(UNIT_TEST_DIR)/clar-decls.h + %.hcc: %.h + @echo '#include "git-compat-util.h"' >$@ + @echo '#include "$<"' >>$@ @@ Makefile: endif artifacts-tar:: $(ALL_COMMANDS_TO_INSTALL) $(SCRIPT_LIB) $(OTHER_PROGRAMS) \ 6: 4a0888380e = 6: bc4e23d666 t/unit-tests: convert strvec tests to use clar 7: f423b01c05 = 7: 0a7fe8775a t/unit-tests: convert ctype tests to use clar