-
-
Notifications
You must be signed in to change notification settings - Fork 6.7k
tests/server: support bundle binary #15000
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
Conversation
602937c
to
5dd6751
Compare
d23bcb2
to
1f94bfa
Compare
4bd2924
to
fffba0b
Compare
4c0771f
to
4eb986f
Compare
a380749
to
fb2905b
Compare
575bb18
to
46b8f5f
Compare
c7c9937
to
0d1e3a8
Compare
0d1e3a8
to
0dd5267
Compare
Support multi-target cmake builds via `CURL_DIRSUFFIX` env. Drop using using `-DCMAKE_RUNTIME_OUTPUT_DIRECTORY_*=` as a workaround in CI. Also: - replace `resolve` references in tests with a new `%RESOLVE` variable. - fix `-c` option format in manual. - fix some whitespace. Ref: curl#15000 Cherry-picked from curl#16394
229a1fd
to
a8cd21e
Compare
Support multi-target cmake builds via `CURL_DIRSUFFIX` env. For example: `export CURL_DIRSUFFIX=Debug/`. Multi-target generators place their output to `src/<subdir>/`, `lib/<subdir>/`, `tests/server/<subdir>`, `tests/libtest/<subdir>` and `tests/unit/<subdir>/` by default. Before this patch, `runtests.pl` couldn't run on such builds because it expected the binaries under the their `<subdir>`-less directories. This patch allows to set such subdir and make `runtests.pl` find the binaries. In CI we use multi-target builds with tests for MSVC. It also helps Xcode-generator builds, though in CI we don't have such job running tests. There may be better solutions to configure this, but passing a custom value to `runtests.pl` including its subprocesses is somewhat tricky. The reason the configuration value expects the slash at the end is because MSYS is automagically expanding the env to a (wrong) absolute path if the slash is in the front. Also: - drop the `-DCMAKE_RUNTIME_OUTPUT_DIRECTORY_*=` workaround from CI. - replace `resolve` references in tests with a new `%RESOLVE` variable. It didn't use a filename extension before. After this patch it uses `exe_ext('TOOL')`. I'm not sure if this is the correct choice vs. `exe_ext('SRV')`. - fix `-c` option format in manual. - fix some whitespace. Note, in CI we still tweak `CMAKE_RUNTIME_OUTPUT_DIRECTORY_*` in jobs which share steps between `./configure` and cmake. It's easier that way. Ref: #15000 Cherry-picked from #16394 Closes #16452
5897da9
to
5162525
Compare
It seems unnecessary and possibly unexpected to build test servers with debug-enabled features and memory tracking whenever the tested curl is built like that (which is a requirement for some tests, so curl is mostly built like that when running tests.) It also makes building servers a little bit faster with cmake for the most common cases. You can apply debug options to `tests/server` with these new options: - `./configure`: `--enable-server-debug`. - cmake: `-DENABLE_SERVER_DEBUG`. Also sync the way we pass these macros in autotools, with CMake builds. Before this patch, autotools passed them via `curl_config.h`. After this patch it passes them on the command-line, like cmake builds do. This patch also make these option no longer passed to examples and `http/client` in cmake builds, where they were no-ops anyway. Ref: #15000 Closes #16705
mk-bundle.pl: add .c extension if missing fixup socket_domain differently, drop unused enum type' mk-bundle.pl: drop deduped macros/variables/functions mk-bundle.pl: improve readability of generated code move script to server mk-bundle.pl: add support for raw curl source (to support autotools "unity") mk-bundle: make p_mains static
reshuffle first.c use first: make p_mains static
When non-bundled, the server source is included last. This is important for unity builds because server global variables cannot shadow libcurl function parameters and local variables. Keep this order when doing bundles to avoid triggering more -Wshadow warnings than otherwise. Makefile.inc: move CURLDEBUG-dependent sources to MEMDEBUG Makefile.inc: fixup for non-bundle builds cm: move CURLDEBUG-dependent sources to MEMDEBUG cm: make p_mains static
add first.c, first.h to dist keep resolve tool out of servers Reason is that it's called from data/test* modules where conditionally executing either `server/servers disabled` or `server/disabled` depending on build settings would be problematic. do not checksrc generated bundle source am: keep the origin order of sources Makefile.am: do unity when doing bundle Makefile.am: move first.c last as in cmake am: make p_mains static Makefile.am: add FIRSTFILES to distro
I plan to merge this tomorrow if no objections (and if I finish in time It's extending the existing test bundle feature, that is disabled by |
If libtests, units and servers binaries are all present, auto-enable bundle mode. Drop manual runtests option. Also fix to append executable extension to `libtests` and `units` executables when launching them. Follow-up to f4f2550 curl#15000 Follow-up to 71cf0d1 curl#14772
If libtests, units and servers binaries are all present, auto-enable bundle mode. Drop manual runtests option. Also fix to append executable extension to `libtests` and `units` executables when launching them. Follow-up to f4f2550 curl#15000 Follow-up to 71cf0d1 curl#14772
If libtests, units and servers binaries are all present, auto-enable bundle mode. Drop manual runtests option. Also fix to append executable extension to `libtests` and `units` executables when launching them. Follow-up to f4f2550 curl#15000 Follow-up to 71cf0d1 curl#14772
If libtests, units and servers binaries are all present, auto-enable bundle mode. Drop manual runtests option. Also fix to append executable extension to `libtests` and `units` executables when launching them. Follow-up to f4f2550 curl#15000 Follow-up to 71cf0d1 curl#14772
Here are two CI run with and without test bundles enabled: without: https://github.com/curl/curl/actions/runs/13909934284 Some examples: Cygwin AM: 10m1 vs 1m32 (6.5x) For MSVC it's a 20x reduction, others are also pretty good. |
If libtests, units and servers binaries are all present, auto-enable bundle mode. Drop manual runtests option. Note: Make sure to "make clean" before changing the test bundle build setting. Also fix to append executable extension to all libtest and unit test executables when launching them. This should make it a tiny bit faster on Windows. Follow-up to f4f2550 #15000 Follow-up to 71cf0d1 #14772 Closes #16750
Extend existing
--enable-test-bundles
and-DCURL_TEST_BUNDLES=ON
options to also bundle test server programs into a single binary. With
autotools, also bundle auxiliary libcurl sources for a "unity"-style
build.
It saves almost 10 minutes per run, across all CI jobs.
On average it makes
build tests
steps 25% faster.With CMake, it brings down
testdeps
build steps to 32 to 37, from45 to 64 before this patch, with unity. Without unity it brings it down
from 400-420 to 280-300. For comparison, without unity and bundles,
the number of build steps is around 1850.
With autotools the gain is possibly larger because this patch does unity
and bundle for test servers.
The total reduction of build steps / log lines is 12000. It's 44% of
reduction on average across all CI jobs.
Follow-up to 77401af #16695
Follow-up to 71cf0d1 #14772
Comparison of 'build tests' targets in S(econds) and L(ines/steps),
between before and after this patch:
Before:
GHA/windows: https://github.com/curl/curl/actions/runs/13854983424
GHA/old-linux: https://github.com/curl/curl/actions/runs/13854983399
GHA/non-native: https://github.com/curl/curl/actions/runs/13854983427
GHA/linux-http3: https://github.com/curl/curl/actions/runs/13854983409
GHA/linux: https://github.com/curl/curl/actions/runs/13854983406
GHA/macos: https://github.com/curl/curl/actions/runs/13854983401
Appveyor: https://ci.appveyor.com/project/curlorg/curl/builds/51703551
After:
GHA/windows: https://github.com/curl/curl/actions/runs/13860433850?pr=15000
GHA/old-linux: https://github.com/curl/curl/actions/runs/13860433809?pr=15000
GHA/non-native: https://github.com/curl/curl/actions/runs/13860433828?pr=15000
GHA/linux-http3: https://github.com/curl/curl/actions/runs/13860433806?pr=15000
GHA/linux: https://github.com/curl/curl/actions/runs/13860433848?pr=15000
GHA/macos: https://github.com/curl/curl/actions/runs/13860433835?pr=15000
Appveyor: https://ci.appveyor.com/project/curlorg/curl/builds/51704222
MEMDEBUG
sources in unity for non-CURLDEBUG
builds. Ref: autotools: useCURLDEBUG
to exclude TrackMemory code from unity #16723-bundle
option with something automatic? This would allow running it directly without having to add-bundle
manually to match such build. [SKIP for now] → runtests: auto-detect test bundle builds #16750mk-bundle.pl
,mk-bundle-server.pl
? and perhapsmk-unity.pl
? [SKIP]mk-bundle.pl
and just make it a manualserver.c
that includes all sources? Thus fixing up unity by default, regardless of build-system? also simplifying combinations and ensuring no symbol collision regressions by default? [SKIP, this bundler also does "unity" for autotools builds, which would be impractical the manual way.]test/server cleanup plans:
Curl_wait_ms()
directly instead of the current copy-paste dupe. → [FUTURE]sockdaemon()
copies more. → [FUTURE]sockfilt
/juggle()
on Windows, where the local override ofselect()
may return WindowsGetLastError()
viaerrno
, which is unexpected and was never checked for. It should be a WSA code throughSOCKERRNO
.tests/server: fix to check against winsock2 error codes on Windows #16612 (comment) → [FUTURE]
tvnow()
inutil.c
with coreCurl_now()
? (there is triplicate insrc/tool_util.c
) → curltime: use libcurl time functions in src and tests/server #16653strtoul()
withCurl_str_number()
and ban it. → tests/server: usecurlx_str_numblanks()
to avoiderrno
#16671 (skip those not involved witherrno
, they make the code more complicated)This also reduces
errno
use.wait_ms()
with a better implementation from coreCurl_wait_ms()
.SOCKERRNO
vserrno
constant. → tests/server: fix to check against winsock2 error codes on Windows #16612