Viktor Szakats [Sat, 28 Sep 2024 18:26:44 +0000 (20:26 +0200)]
tests: simplify `pathhelp.pm`, avoid using external tools
Instead of calling the shell and external tools, rely on Perl functions
like `Cwd::getcwd()`, `Cwd::abs_path()`, `Cygwin::posix_to_win_path()`,
`Cygwin::win_to_posix_path()` to retrieve the current directory and
convert between POSIX and Windows formats.
This adds native Windows Perl support, avoids most failure modes and
makes format guessing and other internal functions unnecessary.
Also:
- delete unused `sys_native_path()`.
- delete redundant `normalize_path()` because Perl `abs_path()` already
does it.
Daniel Stenberg [Tue, 1 Oct 2024 22:01:27 +0000 (00:01 +0200)]
tests: remove debug requirement on 38 tests
For all tests using -O that were previously relying on a debug build and
the CURL_TESTDIR environment variable, use the plain --output-dir option
instead so that they can run proper in non-debug builds.
Viktor Szakats [Tue, 1 Oct 2024 20:16:25 +0000 (22:16 +0200)]
GHA/macos: delete `macos-12` jobs, update matrix for `macos-14`
- Days of `macos-12` are numbered:
https://github.com/actions/runner-images/issues/10721
Drop 5 affected jobs, replaced by `macos-15` ones added earlier today.
- Drop Xcode 14 and 16 from `macos-14` jobs.
Following up upstream announcement:
https://github.com/actions/runner-images/issues/10703
(No active jobs are affected by this.)
Viktor Szakats [Tue, 1 Oct 2024 11:20:09 +0000 (13:20 +0200)]
GHA/macos: Sequoia chores, fixes for llvm 18
- add `macos-15` Sequoia to combinations jobs.
- add `llvm@18` to combinations jobs for `macos-15`.
- fix cmake, autotools configurations for llvm 18.
It requires `CMAKE_OSX_SYSROOT` for cmake, and `--sysroot` within `CC`
for both cmake and autotools.
(Also add `--target` to `CC` for all jobs.)
- stop `brew update` on `macos-12`.
`macos-12` is Monterey. Homebrew stopped providing binaries for it
after the latest macOS was out. It means newer versions of packages
have to be built from source, which is slow and undesired. Try to
avoid it using this trick. If it doesn't work, `macos-12` jobs will
have to be dropped.
Daniel Stenberg [Mon, 30 Sep 2024 21:43:58 +0000 (23:43 +0200)]
select: use poll() if existing, avoid poll() with no sockets
poll() on macOS 10.12 was deemed broken in 2016 when we discovered that
it misbehaves when provided with no sockets to wait for. The
HAVE_POLL_FINE is used to mark a poll() implementation that behaves
correctly: it *should* still wait the timeout time.
curl has therefore opted to use select() on Apple operating systems ever
since. To avoid the risk that this or other breakage cause problems.
However, using select() internally is also bad because it suffers from
problems when using file descriptors beyond 1024.
This change makes poll() used if it is present, but if there is no
sockets to wait for it avoids using poll() and instead falls back to
select() - but without any sockets to wait for there is no 1024 problem.
This removes all previous special-handling involving HAVE_POLL_FINE.
Stefan Eissing [Tue, 1 Oct 2024 09:59:37 +0000 (11:59 +0200)]
ftp: fix 0-length last write on upload from stdin
When uploading FTP with unknown length, we write a last 0-length chunk
with the EOS flag set. OpenSSL's SSL_write() errors on such a write.
Skip writing 0-length data to TLS backends instead.
Viktor Szakats [Mon, 30 Sep 2024 22:41:43 +0000 (00:41 +0200)]
tests: replace hard-coded `/dev/null` with variable
- add variable for the null device filename and use that in Perl code.
- initialize this variable with `NUL` on native Windows.
- add `%DEV_NULL` variable and use it in tests.
Fixes `The system cannot find the path specified.` messages seen when
running `runtests.pl` with native Windows Perl.
Also adjust code to not break mcedit syntax highlighting.
Viktor Szakats [Mon, 30 Sep 2024 21:58:35 +0000 (23:58 +0200)]
tests: add and use `%PERL` variable to refer to the Perl binary
To ensure Perl invocations within tests call the same Perl binary used
for running the tests, as specified or auto-detected via `PERL` env
(autotools) or `PERL_EXECUTABLE` setting (cmake). Instead of the first
`perl` executable found in `PATH`.)
Viktor Szakats [Mon, 30 Sep 2024 11:06:06 +0000 (13:06 +0200)]
cmake: readd `generate-curl.1` dependency for `src` just in case
Trying to fix intermittent build failures with MSVC 2008:
```
unity_0.obj : error LNK2019: unresolved external symbol _showhelp referenced in function _tool_help
unity_0.obj : error LNK2019: unresolved external symbol _hugehelp referenced in function _operate
```
https://ci.appveyor.com/project/curlorg/curl/builds/50700212/job/h3ekljnbccosej5k#L154
https://ci.appveyor.com/project/curlorg/curl/builds/50701615/job/61mkg9og1eooqli8#L155
Viktor Szakats [Mon, 30 Sep 2024 09:11:49 +0000 (11:11 +0200)]
GHA: move Cygwin jobs back into the Windows workflow
Cygwin jobs took 30 minutes and was the reason for moving them to their
own workflow. After recent changes, they finish in 8 minutes, which is
on par or lower than the longest Windows jobs. Thus, Cygwin can now be
moved back to the Windows workflow without causing extra wait for all
the workflow jobs to complete (and allowing a manual retry for the
remaining flaky jobs).
Notice that Cygwin still uses the cygwin/cygwin-install-action action to
install Cygwin itself. This action uses no caching and the time it takes
fluctuates widely depending on mirror speed, congestion and other
things. If Cygwin tends to hold up jobs again for this or other reasons,
this patch may be reverted.
Viktor Szakats [Sun, 29 Sep 2024 10:23:01 +0000 (12:23 +0200)]
GHA/cygwin, msys: move tests to cmake jobs, to finish faster
Move test runs from autotools jobs to cmake ones for Cygwin and MSYS.
This makes producing test results and finishing the workflows faster,
because the cmake build steps are much faster than autotools in these
envs.
Also:
- drop building examples with Cygwin autotools. It takes almost
4 minutes. Keep building them with cmake, taking 20 seconds.
- drop building examples in MSYS autotools jobs that run tests.
Keep building them in autotools jobs without tests. It makes
the longest running job 2 minutes shorter.
After this patch Cygwin job times are on par with or lower than Windows
ones. It means Cygwin doesn't cause extra delay to finish the whole
workflow, allowing to re-merge these jobs into the Windows workflow.
Viktor Szakats [Sat, 28 Sep 2024 10:23:48 +0000 (12:23 +0200)]
ci: tidy-ups
- http3-linux: add newlines for readability.
- http3-linux: use `make pytest` to run pytest.
- checksrc: use `|` multiline to sync with other uses.
- checksrc: prefer `$()`.
- prefer `>-` over `>` for folded option lists.
- cygwin: drop a `grep` no longer necessary.
Viktor Szakats [Sat, 28 Sep 2024 18:42:38 +0000 (20:42 +0200)]
GHA linux: restore `apt-get update`
It seems like the Ubuntu apt mirror list or other preloaded data on the
Linux runner can go stale (?) throughout a single week causing failures
like this, in some of the jobs:
```
Ign:16 http://security.ubuntu.com/ubuntu jammy-updates/main amd64 libapr1-dev amd64 1.7.0-8ubuntu0.22.04.1
Err:16 mirror+file:/etc/apt/apt-mirrors.txt jammy-updates/main amd64 libapr1-dev amd64 1.7.0-8ubuntu0.22.04.1
404 Not Found [IP: 40.81.13.82 80]
Get:24 http://azure.archive.ubuntu.com/ubuntu jammy-updates/main amd64 libnghttp2-dev amd64 1.43.0-1ubuntu0.2 [117 kB]
Get:25 http://azure.archive.ubuntu.com/ubuntu jammy-updates/main amd64 vsftpd amd64 3.0.5-0ubuntu1.1 [123 kB]
Fetched 4029 kB in 2s (1682 kB/s)
E: Failed to fetch mirror+file:/etc/apt/apt-mirrors.txt/pool/main/a/apr/libapr1-dev_1.7.0-8ubuntu0.22.04.1_amd64.deb 404 Not Found [IP: 40.81.13.82 80]
E: Unable to fetch some archives, maybe run apt-get update or try with --fix-missing?
Error: Process completed with exit code 100.
```
https://github.com/curl/curl/actions/runs/11074211380/job/30772496037#step:32:63
Stefan Eissing [Wed, 25 Sep 2024 13:14:50 +0000 (15:14 +0200)]
CI: improvements in test reliability and performance
- CI default: raise parallelism to 20
- CI valgind: set parallelism to 6
- CI non-native: adapt parallelism for OS builds
- CI Windows: no longer ignore FTP, TFTP, MQTT and SMTP
- CI Windows: restrict test timeout to 10 minutes
- CI Windows: do not run tests for msh3 build
- tests, various: restrict curl invocation to ipv4 to avoid talking to
any ipv6 test server running in parallel
- tests: requiring http/2 server no longer needs to mention http server
- test 190: use a fixed timeout of 10 seconds instead of %FTPTIME2, as
that value rises under parallel load beyond what the server is waiting
and then produces different results
- test 1540: add debug logging
- testrunner: add verify checks for http/2 and http/3 server
Viktor Szakats [Thu, 26 Sep 2024 19:16:21 +0000 (21:16 +0200)]
singleuse: make `git grep` faster, add Apple `nm` support
- avoid regexp in grep to make it run faster.
- add support for parsing Apple `nm` output:
- skip leading underscore from function names.
- pick object name from output.
Viktor Szakats [Mon, 23 Sep 2024 22:14:55 +0000 (00:14 +0200)]
GHA/linux: improve cmake use, switch to Ninja
- cmake: allow easy switching of generator (= make tool).
- merge autotools/cmake job steps.
- cmake: switch to Ninja.
(build was already fast, Ninja doesn't make it noticeably faster)
Daniel Stenberg [Thu, 26 Sep 2024 14:05:20 +0000 (16:05 +0200)]
multi: avoid reading whole struct pointer from pointer
The proper alignment is not guaranteed. This function now instead uses
only the first and last byte of the key since they are the ones likely
to change most (one of them, depending on CPU endian) and the hash is
tiny anyway.
Stefan Eissing [Thu, 26 Sep 2024 13:20:43 +0000 (15:20 +0200)]
tests: use '-4' where needed
Our test servers run either on ipv4 *or* on ipv6, as requested.
A test case using 'localhost' or '*.local' in the url needs to
run with the specific version of the server started.
Otherwise, curl's "happy eyeball"ing will connect to another
server that may be running due to parallel testing or for some
other reasons.
Note that port reuse here depends on the OS strategy and it
seems netbsd is especially likely to hit this.
Daniel Stenberg [Wed, 25 Sep 2024 12:11:01 +0000 (14:11 +0200)]
tests: introduce %CLIENT6IP-NB
This is the %CLIENT6IP variable - but without outmost brackets since
some commmand lines need the address without the brackets. With this
variable we can run three more tests without prechecks.
Daniel Stenberg [Wed, 25 Sep 2024 21:36:05 +0000 (23:36 +0200)]
tests: postcheck is now in verify
Also introduce 'notexists' for verifying that directory entries do not
exist after a test. Now an explicit supported feature instead of using
"funny" perl in postcheck.
Viktor Szakats [Mon, 23 Sep 2024 23:53:27 +0000 (01:53 +0200)]
build: add pytest targets
It enables running pytests in cmake jobs, regardless of underlying build
tool choice (= makes it work with ninja.)
Also:
- drop pytest logic launching `make` and exiting in case of failure.
Maybe there is a better way and keep this functionality somehow, bind
it to a command-line option? make it fail softly?
- GHA/linux: invoke pytest via the build, not directly.
- autotools: add missing dummy runtests targets when cross-compiling.
Viktor Szakats [Mon, 23 Sep 2024 19:05:37 +0000 (21:05 +0200)]
GHA/linux: review and prune valgrind use
Valgrind jobs are slow, drop it from jobs where its use is redundant
and/or has limited impact:
- BearSSL: deprecated.
- LibreSSL heimdal with autotools.
Keep valgrind for the same job with cmake.
- msh3.
- IntelC no-SSL.
Keep valgrind for IntelC OpenSSL.
- OpenSSL 3.
All OpenSSL jobs are v3 now, keep valgrind for the `-O3`, and
libssh2 + sync-resolver variants.
curl_trc: fix build with verbose messages disabled
Add empty definition of Curl_trc_ws() to fix this following build error:
In file included from sendf.h:29,
from ws.c:35:
ws.c: In function 'Curl_ws_accept':
curl_trc.h:100:10: error: implicit declaration of function 'Curl_trc_ws'; did you mean 'Curl_trc_ftp'? [-Wimplicit-function-declaration]
100 | Curl_trc_ws(data, __VA_ARGS__); } while(0)
| ^~~~~~~~~~~
ws.c:779:5: note: in expansion of macro 'CURL_TRC_WS'
779 | CURL_TRC_WS(data, "WS, using chunk size %zu", chunk_size);
| ^~~~~~~~~~~
- build: drop `-Wno-format-overflow` from picky warning list.
These options only get used with picky warnings enabled.
Follow-up to 145f87b9e89f3a5e287233fe7d3cf57aca23dd8c #14598
- unit1652: suppress in source (and not rely on picky warnings anymore.)
Viktor Szakats [Sun, 22 Sep 2024 18:15:51 +0000 (20:15 +0200)]
GHA/windows: mark 3023, 3024 flaky for mingw-w64 7.3.0 job
They became flaky recently as reported by Testclutch and firsthand
observations. It's curious because it only seems to happen in 7.3.0,
but not in the very similar (except non-Unicode) 9.5.0 job.
We've found no explanation or reason for them so far.
```
test 3023...[HTTPS GET to localhost, first subject alt name matches, CN does not match (Schannel variant)]
3023: protocol FAILED!
There was no content at all in the file log/14/server.input.
Server glitch? Total curl failure? Returned: 7
```
Ref: https://github.com/curl/curl/actions/runs/10871191391/job/30164710777?pr=14918#step:13:4849
```
test 3024...[HTTPS GET to localhost, last subject alt name matches, CN does not match (Schannel variant)]
3024: protocol FAILED!
There was no content at all in the file log/8/server.input.
Server glitch? Total curl failure? Returned: 7
```
Ref: https://github.com/curl/curl/actions/runs/10871191391/job/30164710777?pr=14918#step:13:4713
```
FAIL 3023: 'HTTPS GET to localhost, first subject alt name matches, CN does not match (Schannel variant)' HTTPS, HTTP GET, PEM certificate
FAIL 3024: 'HTTPS GET to localhost, last subject alt name matches, CN does not match (Schannel variant)' HTTPS, HTTP GET, PEM certificate
```
https://github.com/curl/curl/actions/runs/10982991876/job/30491895264?pr=14930#step:14:4914
https://github.com/curl/curl/actions/runs/10871191391/job/30164710777?pr=14918
https://github.com/curl/curl/actions/runs/10841065505/job/30084573629?pr=14859#step:13:5484
https://github.com/curl/curl/actions/runs/10858001821/job/30135376138?pr=14906#step:13:4841
Viktor Szakats [Sun, 22 Sep 2024 10:01:36 +0000 (12:01 +0200)]
cmake: make `test-ci` target skip building dependencies
Make `test-ci` not depend on the `testdeps` target.
`test-ci` is designed to run curl tests in CI. In CI we build all
necessary dependencies explicitly beforehand, and they are always ready
when calling the `test-ci` step. Thus, it isn't necessary to enforce
them via a dependency rule. Dropping it saves redundant work and delay
in CI jobs.
The `testdeps` dependency should not normally be a problem. It's
supposed to be a no-op if those targets are already built. In practice
however, it causes a delay and/or an actual rebuild of those
dependencies depending on generator (= build tool) used and other
factors.
As observed in the GHA/windows workflow, the `testdeps` dependency:
- with Ninja, causes no delay, and no extra work:
https://github.com/curl/curl/actions/runs/10980099984/job/30485440389#step:25:18
- with GNU Make, caused a re-evaluation of `testdeps` targets,
but did not actually rebuild them. This re-evaluation took a
noticeable time (esp. with non-bundled tests):
https://github.com/curl/curl/actions/runs/10980099984/job/30485440155#step:14:11 (with bundles)
https://github.com/curl/curl/actions/runs/10973851013/job/30471690331#step:14:11 (w/o bundles)
verbose: https://github.com/curl/curl/actions/runs/10980506956/job/30486434629#step:14:13
- with MSBuild, caused a re-evaluation of `testdeps` targets, and
triggered a _rebuild_:
https://github.com/curl/curl/actions/runs/10980099984/job/30485435968#step:14:19 (with bundles)
https://github.com/curl/curl/actions/runs/10973851013/job/30471689714#step:14:19 (w/o bundles)
verbose: https://github.com/curl/curl/actions/runs/10980506956/job/30486436368#step:14:48
It's suspected that our use of
`-DCMAKE_VS_GLOBALS=TrackFileAccess=false` in CI is contributing to
this. This option is supposed to affect incremental builds only. For
some reason it affects CI builds too, even though they are not
incremental, and no sources are changed between build steps. Reported-by: Aki Sakurai
Ref: #14999
Notice that `test-*` targets depending on `testdeps` is NOT sufficient
to build everything to run tests, e.g. it misses to build the curl tool,
which is essential. This is also true for autotools' `test-ci` target
which misses to build libcurl and the curl tool.
Perhaps it'd be best to drop `testdeps` as a dependency for _all_
`test-*` targets and make it official to require building dependencies
manually. Alternatively these targets could be fixed to rebuild
everything necessary to run tests.