Commit Graph

6184 Commits

Author SHA1 Message Date
Daniel Stenberg
80dac51af8
test1915: remove wrong comment 2024-10-08 09:35:56 +02:00
Viktor Szakats
6cfb615e92
sws: fix unused static function with TCP_NODELAY undefined
Closes #15171
2024-10-07 12:31:21 +02:00
Daniel Stenberg
e9eda865df
warnless: remove curlx_sktosi and curlx_sitosk
They were only used by test server code. Use plain old typecasts there.

Closes #15153
2024-10-05 00:28:06 +02:00
Dan Fandrich
57cc523378 tests: enable additional ruff Python lint options
These all seem reasonable to enable for this code.
2024-10-04 14:03:17 -07:00
Dan Fandrich
0f7ba5c5bf tests: change Python code style to pass ruff checks
Most of the changes consisted of removing unused imports and unnecessary
f-strings.
2024-10-04 14:02:05 -07:00
Dan Fandrich
2f3b7f20fb tests: fix some Python typing issues
These otherwise raise errors in pytype. A few problematic methods
weren't being used and are deleted.
2024-10-04 13:57:04 -07:00
Stefan Eissing
bc055d08ac
test1915: add tracing and connect timeout
Since we see Windows fails of 1915, add tracing and a connect timeout.
The test uses a port no one is supposed to listen on, but Windows has
this weird wait logic. So, set a short timeout.

Closes #15107
2024-10-03 16:06:08 +02:00
Daniel Stenberg
566a6d7b09
urlapi: normalize the IPv6 address
As the parsing and address "regeneration" are done anyway, we might as
well use the updated version in the result and thereby A) get a
normalized (and lower cased) version of the address and B) avoid a
strcpy().

Updated test 1560 to verify.

Closes #15143
2024-10-03 16:05:03 +02:00
Daniel Stenberg
87e19ea68f
tests/valgrind.supp: remove a travis suppression, add a Debian
We have not used Travis for years. The Debian one appears on my dev
machine since a while back.

Closes #15142
2024-10-03 16:03:43 +02:00
Stefan Eissing
6c1b15768c
pytest: improve pytest_07_42a reliability
Due to timings on paused response receive, the error code may vary due
to the location where it is detected that the server closed the transfer
prematurely.

Be more lenient in always allowing PARTIAL_FILE as ok.

Closes #15138
2024-10-03 14:42:52 +02:00
Stefan Eissing
e1f93beffe
test1515: add tracing and more debug info
Test failed on some Windows CI and log files did not really
tell why. Add more output.

Closes #15140
2024-10-03 14:41:55 +02:00
Stefan Eissing
2400a6c6b2
bufq: unwrite fix
`Curl_bufq_unwrite()` used the head instead of the tail chunk to shrink
the bufq's content. Fix this and add test case that checks correct
behaviour.

Amended test 2601 accordingly.

Reported-by: Chris Stubbs
Closes #15136
2024-10-03 13:27:36 +02:00
Viktor Szakats
9b0c0d6ade
tests: let openssl generate random cert serials
Generate the certificate serial numbers automatically instead of doing
from shell (or Perl earlier).

Fixes intermittent CI failures due to the shell-based random generator
generating the same serial number twice:
```
$ openssl ca -config EdelCurlRoot-ca.cnf -revoke Server-localhost0h-sv.crt
Using configuration from EdelCurlRoot-ca.cnf
ERROR:Already revoked, serial number 66FDB23A
make: *** [../../../tests/certs/Server-localhost0h-sv.pem] Error 1
```
https://github.com/curl/curl/actions/runs/11151401083/job/30994755798?pr=15128#step:10:498

Follow-up to fa461b4eff #14486
Follow-up to fa69b41c77 #13307
Closes #15129
2024-10-03 01:17:40 +02:00
Viktor Szakats
0acf0bceda
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.

Cherry-picked from #14949
Closes #15111
2024-10-02 15:03:55 +02:00
Daniel Stenberg
39697dead3
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.

Closes #15114
2024-10-02 08:13:55 +02:00
Daniel Stenberg
b0c82239c2
tool: support --show-headers AND --remote-header-name
By keeping the headers in memory until we know the target file name,
then output them all.

Previously this option combination would cause an error.

Add test 1310 and 1492 to verify. Adjusted test 1460 to work in the new
conditions.

Closes #15110
2024-10-02 08:04:33 +02:00
Viktor Szakats
aa092012bd
tests: fixup checkcmd PATH on non-unixy platforms
Do not add unixy system directories to `PATH` when looking up commands
on Windows, MS-DOS or OS/2.

Cherry-picked from #14949
Closes #15106
2024-10-01 16:05:13 +02:00
Viktor Szakats
f88fb1c83e
tests: fix shell quoting on native Windows Perl
Cherry-picked from #14949
Closes #15105
2024-10-01 16:05:10 +02:00
Viktor Szakats
9c1ab7fa4a
tests: fix %POSIX_PWD on native Windows Perl
Though this variable isn't used in any of the current tests.

Cherry-picked from #14949
Closes #15104
2024-10-01 16:05:07 +02:00
Viktor Szakats
ca9106c1e9
tests: replace %PWD with %SSH_PWD in SCP/SFTP tests
Cherry-picked from #14949
Closes #15103
2024-10-01 16:04:51 +02:00
Daniel Stenberg
c72cefea0f
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.

ref: https://daniel.haxx.se/blog/2016/10/11/poll-on-mac-10-12-is-broken/

Closes #15096
2024-10-01 15:11:50 +02:00
Stefan Eissing
72d2090fc2
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.

Add test in FTPS for such uploads to verify.

Fixes #15101
Reported-by: Denis Goleshchikhin
Closes #15102
2024-10-01 13:57:12 +02:00
Viktor Szakats
68c358619f
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.

Cherry-picked from #14949
Closes #15098
2024-10-01 12:07:19 +02:00
Viktor Szakats
31a29fc6bd
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`.)

Cherry-picked from #14949
Closes #15097
2024-10-01 12:04:50 +02:00
Viktor Szakats
f6cb707b6a
tests: replace %PWD with %FILE_PWD for file://
Before this patch not all tests used `%FILE_PWD` with the `file://`
protocol.

Keep `%PWD` for test1145, to keep it fail on Windows like the test
expects.

Cherry-picked from #14949

Closes #15090
2024-09-30 23:48:00 +02:00
Viktor Szakats
212ff19b60
runtests: drop unused code for old/classic-mingw support
Follow-up to 38029101e2 #11625

Closes #15087
2024-09-30 14:11:23 +02:00
Viktor Szakats
e474b02301
runtests: fix indentation 2024-09-30 01:51:12 +02:00
Stefan Eissing
7f3d598276
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

Closes #15040
2024-09-27 16:47:37 +02:00
Daniel Stenberg
d78e129d50
WebSockets: make support official (non-experimental)
Inverts the configure/cmake options to instead provide options that
disable WebSockets and have them (ws + wss) enabled by default.

Closes #14936
2024-09-27 13:20:25 +02:00
Viktor Szakats
cfae354a9a
codespell: extend checks to more subdirs
- fix issues found.
- fix a few more found locally.

Closes #15072
2024-09-27 10:27:08 +02:00
Stefan Eissing
6f2a1666a1
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.

Closes #15060
2024-09-26 23:36:09 +02:00
Stefan Eissing
841fbdb63c
tests: improve mqtt server handling
Check that the mqtt server process actually is running.
Handle its port number similar to other servers.

Closes #15059
2024-09-26 23:35:13 +02:00
Stefan Eissing
e61c5eb417
tests: check http/2 and http/3 server responsiveness
Check responsiveness of http/3 server when running.

Also, a test case with http/2 or http/3 server requirement
now implicitly drags in a 'http' server and we need no longer
mention that in testdata.

Closes #15058
2024-09-26 23:34:16 +02:00
Stefan Eissing
ef400f4f38
test190: replace %FTPTIME2 with a fixed value
The variable FTPTIME2 may, on a loaded test server, become so
large that the timeout does not happen before the fixed 60 seconds
the server waits.

Closes #15056
2024-09-26 23:33:18 +02:00
Daniel Stenberg
dc284be4cc
tests: remove the %FTPTIME3 variable
Nothing uses it.

Ref: #15056
Closes #15064
2024-09-26 23:25:47 +02:00
Dan Fandrich
8e9a8dd978 tests: add file: tests with existing files
Windows sometimes has issues when opening the same file twice, so these
test two situations where that could potentially occur.

Reported-by: ralfjunker on github
Ref: #15043
Closes #15045
2024-09-26 10:10:36 -07:00
Daniel Stenberg
dd0405c909
test518: restore valgrind disable
Follow-up to c91c37b6e8

The test does not work well when run with valgrind

Closes #15062
2024-09-26 17:02:09 +02:00
Stefan Eissing
b2dc95540a
test1540: add debug logging
Closes #15055
2024-09-26 16:58:42 +02:00
Stefan Eissing
cbbf4d8ed2
test504: fix handling on pending connect
Test expected a connect to a port no one is listening to immediately
fail. But Windows has its internal retry logic that may fail this.

As fix, multi_perform()/multi_wait() until transfer is done.

Closes #15054
2024-09-26 16:57:51 +02:00
Stefan Eissing
17a7e12e1b
test2502: add libtest debug tracing
Closes #15053
2024-09-26 16:57:13 +02:00
Stefan Eissing
f518982775
testrun: explicitly set proper IP address for stunnel listen/connect
Closes #15051
2024-09-26 16:55:52 +02:00
Stefan Eissing
21fb30b5d1
test1035: convert host name back to utf8 as should be
Follow-up to 0b70b23ef4

Closes #15050
2024-09-26 16:54:03 +02:00
Daniel Stenberg
f383a17617
tool_doswin: simplify; remove unused options and strncpy calls
SANITIZE_ALLOW_TRUNCATE and SANITIZE_ALLOW_COLONS were never used by
code, thus only making the code complicated for no good use.

Since nothing should truncate, using strncpy() is wrong.

Two cases of malloc + copy replaced with proper strdup() calls.

Fixup unit test 1604 accordingly.

Closes #15047
2024-09-26 10:45:08 +02:00
Daniel Stenberg
0b70b23ef4
tests: add codeset-utf8 as a feature
To avoid having to use <precheck> for tests that require UTF-8 support.

Closes #15039
2024-09-26 08:44:59 +02:00
Daniel Stenberg
5fb1b64fdd
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.

Closes #15039
2024-09-26 08:44:55 +02:00
Daniel Stenberg
7aa2b4e01f
tests: make precheck for HTTP on 127.0.0.1 into a feature
It can now be required easily in <features> instead of having perl code
in a <precheck>.

Closes #15039
2024-09-26 08:44:45 +02:00
Daniel Stenberg
56183c1d6f
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.

Closes #15046
2024-09-26 08:43:24 +02:00
Viktor Szakats
d82f9f965c
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.

Closes #15034
2024-09-25 09:25:44 +02:00
Gabriel Marin
b70e8f4b9b
cleanup: added space around ternary expressions
Closes #14990
2024-09-25 08:02:01 +02:00
Gabriel Marin
b7c9166c4c
test1185: Updated test data with NOSPACEC rule
Closes #14990
2024-09-25 08:01:58 +02:00