-
-
Notifications
You must be signed in to change notification settings - Fork 6.8k
tests: always make bundles, adapt build and tests #17590
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
c7d3a75
to
02bdd3d
Compare
…nsion), sync with common mk-bundle
Closed
vszakats
added a commit
that referenced
this pull request
Jun 15, 2025
2 tasks
vszakats
added a commit
that referenced
this pull request
Jun 15, 2025
Instead of relying on CMake's built-in unity feature, use `mk-unity.pl`, as already done with autotools. It simplified the build, shortens logs and makes debugging easier because of the fewer build variations. It also allows testing / fixing with cmake and those automatically apply to autotools builds too. cmake builds can be much-much faster, esp. when working the builds themselves. It also enables "unity" in old cmake versions. Basically every test target is a single generated .c source. Also: - drop a `lib` unity workaround for libtests with autotools after fixing the issue in libtests itself. It drops a few exceptions and makes libcurl build faster (in autotools unity). - fix another `lib` autotools unity issue and drop the workaround for it from `mk-unity.pl`. `srcdir` was missing from the header path. - simplify `mk-unity.pl` command-lines, drop exclusions. Follow-up to 2c27a67 #17590 Closes #17628
vszakats
added a commit
that referenced
this pull request
Jun 21, 2025
Derive it from `$BUNDLE` instead. autotools seems to be already relying on `$BUNDLE_SRC` being equal to `$BUNDLE.c`. (I haven't realized this before aaebb45.) Also drop redundant `nodist_<target>_SOURCE` lines in tunits and units. Follow-up to aaebb45 #17688 Follow-up to 2c27a67 #17590 Closes #17692
denandz
pushed a commit
to denandz/curl
that referenced
this pull request
Jun 21, 2025
Make test bundles the default. Drop non-bundle build mode. Also do all the optimizations and tidy-ups this allows, simpler builds, less bundle exceptions, streamlined build mechanics. Also rework the init/deinit macro magic for unit tests. The new method allows using unique init/deinit function names, and calling them with arguments. This is in turn makes it possible to reduce the use of global variables. Note this drop existing build options `-DCURL_TEST_BUNDLES=` from cmake and `--enable-test-bundles` / `--disable-test-bundles` from autotools. Also: - rename test entry functions to have unique names: `test_<testname>` This removes the last exception that was handled in the generator. - fix `make dist` to not miss test sources with test bundles enabled. - sync and merge `tests/mk-bundle.pl` into `scripts/mk-unity.pl`. - mk-unity.pl: add `--embed` option and use it when `CURL_CLANG_TIDY=ON` to ensure that `clang-tidy` does not miss external test C sources. (because `clang-tidy` ignores code that's #included.) - tests/unit: drop no-op setup/stop functions. - tests: reduce symbol scopes, global macros, other fixes and tidy-ups. - tool1621: fix to run, also fix it to pass. - sockfilt: fix Windows compiler warning in certain unity include order, by explicitly including `warnless.h`. Follow-up to 6897aeb curl#17468 Closes curl#17590
denandz
pushed a commit
to denandz/curl
that referenced
this pull request
Jun 21, 2025
Follow-up to 2c27a67 curl#17590 Follow-up to df1ff17 curl#17418 Closes curl#17624
denandz
pushed a commit
to denandz/curl
that referenced
this pull request
Jun 21, 2025
Follow-up to 2c27a67 curl#17590 Closes curl#17625
denandz
pushed a commit
to denandz/curl
that referenced
this pull request
Jun 21, 2025
Instead of relying on CMake's built-in unity feature, use `mk-unity.pl`, as already done with autotools. It simplified the build, shortens logs and makes debugging easier because of the fewer build variations. It also allows testing / fixing with cmake and those automatically apply to autotools builds too. cmake builds can be much-much faster, esp. when working the builds themselves. It also enables "unity" in old cmake versions. Basically every test target is a single generated .c source. Also: - drop a `lib` unity workaround for libtests with autotools after fixing the issue in libtests itself. It drops a few exceptions and makes libcurl build faster (in autotools unity). - fix another `lib` autotools unity issue and drop the workaround for it from `mk-unity.pl`. `srcdir` was missing from the header path. - simplify `mk-unity.pl` command-lines, drop exclusions. Follow-up to 2c27a67 curl#17590 Closes curl#17628
denandz
pushed a commit
to denandz/curl
that referenced
this pull request
Jun 21, 2025
Since all code fits within that, it is more convenient. Co-authored-by: Viktor Szakats Follow-up to 2c27a67 curl#17590 Closes curl#17623
denandz
pushed a commit
to denandz/curl
that referenced
this pull request
Jun 21, 2025
Derive it from `$BUNDLE` instead. autotools seems to be already relying on `$BUNDLE_SRC` being equal to `$BUNDLE.c`. (I haven't realized this before aaebb45.) Also drop redundant `nodist_<target>_SOURCE` lines in tunits and units. Follow-up to aaebb45 curl#17688 Follow-up to 2c27a67 curl#17590 Closes curl#17692
vszakats
added a commit
that referenced
this pull request
Jun 22, 2025
Before this patch the code relied on re-initializing `TEST_HANG_TIMEOUT` macro before compiling each test, to allow them each to override it to a custom value for single tests. Thie required re-including `test.h` into each test. After this patch this macro becomes a global, immutable, default. Tests which want to override it can now use alternate macros that do accept a custom timeout. The only test currently affected is lib1501. Follow-up to 2c27a67 #17590 Closes #17702
17 tasks
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.
Make test bundles the default. Drop non-bundle build mode.
Also do all the optimizations and tidy-ups this allows, simpler builds,
less bundle exceptions, streamlined build mechanics.
Also rework the init/deinit macro magic for unit tests. The new method
allows using unique init/deinit function names, and calling them with
arguments. This is in turn makes it possible to reduce the use of global
variables.
Note this drop existing build options
-DCURL_TEST_BUNDLES=
from cmakeand
--enable-test-bundles
/--disable-test-bundles
from autotools.Also:
test_<testname>
This removes the last exception that was handled in the generator.
make dist
to not miss test sources with test bundles enabled.tests/mk-bundle.pl
intoscripts/mk-unity.pl
.--embed
option and use it whenCURL_CLANG_TIDY=ON
to ensure that
clang-tidy
does not miss external test C sources.(because
clang-tidy
ignores code that's #included.)by explicitly including
warnless.h
.Follow-up to 6897aeb #17468
w/o ws: https://github.com/curl/curl/pull/17590/files?w=1
Also check unity for the same issue.
While the script is adding some build complexity, overall it seems to save some manual labour/annoyance when adding/deleting scripts.
Also, the script is also used for unity anyway, and the script is required to embed sources for
clang-tidy
. The latter isn't somethingsolvable without it, unless
clang-tidy
gets fixed to not ignore #included C sources.clang-tidy
excludes included .c sources from its checks. Fixed by adding an 'embed' mode and enabling it when building withCURL_CLANG_TIDY=ON
.mk-bundle also has a "unity" feature for the misc test source, with autotools. [FUTURE PR]
update: snag:
make dist
is tricky in this case, and adds an extra manual "accounting" job: add to the bundle file twice, then add toMakefile.inc
too.#include
-ing them. To keep them friendly with clang-tidy. [DONE]unit_setup()
,unit_stop()
are referenced from a macro. Making these names unique for each test is still a head-scratcher. Perhaps just removing this macro magic may work? It'd also allow to make somestatic
s local and not stomp on the global namespace. They are an init block with error handling and a deinit block with predefined goto target, used by helper macros.