Repository navigation
Conversation
|
Another way to do this is add a FMT_SIZE_T and FMT_SSIZE_T to curl_setup /* Older versions of the Windows CRT do not support %zu for size_t so we use %Iu instead */
#ifdef _WIN32
#define FMT_SIZE_T "Iu"
#define FMT_SSIZE_T "Id"
#else
#define FMT_SIZE_T "zu"
#define FMT_SSIZE_T "zd"
#endif |
Do you think it's worth it? Is there any I find format macros more annoying to maintain, than casts, so I'd pbly only (It'd be enough to add the mappings to |
|
I think either way is fine for logmsg in testing because the numbers aren't large, we could even wrap logmsg in win32 and scan for %z in the string and replace with %I before passing to printf if you really wanted the least amount of change |
Sounds tempting, but I'm siding with keeping it simple, with the masks
One concern is how to enforce no future |
checksrc would need changes for this. Off the top of my head it keeps the previous line therefore lines like could be detected, but I think not pretty unusual anyway. another way that is more encompassing would be check the path of the filename and check the DIR name passed as option for all c files for the path "tests" then if it's one of those files check the line for %zu and ban |
|
Added an off-by-default checksrc rule for this, and enabled it for this directory only. |
03f513a to
469ae8a
Compare
To catch the use of `%zd`/`%zu` masks in code that uses the CRT printfs. This is currently in docs/example, and upcoming in tests/server in a separate patch. These masks pass compilation in all supported compiler, but, with the CRT of VS2013 and earlier, they result in a runtime crash. There was existing use of these masks in examples. Also: - drop a stale documentation line. Follow-up to c445b74 #15835 - test1185: replace literal `1185` with `%TESTNUMBER`. Cherry-picked from #23378 Closes #23383
469ae8a to
befa126
Compare
- in jobs building tests, also run them. - to maintain CI cycle times, only run unit tests by default, and run all (supported) tests in just one job, carefully selected to be the one running them the fastest. Per job, it takes ~15 seconds to run ~80 unit tests. It takes 5 minutes to run all (~1600) tests. Total job time 5.5-6 minutes. If the full test run turns out to be annoying or grow slow, we disable or limit it to a subset of tests. - run tests with `-j10` parallelism. It results in the fastest runs, based on tests. - to avoid the MSBuild test breaker heuristics, and to improve performance, run tests by directly invoking `runtests.pl` (not via CMake -> MSBuild -> `runtests.pl`). It saves 10-40 seconds per full test run. - when running directly via `runtests.pl`, exclude test 1119 and 1167. It's not compatible with Visual Studio generator builds. - run the artifact upload in parallel with running tests. Running Windows tests in multiple environments makes it more likely they can run on local machines, too, also making them easier to debug. AppVeyor also supports remote access via RDP, which may help debugging notorious Windows issues live, with some luck of reproducing it in a run with RDP access explicitly enabled beforehand. Fixes/improvements via this PR, merged separately: dc99e12 #23467 processhelp.pm: improve task info in trace output (Windows) 70f3f85 #23471 test1488: drop unused C preprocessor logic af9d2dd #23336 cmake: fix preconditions for option `CURL_STATIC_CRT=ON` adf8b78 #23428 setopt: fix setting `CURLWS_NOAUTOPONG` with compilers lacking C99 bool type 780405b #23416 tests: add `--dump-module-paths` debug option (Windows) bc22977 #23400 msvc: replace debug CRT GUI popups with stderr output 87a1dc7 #23396 appveyor: minor improvements 67f3510 #23381 runtests: add `-S` option to show success logs e9af987 #23378 tests/server: fix crashing with VS2013 and earlier 8cdee8a #23377 lib557: exclude three floating point test cases for VS2013 and earlier 1aac64a #23375 test1119, 1167: disable MSYS2 argument conversion narrowly 49f003f #23337 unit1664: add workaround for VS2019 16.3 - VS2022 17.4 x64 miscompile b8f71d6 #23345 test428: skip when running on older MSYS2 versions 2f3f99d #23339 test1119, 1167: disable MSYS2 argument conversion 098d3a0 #23332 runtests: unset `CURL_MEMDEBUG` for curl requests made to the CI API d3e7caf #23335 GHA/windows: drop unused `-ac` runtests options 2874cc6 #23317 mqttd: work around bogus VS2019 32-bit compiler warning e8adc72 #23315 schannel: fix guard for old MSVC workaround Follow-up to 41198e0 #20390 Closes #23306
The test server code uses plain CRT printf functions, and uses the.
%zd,%zumasks inlogmsg()calls. It compiles cleanly with allsupported compilers. But, the CRT of VS2013 (and earlier) do not
actually support these masks, and print
zd/zuas-is instead. This byitself would likely not break tests, but it also leaves the
[s]size_tvarargs unconsumed, which crashes the server on the first client
request.
In practice this means that most tests relying on the test server,
failed. With
sws, the symptom was aRead zd bytesmessage in thelog. E.g.: https://ci.appveyor.com/project/curlorg/curl/builds/54869181
Fix by using
%ld/%lu, with matching casts.Test run: https://ci.appveyor.com/project/curlorg/curl/builds/54882859
(remaining failures are unrelated.)
This has been a potential issue since 2008.
Also:
nas signed when printing it indoh_conn_recv().PRINTFZchecksrc rule for this directory, toavoid reintroducing a silent breakage by using these masks.
Bug: #23306 (comment)
Bug: #23306 (comment)
Ref: 7f47b6e #23383
Cherry-picked from #23306
PRINTFZrule, enable for examples #23383