]> git.ipfire.org Git - thirdparty/curl.git/commit
unit tests: extract "private" prototypes at build time
authorDaniel Stenberg <daniel@haxx.se>
Sun, 29 Jun 2025 12:33:13 +0000 (14:33 +0200)
committerDaniel Stenberg <daniel@haxx.se>
Mon, 30 Jun 2025 21:16:40 +0000 (23:16 +0200)
commitc9bb9cd165c1b25c2fe005befdcfe479fc9b68e1
tree3acb4e5ae4567b8e693b8da461eaa0983b342bfc
parent48d3407d7c14a423320ffd9031ba50f2140305a7
unit tests: extract "private" prototypes at build time

In order to do unit tests for private functions, functions that are
marked UNITTEST but without a global scope in the library, functions
that do not have prototypes in their corresponding header file, unit
tests previously brought their own private prototype *copy* into the
unit test.

This was error-prone when the internal function changes but the change
might be missed in the unit test which then uses an outdated prototype
copy for testing.

This change removes the private prototypes from unit tests and instead
introduces a C file parser that parses the specific C files and extracts
the necessary unit test prototypes into a generated header file for unit
tests to use. This geneated lib/unitprotos.h header is then included by
unit tests that need private prototypes.

Assisted-by: Viktor Szakats
Closes #17750
lib/.gitignore
lib/CMakeLists.txt
lib/Makefile.am
scripts/Makefile.am
scripts/extract-unit-protos [new file with mode: 0755]
tests/unit/CMakeLists.txt
tests/unit/unit1300.c
tests/unit/unit1395.c
tests/unit/unit3212.c
tests/unit/unit3213.c