Commit Graph

4478 Commits

Author SHA1 Message Date
Daniel Stenberg 8df455479f
source cleanup: remove all custom typedef structs
- Stick to a single unified way to use structs
 - Make checksrc complain on 'typedef struct {'
 - Allow them in tests, public headers and examples

 - Let MD4_CTX, MD5_CTX, and SHA256_CTX typedefs remain as they actually
   typedef different types/structs depending on build conditions.

Closes #5338
2020-05-15 08:54:42 +02:00
Daniel Stenberg 9e95ca10b5
test1632: verify FTP through HTTPS-proxy with connection re-use 2020-05-15 08:28:56 +02:00
Daniel Stenberg c6ce51169e
test1631: verify FTP download through HTTPS-proxy 2020-05-15 08:28:56 +02:00
Daniel Stenberg a3b0699d5c
sws: as last resort, get test number from server cmd file
If it can't be found in the request. Also support --cmdfile to set it to
a custom file name.

runtests.pl always writes this file with the test number in it since a
while back.
2020-05-15 08:28:56 +02:00
Marcel Raad a55c835e6b
curl_multibyte: add to curlx
This will also be needed in the tool and tests.

Ref: https://github.com/curl/curl/pull/3758#issuecomment-482197512
Closes https://github.com/curl/curl/pull/3784
2020-05-14 18:13:27 +02:00
Daniel Stenberg 600a8cded4
url: make the updated credentials URL-encoded in the URL
Found-by: Gregory Jefferis
Reported-by: Jeroen Ooms
Added test 1168 to verify. Bug spotted when doing a redirect.
Bug: https://github.com/jeroen/curl/issues/224
Closes #5400
2020-05-14 17:59:47 +02:00
Daniel Stenberg e2a7a6bb9e
tests: add https-proxy support to the test suite
Initial test 1630 added with basic HTTPS-proxy use. HTTPS-proxy is like
HTTP proxy but with a full TLS connection to the proxy.

Closes #5399
2020-05-14 16:21:31 +02:00
Daniel Stenberg 66b0775763
checksrc: enhance the ASTERISKSPACE and update code accordingly
Fine: "struct hello *world"

Not fine: "struct hello* world" (and variations)

Closes #5386
2020-05-14 00:02:05 +02:00
Daniel Stenberg f3f5d82e28
docs/options-in-versions: which version added each cmdline option
Added test 971 to verify that the list is in sync with the files in
cmdline-opts. The check also verifies that .d-files that uses Added:
specify the same version number as the options-in-versions file does.

Closes #5381
2020-05-13 23:58:36 +02:00
Jay Satiro b995bb58cb tool: Add option --retry-all-errors to retry on any error
The "sledgehammer" of retrying.

Closes https://github.com/curl/curl/pull/5185
2020-05-12 03:00:15 -04:00
Peter Wu ad64169867
CMake: fix runtests.pl with CMake, add new test targets
* runtests.pl:
    - Fix out-of-tree build under CMake when srcdir is not set. Default
      srcdir to the location of runtests.pl.
    - Add a hack to allow CMake to use the TFLAGS option as documented
      in tests/README and used in scripts/travis/script.sh.
  * Bump CMake version to 3.2 for USES_TERMINAL, dropping Debian Jessie
    support (no one should care, it is already EOL.).
  * Remove CTest since it defines its own 'test' target with no tests
    since all unittests are already broken and not built by default.
  * Add new test targets based on the options from Makefile.am. Since
    new test targets are rarely added, I opted for duplicating the
    runtests.pl options as opposed to creating a new Makefile.inc file.
    Use top-level target names (test-x) instead of x-test since that is
    used by CI and others.

Closes #5358
2020-05-12 08:50:17 +02:00
Peter Wu c2ab2494ef
CMake: do not build test programs by default
The default target should only build libcurl and curl. Add a dedicated
'testdeps' target which will be used later when running tests. Note that
unittests are currently broken in CMake and already excluded.

Closes #5368
2020-05-12 08:50:07 +02:00
Daniel Stenberg 90bbfb5136
FILEFORMAT: moved up the variables section and further polished 2020-05-12 08:23:14 +02:00
Daniel Stenberg c67592fed7
runtests: remove ftp2 support, not used
We once supported two separate ftp instances in the test suite. Has not
been used the last decade.

Closes #5375
2020-05-12 08:23:06 +02:00
Marc Hoersken cffbcc3110
test1238: avoid tftpd being busy for tests shortly following
The tftpd server may still be busy if the total timeout of
25 seconds has not been reached or no sread error was received
during or after the execution of the timeout test 1238.

Once the next TFTP test comes around (eg. 1242 or 1243),
those will fail because the tftpd server is still waiting
on data from curl due to the UDP protocol being stateless
and having no connection close. On Linux this error may not
happen, because ICMP errors generated due to a swrite error
can also be returned async on the next sread call instead.

Therefore we will now just kill the tftpd server after test
1238 to make sure that the following tests are not affected.

This enables us to no longer ignore tests 1242, 1243, 2002
and 2003 on the CI platforms CirrusCI and AppVeyor.

Assisted-by: Peter Wu
Closes #5364
2020-05-11 19:59:19 +02:00
Marc Hoersken 000f721690
tests/server/tftpd.c: fix include and enhance debug logging
setjmp.h should only be included if HAVE_SETJMP_H is defined.

Add additional log statements to see wether reads and writes
are blocking or finishing before an alarm signal is received.

Assisted-by: Peter Wu
Part of #5364
2020-05-10 17:58:29 +02:00
Daniel Stenberg 7f1c098728
urlapi: accept :: as a valid IPv6 address
Text 1560 is extended to verify.

Reported-by: Pavel Volgarev
Fixes #5344
Closes #5351
2020-05-08 08:47:29 +02:00
Daniel Stenberg cad1f46ce3
runtests: show elapsed test time with higher precision (ms) 2020-05-07 12:23:40 +02:00
Marc Hoersken 2d1745fe2c
test613.pl: make tests 613 and 614 work with OpenSSH for Windows
OpenSSH for Windows shows group and other/world permissions as *,
because those concepts do not exist on Windows. It also does not
show the current or parent directory, so we just ignore those.

Reviewed-by: Daniel Stenberg
Closes #5328
2020-05-06 19:33:20 +02:00
Daniel Stenberg e1d81b52c0
runtests: set +x mode again 2020-05-06 08:14:47 +02:00
Daniel Stenberg ed35d6590e
dynbuf: introduce internal generic dynamic buffer functions
A common set of functions instead of many separate implementations for
creating buffers that can grow when appending data to them. Existing
functionality has been ported over.

In my early basic testing, the total number of allocations seem at
roughly the same amount as before, possibly a few less.

See docs/DYNBUF.md for a description of the API.

Closes #5300
2020-05-04 10:40:39 +02:00
Daniel Stenberg 00c2e8da9a
runtests: remove sleep calls
Remove many one second sleeps that were done *after* each newly started
test server already has been verified. They should not have any purpose
there.

Closes #5323
2020-05-03 23:19:36 +02:00
Marc Hoersken 0e058776c0
sockfilt: make select_ws stop waiting on exit signal event
This makes sure that select_ws behaves similar to real select
which stops waiting on a signal handler being triggered.

This makes it possible to gracefully stop sockfilt.exe on
Windows with taskkill /IM sockfilt.exe (without /F force flag).

Reviewed-by: Jay Satiro
Part of #5260
2020-05-02 17:30:54 +02:00
Marc Hoersken 7dc8a981fa
tests/server/util.[ch]: add exit event to stop waiting on Windows
This commit adds a global exit event to the test servers that
Windows-specific wait routines can use to get triggered if the
program was signaled to be terminated, eg. select_ws in sockfilt.c

The exit event will be managed by the signal handling code and is
set to not reset automatically to support multiple wait routines.

Reviewed-by: Jay Satiro
Closes #5260
2020-05-02 17:29:52 +02:00
Marc Hoersken 551577f357
tests/server/util.c: fix thread handle not being closed
Reviewed-by: Jay Satiro
Part of #5260
2020-05-02 17:05:26 +02:00
Marc Hoersken fe28fcf04c
tests/server/util.c: use raise instead of calling signal handler
Use raise to trigger signal handler instead of calling it
directly and causing potential unexpected control flow.

Reviewed-by: Jay Satiro
Part of #5260
2020-05-02 17:04:55 +02:00
Marc Hoersken 1abb087a9c
tests: add support for SSH server variant specific transfer paths
OpenSSH for Windows requires paths in the format of /C:/
instead of the pseudo-POSIX paths /cygdrive/c/ or just /c/

Reviewed-by: Daniel Stenberg
Closes #5298
2020-05-02 16:56:55 +02:00
Daniel Stenberg 5cb7f893df
runtests: make the logmsg from the ssh server only show in verbose 2020-05-02 15:51:42 +02:00
Daniel Stenberg f9c6febae2
tests: make test 1248 + 1249 use %NOLISTENPORT
... instead of a port of a non-running server so that it works
stand-alone.

Closes #5318
2020-05-02 15:47:34 +02:00
Emil Engler 44f5edd863
runtests: fix typo in the existence of disabled tests checker
Closes #5316
2020-04-30 23:47:53 +02:00
Dan Fandrich 49bbc4f09b test75: Remove precheck test
This has not been needed since commit 9fa42bed and often prevents it
from running at all with dynamic test ports.
2020-04-30 16:56:59 +02:00
Dan Fandrich 5f5a7b478a tests: Stop referring to server ports when they're not used
Several tests referred to specific server ports even when the test
didn't actually use that server or specify that it's needed. In such
cases, the test harness substitutes the text "[not running]" as the port
number which causes many such tests to fail due to the inability to
parse the URL.  These tests are changed to use %NOLISTENPORT which will
always be substituted correctly.
2020-04-30 16:00:31 +02:00
Daniel Stenberg c069027139
conncache: various concept cleanups
More connection cache accesses are protected by locks.

CONNCACHE_* is a beter prefix for the connection cache lock macros.

Curl_attach_connnection: now called as soon as there's a connection
struct available and before the connection is added to the connection
cache.

Curl_disconnect: now assumes that the connection is already removed from
the connection cache.

Ref: #4915
Closes #5009
2020-04-30 14:27:54 +02:00
Daniel Stenberg 9a8fa076bf
tests: tests: run stunnel for HTTPS and FTPS on dynamic ports
As stunnel is an external tool and it has no specific option to export
the actually used port number when asked to listen to 0, runtests
instead iterates over ten randomly picked high number ports and sticks
to the first one stunnel can listen to.

Closes #5267
2020-04-30 14:17:15 +02:00
Daniel Stenberg d1239b50be
tests: pick a random port number for SSH
Since sshd doesn't have such an option by itself, we iterate over a
series of random ports until one works.

Closes #5273
2020-04-30 14:13:59 +02:00
Rikard Falkeborn 06ce166944
libtest/cmake: Remove commented code
These were commented out in e9dd099870 when Makefile.inc was included
instead. 11 years have passed since then and the commented code is of
course very outdated. Remove it to avoid confusion.

Closes #5311
2020-04-30 14:13:07 +02:00
Kamil Dudka 68774da9ca test1177: look for curl.h in source directory
If we use a separate build directory, there is no copy of the header.

Closes #5310
2020-04-29 13:54:08 +02:00
Kamil Dudka 1066f5f0d4 tests: look for preprocessed tests in build directory
... which is not always the same directory as source directory

Closes #5310
2020-04-29 13:53:12 +02:00
Daniel Stenberg 6370e43153
headers: copyright range fix 2020-04-28 18:10:46 +02:00
Rikard Falkeborn fc0e29dd57
doh: Constify some input pointers
Closes #5306
2020-04-28 07:56:34 +02:00
Daniel Stenberg 2fc1c9d7e7
runtests: check for the disabled tests relative srcdir
To make it work correctly for out-of-tree builds.

Follow-up to 75e8feb6fb

Bug: https://github.com/curl/curl/pull/5288#issuecomment-619346389
Reported-by: Marcel Raad
Closes #5297
2020-04-25 23:24:12 +02:00
Daniel Stenberg 2a33417e1d
runtests: revert commenting out a line I did for debugging
Follow-up to 11091cd4d. It was not meant to be pushed!
2020-04-25 16:24:50 +02:00
Daniel Stenberg 11091cd4d2
runtests: when <killserver> mentions http, kill http/2 too
Since the http2 test server is a mere proxy that needs to know about the
dynamic port the HTTP server is using, it too needs to get restarted
when the http server is killed.

A regression caused by 80d6515.

Fixes #5289
Closes #5291
2020-04-25 00:51:01 +02:00
Emil Engler ba7b94b1e7
tests/git: ignore mqttd and port files
Closes #5290
2020-04-24 13:48:58 +02:00
Daniel Stenberg 75e8feb6fb
tests: make runtests check that disabled tests exists
... and error out if so. Removed '536' from DISABLED as there is no such
test file.

Closes #5288
2020-04-24 13:43:21 +02:00
Daniel Stenberg 1ae5860059
test1154: set a proper name 2020-04-24 08:56:46 +02:00
Jay Satiro c0e139a60d transfer: Switch PUT to GET/HEAD on 303 redirect
Prior to this change if there was a 303 reply to a PUT request then
the subsequent request to respond to that redirect would also be a PUT.
It was determined that was most likely incorrect based on the language
of the RFCs. Basically 303 means "see other" resource, which implies it
is most likely not the same resource, therefore we should not try to PUT
to that different resource.

Refer to the discussions in #5237 and #5248 for more information.

Fixes https://github.com/curl/curl/issues/5237
Closes https://github.com/curl/curl/pull/5248
2020-04-22 17:56:17 -04:00
Daniel Stenberg bae87dc0d9
tests: run the RTSP test server on a dynamic port number
To avoid port collisions.

Closes #5272
2020-04-20 22:48:57 +02:00
Daniel Stenberg 018dd775c8
tests: add %NOLISTENPORT and use it
The purpose with this variable is to provide a port number that is
reasonably likely to not have a listener on the local host so that tests
can try connect failures against it. It uses port 47 - "reserved"
according to IANA.

Updated six tests to use it instead of the previous different ports.

Assisted-by: Emil Engler
Closes #5270
2020-04-20 22:38:05 +02:00
Daniel Stenberg fa7daafdbc
server/tftpd: fix compiler warning
Follow-up from 369ce38ac1
Reported-by: Marc Hörsken
2020-04-20 22:21:31 +02:00