mirror of
https://github.com/curl/curl.git
synced 2026-04-13 12:41:42 +08:00
87f448ed52
8 Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
34ad78da89
|
curlx: move Curl_strerror, use in src and tests, ban strerror globally
Also:
- tests/server: replace local `sstrerror()` with `curlx_strerror()`.
- tests/server: show the error code next to the string, where missing.
- curlx: use `curl_msnprintf()` when building for src and tests.
(units was already using it.)
- lib: drop unused includes found along the way.
- curlx_strerror(): avoid compiler warning (and another similar one):
```
In file included from servers.c:14:
../../lib/../../lib/curlx/strerr.c: In function ‘curlx_strerror’:
../../lib/../../lib/curlx/strerr.c:328:32: error: ‘snprintf’ output may be truncated before the last format character [-Werror=format-truncation=]
328 | SNPRINTF(buf, buflen, "%s", msg);
| ^
../../lib/../../lib/curlx/strerr.c:47:18: note: ‘snprintf’ output 1 or more bytes (assuming 2) into a destination of size 1
47 | #define SNPRINTF snprintf
| ^
../../lib/../../lib/curlx/strerr.c:328:7: note: in expansion of macro ‘SNPRINTF’
328 | SNPRINTF(buf, buflen, "%s", msg);
| ^~~~~~~~
```
Follow-up to
|
||
|
|
45438c8d6f
|
checksrc: reduce directory-specific exceptions
By making them defaults, then fixing and/or reshuffling remaining exceptions as necessary. - checksrc: ban by default: `snprintf`, `vsnprintf`, `sscanf`, `strtol`. - examples: replace `strtol` with `atoi` to avoid a checksrc exception. - tests/libtest: replace `strtol` with `atol`. - tests/server: replace most `strtol` with `atol`. - tests/server: replace most `strtoul` with `atol`/`atoi`. - tests/server: drop no longer used `util_ultous`. - fix typo in checksrc rules: `vsnprint` -> `vsnprintf`. - update local exceptions. Also: - examples: ban curl printf functions. They're discouraged in user code. - examples: replace curl printf with system printf. Add `snprintf` workaround for <VS2015. - examples/synctime: fix `-Wfloat-equal`. - examples/synctime: exclude for non-Windows and non-UWP Windows. - examples/synctime: build by default. Closes #18823 |
||
|
|
2c90c3aac0
|
build: tidy up compiler definition for tests
- tests: merge cmake commands. - tests: use `target_compile_definitions()`. - tests/server: use generator expression for platform-specific macro. - tests/unit: sync `Makefile.am` comment with cmake. - tests/unit: merge two `AM_CPPFLAGS` lines to keep synced with cmake. - tests: move macro definitions to `first.h` headers from build level. `CURL_NO_OLDIES`, `CURL_DISABLE_DEPRECATION`, `WITHOUT_LIBCURL`, `CURL_STATICLIB` (for servers). To share more logic. Pass `CURL_STATICLIB` in server on all platforms for simplicity. (On non-Windows, it's a no-op. It's already done like this with curlu and libcurltool.) Also for lib: - lib: merge commands. - lib: sync macro order with tests (also in `Makefile.am`). Closes #17768 |
||
|
|
bb50dee510
|
tests/server: de-dupe/merge three sockdaemon() clones into one
Also: tidy up `if()` expressions here and there.
Follow-up to
|
||
|
|
1a70977a83
|
build: drop explicit curlx from hdr paths, refer headers with curlx/ prefix
To make all src and test code refer to curlx headers the same way. Also: - src: move `curlx.h` include to `tool_setup.h`. - src/tool_setup.h: drop stray `curlx/timeval.h`. - servers: de-duplicate `curlx.h` and `curl_setup.h` includes. - libtests, units: drop stray curlx sub-headers in favor of `<curlx/curlx.h>`. - tests: include `curlx.h` with `<>` instead of `""`. To match other parts of the codebase. Closes #17680 |
||
|
|
6a0cd4feb7
|
tests: make individual test sources compile cleanly
Tidy up headers and includes to ensure all individual test source compile cleanly (but not link). To allow running clang-tidy (and possibly other static analyzers) on them. It also improves readability and allows to verify them locally, without the bundle logic. clang-tidy ignores #included C files, so it's blind to bundle C files the include these tests. The current workaround of embedding has a couple of downsides:. meaningless filenames and line numbers, missing issues, messing up self header paths. Thus, running it on individual sources would be beneficial. Also: - de-duplicate includes. - untangle some includes. - formatting/indentation fixes. - merge `getpart.h` into `first.h`. Ref: https://github.com/curl/curl/pull/17680#issuecomment-2991730158 Closes #17703 |
||
|
|
2c27a67daa
|
tests: always make bundles, adapt build and tests
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
|
||
|
|
f4f25505df
|
tests/server: support bundle binary
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, from 45 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 |