Skip to content

Introduce clar testing framework

Patrick Steinhardt git 8 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v8 Latest14 patches 3 repliesIn review
  2. v714 patches 7 repliesSuperseded
  3. v613 patches 12 repliesSuperseded
Earlier versions · 5
VersionPostedPatchesRepliesStatus
v59 patches17 repliesSuperseded
v47 patches2 repliesSuperseded
v3 RFC7 patches12 repliesSuperseded
v2 RFC7 patches4 repliesSuperseded
v1 RFC3 patches33 repliesSuperseded

Changes in v8 from the cover letter

- Properly wire up the "--immediate" flag.

- Give a hint for the syntax to run only specific suites or tests for the "--run" and "--exclude" options.

Patches in v8 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/14t: do not pass GIT_TEST_OPTS to unit tests with provet/Makefile t/run-test.sh+3 -20 replies
2/14t: import the clar unit testing frameworkDocumentation/technical/unit-tests.txt Makefile t/unit-tests/clar/.github/workflows/ci.yml +17 more+2943 -10 replies
3/14t/clar: fix compatibility with NonStopt/unit-tests/clar/clar/sandbox.h+6 -00 replies
4/14clar: avoid compile error with mingw-w64t/unit-tests/clar/clar.c+1 -10 replies
5/14clar(win32): avoid compile error due to unused `fs_copy()`t/unit-tests/clar/clar/fs.h+2 -00 replies
6/14clar: stop including `shellapi.h` unnecessarilyt/unit-tests/clar/clar.c+1 -10 replies
7/14Makefile: fix sparse dependency on GENERATED_HMakefile+2 -20 replies
8/14Makefile: make hdr-check depend on generated headersMakefile+1 -10 replies
9/14Makefile: do not use sparse on third-party sourcesMakefile+2 -10 replies
10/14Makefile: wire up the clar unit testing framework.gitignore Makefile t/Makefile +4 more+95 -42 replies
11/14t/unit-tests: implement test drivert/unit-tests/unit-test.c+43 -20 replies
12/14t/unit-tests: convert strvec tests to use clarMakefile t/unit-tests/strvec.c t/unit-tests/t-strvec.c+242 -2120 replies
13/14t/unit-tests: convert ctype tests to use clarMakefile t/unit-tests/ctype.c t/unit-tests/unit-test.h+69 -110 replies
14/14clar: add CMake supportcontrib/buildsystems/CMakeLists.txt+53 -00 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v8 yet.

Read the v8 thread

Cover letter [PATCH v8 00/14] Introduce clar testing framework

Hi,

this is the 8th version of my patch series that introduces the clar testing framework.

Changes compared to v7:

- Properly wire up the "--immediate" flag.

- Give a hint for the syntax to run only specific suites or tests for the "--run" and "--exclude" options.

Thanks!

Patrick

Johannes Schindelin (4):
clar: avoid compile error with mingw-w64 clar(win32): avoid compile error due to unused fs_copy()
clar: stop including shellapi.h unnecessarily
clar: add CMake support

Patrick Steinhardt (10):
t: do not pass GIT_TEST_OPTS to unit tests with prove
t: import the clar unit testing framework t/clar: fix compatibility with NonStop
Makefile: fix sparse dependency on GENERATED_H
Makefile: make hdr-check depend on generated headers
Makefile: do not use sparse on third-party sources
Makefile: wire up the clar unit testing framework t/unit-tests: implement test driver 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                                   |  53 +-
 contrib/buildsystems/CMakeLists.txt        |  53 ++
 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                | 524 +++++++++++++
 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/strvec.c                      | 241 ++++++
 t/unit-tests/t-strvec.c                    | 211 ------
 t/unit-tests/unit-test.c                   |  47 ++
 t/unit-tests/unit-test.h                   |  10 +
 31 files changed, 3459 insertions(+), 234 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} (68%)
 create mode 100644 t/unit-tests/strvec.c
 delete mode 100644 t/unit-tests/t-strvec.c
 create mode 100644 t/unit-tests/unit-test.c
 create mode 100644 t/unit-tests/unit-test.h

Range-diff against v7:

 1:  b67f10ec0b0 =  1:  b67f10ec0b0 t: do not pass GIT_TEST_OPTS to unit tests with prove
 2:  55a9b46e65f =  2:  55a9b46e65f t: import the clar unit testing framework
 3:  f24401f0a87 =  3:  f24401f0a87 t/clar: fix compatibility with NonStop
 4:  658a601c541 =  4:  658a601c541 clar: avoid compile error with mingw-w64
 5:  0b8a6ac5fed =  5:  0b8a6ac5fed clar(win32): avoid compile error due to unused `fs_copy()`
 6:  c50e7a0ea68 =  6:  c50e7a0ea68 clar: stop including `shellapi.h` unnecessarily
 7:  b8f3f16dd27 =  7:  b8f3f16dd27 Makefile: fix sparse dependency on GENERATED_H
 8:  3d3fe443b9a =  8:  3d3fe443b9a Makefile: make hdr-check depend on generated headers
 9:  7d0f494850a =  9:  7d0f494850a Makefile: do not use sparse on third-party sources
10:  9c74c5ae019 = 10:  9c74c5ae019 Makefile: wire up the clar unit testing framework
11:  8bd5b3e2b29 ! 11:  81d932bfa33 t/unit-tests: implement test driver
    @@ t/unit-tests/unit-test.c
     +	struct string_list exclude_args = STRING_LIST_INIT_NODUP;
     +	int immediate = 0;
     +	struct option options[] = {
    -+		OPT_BOOL('i', "--immediate", &immediate,
    ++		OPT_BOOL('i', "immediate", &immediate,
     +			 N_("immediately exit upon the first failed test")),
    -+		OPT_STRING_LIST('r', "run", &run_args, N_("name"),
    -+				N_("run only test suite or individual test <name>")),
    -+		OPT_STRING_LIST('x', "exclude", &exclude_args, N_("name"),
    -+				N_("exclude test suite <name>")),
    ++		OPT_STRING_LIST('r', "run", &run_args, N_("suite[::test]"),
    ++				N_("run only test suite or individual test <suite[::test]>")),
    ++		OPT_STRING_LIST('x', "exclude", &exclude_args, N_("suite"),
    ++				N_("exclude test suite <suite>")),
     +		OPT_END(),
     +	};
     +	struct strvec args = STRVEC_INIT;
    @@ t/unit-tests/unit-test.c
     +
     +	strvec_push(&args, argv[0]);
     +	strvec_push(&args, "-t");
    ++	if (immediate)
    ++		strvec_push(&args, "-Q");
     +	for (size_t i = 0; i < run_args.nr; i++)
     +		strvec_pushf(&args, "-s%s", run_args.items[i].string);
     +	for (size_t i = 0; i < exclude_args.nr; i++)
12:  3c3b9eacdfb = 12:  604303e31aa t/unit-tests: convert strvec tests to use clar
13:  c8360db2f86 = 13:  ba05b9f1eef t/unit-tests: convert ctype tests to use clar
14:  d51c146cd9d = 14:  8441d29daa8 clar: add CMake support
Signature · 1 line
2.46.0.519.g2e7b89e038.dirty