-
-
Notifications
You must be signed in to change notification settings - Fork 6.8k
unit tests: extract "private" prototypes at build time #17750
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Closed
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@vszakats would you be able to help me and do the necessary cmake version of this in lib/ as I have done in lib/Makefile.am? I'd be grateful. Thanks! |
The build failures so far are more or less expected. This is not complete (yet). |
vszakats
reviewed
Jun 26, 2025
I'll look into it! |
This comment was marked as resolved.
This comment was marked as resolved.
vszakats
reviewed
Jun 26, 2025
a81964e
to
54f4d55
Compare
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
95b43e9
to
896e88a
Compare
vszakats
reviewed
Jun 30, 2025
typo Co-authored-by: Viktor Szakats <vszakats@users.noreply.github.com>
vszakats
added a commit
to vszakats/curl
that referenced
this pull request
Jul 3, 2025
to make `ninja units-clang-tidy` target work without manually building core components first. Follow-up to c9bb9cd curl#17750
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
TODO
V=1
)