Commit Graph

5375 Commits

Author SHA1 Message Date
Dan Fandrich
0c82fcde79 runtests: track verification time even if no files to compare 2023-03-30 09:53:57 -07:00
Dan Fandrich
07ab5bdd3b getpart: better handle case of file not found 2023-03-30 09:53:57 -07:00
Dan Fandrich
88f1b70546 testcurl: bump version date
It hadn't been updated in 9 years; it's time.
2023-03-30 09:53:57 -07:00
Dan Fandrich
0e3ae25337 tests: switch to 3-argument open in test suite
The perl 2-argument open has been considered not-quite-deprecated since
the 3-argument form was introduced almost a quarter century ago.
2023-03-30 09:53:57 -07:00
Dan Fandrich
b133f70a52 tests: silence some Perl::Critic warnings in test suite
Not all warnings are fixed; many are as much stylistic suggestions than
anything and IMHO don't do much to actually improve the code.

Ref: #10818
Closes #10861
2023-03-30 09:12:52 -07:00
Dan Fandrich
b5cb9a5a36 docs: bump the minimum perl version to 5.6
It's actually been this way since at least 2012 (when a 3-argument open
was added to runtests.pl). Given the lack of complaints in the interim,
it's safe to call this 23 year old perl version the minimum.
2023-03-30 09:12:52 -07:00
Dan Fandrich
2039253c6e runtests: memoize the getpart* subroutines to speed up access
The refactored code calls these functions with the same arguments more
often, so this prevents redundant test case file parsing.

Approved-by: Daniel Stenberg
Ref: #10818
Closes #10833
2023-03-30 09:12:52 -07:00
Dan Fandrich
1f631864f4 runtests: remove duplicated feature variables
Use the feature map stored in the hash table instead. Most of the
variables were only used only once, to set the value in the hash table.

Ref: #10818
2023-03-30 09:12:52 -07:00
Dan Fandrich
e06eb85b3d runtests: also ignore test file problems when ignoring results
This simplifies error handling in the test verification code and makes
it more consistent.

Ref: #10818
2023-03-30 09:12:52 -07:00
Dan Fandrich
d792cd103c runtests: more refactoring for clarity
Ref: #10818
2023-03-30 09:12:52 -07:00
Dan Fandrich
1ae94c0930 runtests: don't start servers if -l is given 2023-03-30 09:12:52 -07:00
Dan Fandrich
44ec1986da runtests: fix typos 2023-03-30 09:12:52 -07:00
Dan Fandrich
53abe3809d runtests: refactor singletest() into separate functions
This takes it from a 1200 line behemoth into something more manageable.
The content and order of the functions is taken almost directly from
singletest() so the diff sans whitespace is quite short.

Ref: #10818
2023-03-30 09:12:52 -07:00
Dan Fandrich
6c0ee77c8a runtests: refactor singletest() into distinct sections
Namely:
- Verify that this test case should be run
- Start the servers needed to run this test case
- Check that test environment is fine to run this test case
- Prepare the test environment to run this test case
- Run the test command
- Clean up after test command
- Verify test succeeded

Ref: #10818
2023-03-30 09:12:52 -07:00
Dan Fandrich
1dc3088de3 runtests: stop copying a few arrays where not needed
Unlike some other languages that just copy a pointer, perl copies the
entire array contents which takes time for a large array.

Ref: #10818
2023-03-30 09:12:52 -07:00
Dan Fandrich
d428f00db0 runtests: reduce redundant calls to getpart/getpartattr
These functions scan through the entire test file every time to find the
right section, so they can be slow for large test files.

Ref: #10818
2023-03-30 09:12:52 -07:00
Dan Fandrich
dfeda77573 tests: document that the unittest keyword is special
Also, add other features that were missing.
2023-03-30 09:12:52 -07:00
Matt Jolly
0ae0abbe72
hostip: refuse to resolve the .onion TLD
RFC 7686 states that:

> Applications that do not implement the Tor
> protocol SHOULD generate an error upon the use of .onion and
> SHOULD NOT perform a DNS lookup.

Let's do that.

https://www.rfc-editor.org/rfc/rfc7686#section-2

Add test 1471 and 1472 to verify

Fixes #543
Closes #10705
2023-03-30 15:51:06 +02:00
Stefan Eissing
f8f010e469
tests/http: fix log formatting on wrong exit code
Closes #10868
2023-03-30 13:09:12 +02:00
dengjfzh
6c6306f300
rtsp: skip malformed RTSP interleaved frame data
Some IP cameras send malformed RTSP interleaved frames sometimes, which
can cause curl_easy_perform return 1 (CURLE_UNSUPPORTED_PROTOCOL).  This
change attempts to skip clearly incorrect RTSP interleaving frame data.

Closes #10808
2023-03-30 09:59:09 +02:00
Stefan Eissing
61f52a97e9
lib: add bufq and dynhds
Adding `bufq`:
- at init() time configured to hold up to `n` chunks of `m` bytes each.
- various methods for reading from and writing to it.
- `peek` support to get access to buffered data without copy
- `pass` support to allow buffer flushing on write if it becomes full
- use case: IO buffers for dynamic reads and writes that do not blow up
- distinct from `dynbuf` in that:
  - it maintains a read position
  - writes on a full bufq return CURLE_AGAIN instead of nuking itself
- Init options:
  - SOFT_LIMIT: allow writes into a full bufq
  - NO_SPARES: free empty chunks right away
- a `bufc_pool` that can keep a number of spare chunks to
  be shared between different `bufq` instances

Adding `dynhds`:
- a straightforward list of name+value pairs as used for HTTP headers
- headers can be appended dynamically
- headers can be removed again
- headers can be replaced
- headers can be looked up
- http/1.1 formatting into a `dynbuf`
- configured at init() with limits on header counts and total string
  sizes
- use case: pass a HTTP request or response around without being version
  specific
- express a HTTP request without a curl easy handle (used in h2 proxy
  tunnels)
- future extension possibilities:
  - conversions of `dynhds` to nghttp2/nghttp3 name+value arrays

Closes #10720
2023-03-30 09:08:05 +02:00
Stefan Eissing
8cabef6fc3
pytest: improvements for suitable curl and error output
- will check built curl for http and https support and
  skip all tests if not there
- will dump stdout/stderr/trace output on errored responses

Closes #10829
2023-03-29 13:25:18 +02:00
Daniel Stenberg
baeaeecb0a
test1592: add flaky keyword
Closes #10860
2023-03-29 09:11:50 +02:00
Arne Soete
2eadae8673
tests: update tests/httpd references to tests/http
tests/httpd was renamed to tests/http in #10654. This patch updates some
references in the README

Closes #10854
2023-03-28 17:50:59 +02:00
Stefan Eissing
9d107b6954
tests/http: add timeout to running curl in test cases
- we had a CI case once where `curl` seemingly did not
  return and it was hard to guess what happened.
- make curl execution in test cases time out after 60 seconds

Closes #10783
2023-03-26 17:41:46 +02:00
Daniel Stenberg
8963c25db3
server/getpart: clear the buffer before load
Fixes msan warnings:

==54195==WARNING: MemorySanitizer: use-of-uninitialized-value
    #0 0x55ece35e57cb in line_length /home/runner/work/curl/curl/tests/server/getpart.c:111:25
    #1 0x55ece35e3b83 in readline /home/runner/work/curl/curl/tests/server/getpart.c:164:24
    #2 0x55ece35e0269 in getpart /home/runner/work/curl/curl/tests/server/getpart.c:347:18
    #3 0x55ece36180b6 in parse_servercmd /home/runner/work/curl/curl/tests/server/sws.c:283:13

Closes #10822
2023-03-23 14:46:07 +01:00
Daniel Stenberg
70afa0d251
runtests: die if curl version can be found
Closes #10813
2023-03-22 14:01:45 +01:00
Stefan Eissing
b00289843a
tests/http: do not save files for downloads in scorecard testing
Closes #10788
2023-03-17 23:01:04 +01:00
Daniel Stenberg
ba1fba9cad
test422: verify --next used without a prior URL
Closes #10782
2023-03-17 14:07:20 +01:00
Daniel Stenberg
f24014c3eb
lib2305: deal with CURLE_AGAIN
The test does a slightly ugly busy-loop for this case but should be
managable due to it likely being a very short moment.

Mention CURLE_AGAIN in curl_ws_recv.3

Fixes #10760
Reported-by: Jay Satiro
Closes #10781
2023-03-16 23:29:12 +01:00
Daniel Stenberg
5ec15ea48f
lib643: LIB644 is never defined, this is dead code
Closes #10765
2023-03-15 00:08:09 +01:00
Daniel Stenberg
7ce1a6ae75
libtest/Makefile.inc: remove superfluous variables
Rely on the defaults when possible.

Closes #10765
2023-03-15 00:08:01 +01:00
Daniel Stenberg
c46761bd8b
tests/http: remove year ranges from copyrights
Closes #10763
2023-03-15 00:05:29 +01:00
Casey Bodley
495d09810a
aws_sigv4: fall back to UNSIGNED-PAYLOAD for sign_as_s3
all s3 requests default to UNSIGNED-PAYLOAD and add the required
x-amz-content-sha256 header. this allows CURLAUTH_AWS_SIGV4 to correctly
sign s3 requests to amazon with no additional configuration

Signed-off-by: Casey Bodley <cbodley@redhat.com>

Closes #9995
2023-03-14 17:04:47 +01:00
Dan Fandrich
7caaeca6f6 tests: fix control code that hid some text in runtests.1 2023-03-13 17:21:02 -07:00
Dan Fandrich
caf5fd1759 tests: sync option lists in runtests.pl & its man page 2023-03-13 17:13:08 -07:00
Stefan Eissing
7fa6e36583
tests/http: add pytest to GHA and improve tests
- added to: ngtcp2-quictls, ngtcp2-gnutls and the linux varians
  quiche, bearssl, libressl, mbedtls, openssl3, rustls
- added disabled in ngtcp2-wolfssl due to weird SSL_connect() errors
  not reproducable locally

Improvements on pytest:

-  handling of systems with nghttpx in $PATH
   - configure will seach $PATH got nghttpx used in pytest
   - pytest fixes for managing nghttpx without h3 support
   - ngtcp2-wolfssl: use a fully enabled wolfssl build

- lower parallel count for http/1.1 tests, since we do not
   want to test excessive connections.
- check built curl for HTTPS-proxy support in proxy tests
- bearssl does not like one of our critical cert extensions, making
  it non-critical now
- bearssl is too slow for test_12, skipping
- making sure we do h3 tests only when curl and server support is there

Closes #10699
2023-03-13 14:06:57 +01:00
Dan Fandrich
0cbfe32fb1 tests: make first.c the same for both lib tests and unit tests
The only difference used to be global variable used in unittest tests.
After cb7ed5a removed individual flag overrides for the unittests, first.c
was no longer recompiled for unit tests to include the flag, so whether it
worked or gave a link error depended on whether it was compiled in
libtest or unittest first. This way also speeds up the build by
eliminating 40 identical compile invocations.

Fixes #10749
2023-03-12 19:14:59 -07:00
Dan Fandrich
4e4a082eff tests: use AM_CPPFILES to modify flags in unit tests
Using CPPFLAGS sometimes caused odd compile issues when building tests
with parallel make and AM_CPPFILES is the right flag, anyway.

Follow-up to cb7ed5a

Ref #10749
2023-03-12 19:04:12 -07:00
Dan Fandrich
ee521a1c88 http: don't send 100-continue for short PUT requests
This is already how curl is documented to behave in Everything curl, but
in actuality only short POSTs skip this. This should knock 30 seconds
off a full run of the test suite since the 100-continue timeout will no
longer be hit.

Closes #10740
2023-03-11 18:57:19 -08:00
Dan Fandrich
970330bded tests: add DELAY keyword to more tests using waits 2023-03-11 18:57:19 -08:00
Dan Fandrich
13b4d050aa tests: hack to build most unit tests under cmake
These are only built when a libcurl static library is available, since
we're not building a special libcurlu library yet and these tests rely
on private symbols that aren't available in the shared library. A few
unit tests do require libcurlu, so those are not built.

Closes #10722
2023-03-11 18:54:21 -08:00
Dan Fandrich
29d7c3bdbd tests: fix MSVC unreachable code warnings in unit tests
Switch unit1654 to use the proper test macros as well.
2023-03-11 18:54:21 -08:00
Dan Fandrich
cb7ed5acf7 tests: make CPPFLAGS common to all unit tests
There's no need to specify them individually.
2023-03-11 18:54:21 -08:00
Dan Fandrich
a76322137b tests: keep cmake unit tests names in sync
Put only the test names into Makefile.inc so they can be used by both
cmake and automake. This will prevent the list of tests from becoming
out of date when they are also built under cmake.
2023-03-11 18:54:21 -08:00
Daniel Stenberg
fcee070cb1
CURLOPT_PROXY.3: curl+NSS does not handle HTTPS over unix domain socket
It results in error "NSS error -5985 (PR_ADDRESS_NOT_SUPPORTED_ERROR)"

Disabled test 1470 for NSS builds and documented the restriction.

Reported-by: Dan Fandrich
Fixes #10723
Closes #10734
2023-03-10 17:50:20 +01:00
Daniel Stenberg
674a0662cf test1903: test use of COOKIEFILE - reset - COOKIEFILE
This also tests for the memory leak bug fixed by parent commit b559ef6f.

Ref: #10694

Closes https://github.com/curl/curl/pull/10712
2023-03-10 03:56:59 -05:00
Dan Fandrich
297ad6ae18 tests: fix some keywords and unused sections 2023-03-10 00:17:29 -08:00
Dan Fandrich
c10c0c0578 tests: fix test1301 to call the right binary
It was refactored in commit 480ac6e5 but this step was missed.
2023-03-10 00:17:29 -08:00
Dan Fandrich
b5d955bc79 tests: add timeout, SLOWDOWN and DELAY keywords to tests
These are tests that are testing timing and end up being quite slow.
2023-03-10 00:17:29 -08:00