diff options
Diffstat (limited to 'tests')
53 files changed, 242 insertions, 162 deletions
diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 014fe0db8..8bfca21ca 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -74,8 +74,8 @@ function(curl_add_runtests _targetname _test_flags) COMMAND ${_setenv} "${PERL_EXECUTABLE}" "${CMAKE_CURRENT_SOURCE_DIR}/runtests.pl" - ${_test_flags_list} - "\$TFLAGS" + ${_test_flags_list} + "\$TFLAGS" DEPENDS "${_depends}" VERBATIM USES_TERMINAL ) @@ -104,6 +104,7 @@ if(MSVC OR CMAKE_C_COMPILER_ID STREQUAL "GNU" OR CMAKE_C_COMPILER_ID MATCHES "Cl if(APPLE AND CMAKE_OSX_SYSROOT) string(APPEND CURL_CPP " -isysroot ${CMAKE_OSX_SYSROOT}") endif() + string(APPEND CURL_CPP " ${CMAKE_C_FLAGS}") # Add header directories, like autotools builds do. get_property(_include_dirs TARGET ${LIB_SELECTED} PROPERTY INCLUDE_DIRECTORIES) foreach(_include_dir IN LISTS _include_dirs) @@ -125,7 +126,7 @@ curl_add_runtests(test-am "-a -am") curl_add_runtests(test-full "-a -p -r") # ~flaky means that it ignores results of tests using the flaky keyword curl_add_runtests(test-nonflaky "-a -p ~flaky ~timing-dependent") -curl_add_runtests(test-ci "-a -p ~flaky ~timing-dependent -r --retry=5 -j20 --ci") +curl_add_runtests(test-ci "-a -p ~flaky ~timing-dependent -r --retry=5 -j20 --buildinfo") curl_add_runtests(test-torture "-a -t -j20") curl_add_runtests(test-event "-a -e") diff --git a/tests/Makefile.am b/tests/Makefile.am index 3894355fe..639da3380 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -129,7 +129,7 @@ TEST_E = -a -e TEST_NF = -a -p ~flaky ~timing-dependent # special CI target derived from nonflaky with CI-specific flags -TEST_CI = $(TEST_NF) -r --retry=5 -j20 --ci +TEST_CI = $(TEST_NF) -r --retry=5 -j20 --buildinfo PYTEST = pytest endif diff --git a/tests/data/Makefile.am b/tests/data/Makefile.am index 71fc94860..66429a68d 100644 --- a/tests/data/Makefile.am +++ b/tests/data/Makefile.am @@ -108,9 +108,9 @@ test718 test719 test720 test721 test722 test723 test724 test725 test726 \ test727 test728 test729 test730 test731 test732 test733 test734 test735 \ test736 test737 test738 test739 test740 test741 test742 test743 test744 \ test745 test746 test747 test748 test749 test750 test751 test752 test753 \ -test754 test755 test756 test757 test758 \ +test754 test755 test756 test757 test758 test759 \ test780 test781 test782 test783 test784 test785 test786 test787 test788 \ -test789 test790 test791 test792 test793 test794 test796 test797 \ +test789 test790 test791 test792 test793 test794 test795 test796 test797 \ \ test799 test800 test801 test802 test803 test804 test805 test806 test807 \ test808 test809 test810 test811 test812 test813 test814 test815 test816 \ diff --git a/tests/data/test1056 b/tests/data/test1056 index afcdf137e..302b9c541 100644 --- a/tests/data/test1056 +++ b/tests/data/test1056 @@ -45,10 +45,10 @@ body # This test relies on the IPv6 scope field being ignored when connecting to # ipv6-localhost (i.e. [::1%259999] is treated as [::1]). Maybe this is a bit # dodgy, but it happens on all our test platforms but Windows so skip this -# test there. This feature doesn't work on msys or Cygwin, so use a precheck -# to skip those. +# test there. Not supported on the Windows kernel, this includes MSYS2/Cygwin. <features> IPv6 +!cygwin !win32 </features> <server> @@ -61,9 +61,6 @@ HTTP follow redirect from IPv4 to IPv6 with scope <command> http://%HOSTIP:%HTTPPORT/we/are/all/twits/%TESTNUMBER -L </command> -<precheck> -%PERL -e "print 'Test is not supported on the Windows kernel' if($^O eq 'MSWin32' || $^O eq 'msys' || $^O eq 'cygwin');" -</precheck> </client> # diff --git a/tests/data/test1113 b/tests/data/test1113 index c0e1230c3..c7eaf2e93 100644 --- a/tests/data/test1113 +++ b/tests/data/test1113 @@ -65,9 +65,6 @@ EPSV RETR file.txt
EPSV
RETR someothertext.txt
-CWD /
-CWD fully_simulated
-CWD DOS
EPSV
TYPE A
LIST
diff --git a/tests/data/test1330 b/tests/data/test1330 index 4e97162b5..93b860461 100644 --- a/tests/data/test1330 +++ b/tests/data/test1330 @@ -23,9 +23,6 @@ TrackMemory <name> unit tests memory tracking operational </name> -<command> -nothing -</command> </client> # diff --git a/tests/data/test142 b/tests/data/test142 index db17e3074..e09b744f9 100644 --- a/tests/data/test142 +++ b/tests/data/test142 @@ -189,5 +189,8 @@ SIZE %TESTNUMBER RETR %TESTNUMBER
QUIT
</protocol> +<limits> +Allocations: 170 +</limits> </verify> </testcase> diff --git a/tests/data/test1443 b/tests/data/test1443 index 45aead932..c42480ae8 100644 --- a/tests/data/test1443 +++ b/tests/data/test1443 @@ -35,7 +35,7 @@ HTTP GET with -O and --remote-time http://%HOSTIP:%HTTPPORT/%TESTNUMBER -O --remote-time --output-dir %LOGDIR </command> # Verify the mtime of the file. The mtime is specifically chosen to be an even -# number so that it can be represented exactly on a FAT filesystem. +# number so that it can be represented exactly on a FAT file system. </client> # diff --git a/tests/data/test1444 b/tests/data/test1444 index ad1dc4634..860c66304 100644 --- a/tests/data/test1444 +++ b/tests/data/test1444 @@ -47,7 +47,7 @@ RETR %TESTNUMBER QUIT
</protocol> # Verify the mtime of the file. The mtime is specifically chosen to be an even -# number so that it can be represented exactly on a FAT filesystem. +# number so that it can be represented exactly on a FAT file system. <postcheck> %PERL -e 'exit((stat("%LOGDIR/curl%TESTNUMBER.out"))[9] != 1234567890)' </postcheck> diff --git a/tests/data/test1462 b/tests/data/test1462 index a3cc46e31..086591286 100644 --- a/tests/data/test1462 +++ b/tests/data/test1462 @@ -44,7 +44,7 @@ Unknown category provided, here is a list of all categories: http HTTP and HTTPS protocol imap IMAP protocol ldap LDAP protocol - output Filesystem output + output File system output pop3 POP3 protocol post HTTP POST specific proxy Options for proxies diff --git a/tests/data/test1506 b/tests/data/test1506 index d3cec0578..ed95e3be6 100644 --- a/tests/data/test1506 +++ b/tests/data/test1506 @@ -55,7 +55,7 @@ lib%TESTNUMBER HTTP GET connection cache limit (CURLMOPT_MAXCONNECTS) </name> <command> -http://%HOSTIP:%HTTPPORT/path/%TESTNUMBER %HOSTIP %HTTPPORT +- %HOSTIP %HTTPPORT </command> </client> diff --git a/tests/data/test1508 b/tests/data/test1508 index 9b210ec0f..65345df7b 100644 --- a/tests/data/test1508 +++ b/tests/data/test1508 @@ -17,9 +17,6 @@ lib%TESTNUMBER <name> Close a multi handle without using it </name> -<command> -http://%HOSTIP:%NOLISTENPORT/path/%TESTNUMBER -</command> </client> # Verify data after the test has been "shot" diff --git a/tests/data/test1510 b/tests/data/test1510 index 236fbde3d..4a80b7a1d 100644 --- a/tests/data/test1510 +++ b/tests/data/test1510 @@ -55,7 +55,7 @@ lib%TESTNUMBER HTTP GET connection cache limit (CURLOPT_MAXCONNECTS) </name> <command> -http://%HOSTIP:%HTTPPORT/path/%TESTNUMBER %HOSTIP %HTTPPORT +- %HOSTIP %HTTPPORT </command> </client> diff --git a/tests/data/test1512 b/tests/data/test1512 index c0c23467b..a0e321432 100644 --- a/tests/data/test1512 +++ b/tests/data/test1512 @@ -54,7 +54,7 @@ lib%TESTNUMBER GLOBAL CACHE test over two easy performs </name> <command> -http://%HOSTIP:%HTTPPORT/path/%TESTNUMBER %HOSTIP %HTTPPORT +- %HOSTIP %HTTPPORT </command> </client> diff --git a/tests/data/test1517 b/tests/data/test1517 index 5f0537959..18d1fcaf2 100644 --- a/tests/data/test1517 +++ b/tests/data/test1517 @@ -36,6 +36,11 @@ This is a virtual description of server virtual error. # Client-side <client> +# Windows TCP does not deliver response data but reports CONNABORTED +<features> +!cygwin +!win32 +</features> <server> http </server> @@ -43,12 +48,6 @@ http <tool> lib%TESTNUMBER </tool> -# precheck is a command line to run before the test, to see if we can execute -# the test or not -<precheck> -%LIBTESTS lib%TESTNUMBER check -</precheck> - <name> HTTP POST, server responds before completed send </name> diff --git a/tests/data/test1521 b/tests/data/test1521 index f62f58c5f..a6319e3f3 100644 --- a/tests/data/test1521 +++ b/tests/data/test1521 @@ -18,9 +18,6 @@ lib%TESTNUMBER <name> Test all curl_easy_setopt and curl_easy_getinfo options </name> -<command> -unused -</command> </client> # diff --git a/tests/data/test1537 b/tests/data/test1537 index c999e9a6b..9e585b7a2 100644 --- a/tests/data/test1537 +++ b/tests/data/test1537 @@ -22,9 +22,6 @@ lib%TESTNUMBER <name> libcurl URL escape/unescape tests </name> -<command> -nothing -</command> </client> # diff --git a/tests/data/test1538 b/tests/data/test1538 index 0615a9a4c..02f8bc431 100644 --- a/tests/data/test1538 +++ b/tests/data/test1538 @@ -23,9 +23,6 @@ lib%TESTNUMBER <name> libcurl strerror API call tests </name> -<command> -nothing -</command> </client> # diff --git a/tests/data/test1550 b/tests/data/test1550 index 3d747792f..8fd36f72e 100644 --- a/tests/data/test1550 +++ b/tests/data/test1550 @@ -22,8 +22,5 @@ lib%TESTNUMBER <name> verify setting pipelining blocklisting options </name> -<command> -http://%HOSTIP:%NOLISTENPORT/%TESTNUMBER -</command> </client> </testcase> diff --git a/tests/data/test1557 b/tests/data/test1557 index ae4ac42a2..738a58dab 100644 --- a/tests/data/test1557 +++ b/tests/data/test1557 @@ -21,7 +21,7 @@ lib%TESTNUMBER Remove easy handle in pending connections doesn't leave dangling entry </name> <command> -nothing +hostname.invalid </command> </client> diff --git a/tests/data/test1564 b/tests/data/test1564 index 59cef7157..e69067450 100644 --- a/tests/data/test1564 +++ b/tests/data/test1564 @@ -24,8 +24,6 @@ lib%TESTNUMBER <name> wakeup before poll with no easy handles </name> -<command> -</command> </client> # Verify data after the test has been "shot" diff --git a/tests/data/test1597 b/tests/data/test1597 index 047bf7bd8..0becf616c 100644 --- a/tests/data/test1597 +++ b/tests/data/test1597 @@ -19,9 +19,6 @@ CURLOPT_PROTOCOLS_STR <tool> lib%TESTNUMBER </tool> -<command> -- -</command> </client> <verify> diff --git a/tests/data/test2402 b/tests/data/test2402 index 563443171..4e08e45ac 100644 --- a/tests/data/test2402 +++ b/tests/data/test2402 @@ -60,7 +60,7 @@ lib%TESTNUMBER HTTP GET multiple files over HTTP/2 using HTTPS </name> <command> -https://%HOSTIP:%HTTP2TLSPORT/path/%TESTNUMBER %HOSTIP %HTTP2TLSPORT +- %HOSTIP %HTTP2TLSPORT </command> </client> diff --git a/tests/data/test2404 b/tests/data/test2404 index 4ebcceac8..13e48c8be 100644 --- a/tests/data/test2404 +++ b/tests/data/test2404 @@ -60,7 +60,7 @@ lib%TESTNUMBER HTTP/2 using STREAM_WEIGHTs </name> <command> -https://%HOSTIP:%HTTP2TLSPORT/path/%TESTNUMBER %HOSTIP %HTTP2TLSPORT +- %HOSTIP %HTTP2TLSPORT </command> </client> diff --git a/tests/data/test2502 b/tests/data/test2502 index 311b23def..f7822e8c2 100644 --- a/tests/data/test2502 +++ b/tests/data/test2502 @@ -59,7 +59,7 @@ lib%TESTNUMBER HTTP GET multiple over HTTP/3 </name> <command> -https://%HOSTIP:%HTTP3PORT/path/%TESTNUMBER %HOSTIP %HTTP3PORT %CERTDIR/certs/test-ca.cacert +- %HOSTIP %HTTP3PORT %CERTDIR/certs/test-ca.cacert </command> </client> diff --git a/tests/data/test3026 b/tests/data/test3026 index ee9b30678..08d74c4d9 100644 --- a/tests/data/test3026 +++ b/tests/data/test3026 @@ -30,9 +30,6 @@ curl_global_init thread-safety <tool> lib%TESTNUMBER </tool> -<command> -none -</command> </client> # diff --git a/tests/data/test448 b/tests/data/test448 index 0e257e704..108ead9b5 100644 --- a/tests/data/test448 +++ b/tests/data/test448 @@ -35,7 +35,6 @@ http <setenv> FUNVALUE=contents VALUE2=curl -BLANK= </setenv> <name> Environment variables within config file, unbalanced braces diff --git a/tests/data/test449 b/tests/data/test449 index 598199602..73c967728 100644 --- a/tests/data/test449 +++ b/tests/data/test449 @@ -36,6 +36,7 @@ http FUNVALUE=contents VALUE2=curl BLANK= +CURL_NOT_SET </setenv> <name> Environment variables in config file w/o [expand] diff --git a/tests/data/test458 b/tests/data/test458 index ce3794541..58e705226 100644 --- a/tests/data/test458 +++ b/tests/data/test458 @@ -34,7 +34,6 @@ http <setenv> FUNVALUE=contents%TESTNUMBER VALUE2=curl -BLANK= </setenv> <name> variable expand the file name with --expand-output diff --git a/tests/data/test501 b/tests/data/test501 index fb115cba6..3661351ea 100644 --- a/tests/data/test501 +++ b/tests/data/test501 @@ -25,9 +25,6 @@ lib%TESTNUMBER <name> simple libcurl attempt operation without URL set </name> -<command> -http://%HOSTIP:%NOLISTENPORT/%TESTNUMBER -</command> </client> # diff --git a/tests/data/test509 b/tests/data/test509 index 4cdbe80db..4990f3738 100644 --- a/tests/data/test509 +++ b/tests/data/test509 @@ -25,9 +25,6 @@ lib%TESTNUMBER <name> initialization with memory callbacks and actual usage </name> -<command> -nothing -</command> </client> # diff --git a/tests/data/test517 b/tests/data/test517 index ef18e3395..fb57f4a4b 100644 --- a/tests/data/test517 +++ b/tests/data/test517 @@ -23,9 +23,6 @@ lib%TESTNUMBER <name> curl_getdate() testing </name> -<command> -nothing -</command> </client> # diff --git a/tests/data/test543 b/tests/data/test543 index e3ac13bd2..2ec9ff863 100644 --- a/tests/data/test543 +++ b/tests/data/test543 @@ -17,10 +17,6 @@ lib%TESTNUMBER <name> curl_easy_escape </name> -<command> -- -</command> - </client> # Verify data after the test has been "shot" diff --git a/tests/data/test557 b/tests/data/test557 index 9d86c0ac2..08394d229 100644 --- a/tests/data/test557 +++ b/tests/data/test557 @@ -23,9 +23,6 @@ lib%TESTNUMBER <name> curl_mprintf() testing </name> -<command> -nothing -</command> </client> # diff --git a/tests/data/test558 b/tests/data/test558 index a7d6129e9..2dcf270bf 100644 --- a/tests/data/test558 +++ b/tests/data/test558 @@ -27,9 +27,6 @@ lib%TESTNUMBER <name> libtest memory tracking operational </name> -<command> -nothing -</command> </client> # diff --git a/tests/data/test574 b/tests/data/test574 index 50d2120f0..46c4883b6 100644 --- a/tests/data/test574 +++ b/tests/data/test574 @@ -62,9 +62,6 @@ EPSV RETR file.txt
EPSV
RETR someothertext.txt
-CWD /
-CWD fully_simulated
-CWD UNIX
EPSV
TYPE A
LIST
diff --git a/tests/data/test575 b/tests/data/test575 index fbb7343d9..4ed302fbb 100644 --- a/tests/data/test575 +++ b/tests/data/test575 @@ -60,9 +60,6 @@ EPSV RETR file.txt
EPSV
RETR someothertext.txt
-CWD /
-CWD fully_simulated
-CWD UNIX
EPSV
TYPE A
LIST
diff --git a/tests/data/test751 b/tests/data/test751 index 21a3df250..49c6b67b1 100644 --- a/tests/data/test751 +++ b/tests/data/test751 @@ -22,9 +22,6 @@ lib%TESTNUMBER <name> multi - add many easy handles </name> -<command> -</command> -</file> </client> # 1000 easy handles needs memory diff --git a/tests/data/test759 b/tests/data/test759 new file mode 100644 index 000000000..755236599 --- /dev/null +++ b/tests/data/test759 @@ -0,0 +1,30 @@ +<testcase> +<info> +<keywords> +globbing +</keywords> +</info> + +# +# Client-side +<client> +<server> +none +</server> +<name> +glob '{,' +</name> +<command> +"{,,,,,,,}" "{," "{,,," +</command> +</client> + +# +# Verify data after the test has been "shot" +<verify> +# curl: (3) unmatched brace in URL position 1: +<errorcode> +3 +</errorcode> +</verify> +</testcase> diff --git a/tests/data/test795 b/tests/data/test795 new file mode 100644 index 000000000..5eeb5b7d8 --- /dev/null +++ b/tests/data/test795 @@ -0,0 +1,39 @@ +<testcase> +<info> +<keywords> +DNS +</keywords> +</info> + +# Client-side +<client> +<features> +http +Debug +!c-ares +!win32 +</features> +<name> +Delayed resolve --connect-timeout check +</name> +<server> +none +</server> +<setenv> +CURL_DNS_DELAY_MS=5000 +</setenv> +<command> +http://test.invalid -v --no-progress-meter --trace-config dns --connect-timeout 1 -w \%{time_total} +</command> +</client> + +# Verify data after the test has been "shot" +<verify> +<errorcode> +28 +</errorcode> +<postcheck> +%SRCDIR/libtest/test795.pl %LOGDIR/stdout%TESTNUMBER 2 >> %LOGDIR/stderr%TESTNUMBER +</postcheck> +</verify> +</testcase> diff --git a/tests/devtest.pl b/tests/devtest.pl index 168e00ec9..0bfc71b07 100755 --- a/tests/devtest.pl +++ b/tests/devtest.pl @@ -54,14 +54,14 @@ use servers qw( protoport serverfortest stopservers -); + ); use runner qw( readtestkeywords singletest_preprocess -); + ); use testutil qw( setlogfunc -); + ); use getpart; diff --git a/tests/ech_tests.sh b/tests/ech_tests.sh index 9912929ff..9123bbc09 100755 --- a/tests/ech_tests.sh +++ b/tests/ech_tests.sh @@ -120,18 +120,15 @@ declare -A neither_targets=( DEFPORT=443 -function whenisitagain() -{ +function whenisitagain() { /bin/date -u +%Y%m%d-%H%M%S } -function fileage() -{ +function fileage() { echo $(($(date +%s) - $(date +%s -r "$1"))) } -function hostport2host() -{ +function hostport2host() { case $1 in *:*) host=${1%:*} port=${1##*:};; *) host=$1 port=$DEFPORT;; @@ -139,8 +136,7 @@ function hostport2host() echo "$host" } -function hostport2port() -{ +function hostport2port() { case $1 in *:*) host=${1%:*} port=${1##*:};; *) host=$1 port=$DEFPORT;; @@ -148,8 +144,7 @@ function hostport2port() echo "$port" } -function cli_test() -{ +function cli_test() { # 1st param is target URL turl=$1 # 2nd param is 0 if we expect curl to not work or 1 if we expect it @@ -191,8 +186,7 @@ function cli_test() rm -f "$TMPF" } -function get_ech_configlist() -{ +function get_ech_configlist() { domain=$1 ecl=$(dig +short https "$domain" | grep "ech=" | sed -e 's/^.*ech=//' | sed -e 's/ .*//') echo "$ecl" diff --git a/tests/globalconfig.pm b/tests/globalconfig.pm index 9fa436d8b..de9abab34 100644 --- a/tests/globalconfig.pm +++ b/tests/globalconfig.pm @@ -46,7 +46,7 @@ BEGIN { $TUNITDIR $SRVDIR $listonly - $ci + $buildinfo $LOCKDIR $LOGDIR $memanalyze @@ -78,11 +78,11 @@ BEGIN { use pathhelp qw( exe_ext dirsepadd -); + ); use Cwd qw(getcwd); use testutil qw( shell_quote -); + ); use File::Spec; @@ -95,7 +95,7 @@ our $verbose; # 1 to show verbose test output our $torture; # 1 to enable torture testing our $proxy_address; # external HTTP proxy address our $listonly; # only list the tests -our $ci; # show extra info useful in CI runs +our $buildinfo; # dump buildinfo.txt our $run_duphandle; # run curl with --test-duphandle to verify handle duplication our $run_event_based; # run curl with --test-event to test the event API our $automakestyle; # use automake-like test status output format diff --git a/tests/http/testenv/env.py b/tests/http/testenv/env.py index 0e1ce389d..ad1173a98 100644 --- a/tests/http/testenv/env.py +++ b/tests/http/testenv/env.py @@ -464,7 +464,9 @@ class Env: @staticmethod def curl_can_early_data() -> bool: - return Env.curl_uses_any_libs(['gnutls', 'wolfssl', 'quictls', 'openssl']) + if Env.curl_uses_lib('gnutls'): + return Env.curl_lib_version_at_least('gnutls', '3.6.13') + return Env.curl_uses_any_libs(['wolfssl', 'quictls', 'openssl']) @staticmethod def curl_can_h3_early_data() -> bool: diff --git a/tests/libtest/Makefile.am b/tests/libtest/Makefile.am index b62a359ea..4ccfbd2b7 100644 --- a/tests/libtest/Makefile.am +++ b/tests/libtest/Makefile.am @@ -42,7 +42,7 @@ AM_CPPFLAGS = -I$(top_srcdir)/include \ include Makefile.inc EXTRA_DIST = CMakeLists.txt $(FIRST_C) $(FIRST_H) $(UTILS_C) $(UTILS_H) $(TESTS_C) \ - test307.pl test610.pl test613.pl test1013.pl test1022.pl mk-lib1521.pl + test307.pl test610.pl test613.pl test795.pl test1013.pl test1022.pl mk-lib1521.pl CFLAGS += @CURL_CFLAG_EXTRAS@ diff --git a/tests/libtest/lib1517.c b/tests/libtest/lib1517.c index c542aad03..d8ad3b753 100644 --- a/tests/libtest/lib1517.c +++ b/tests/libtest/lib1517.c @@ -61,17 +61,6 @@ static CURLcode test_lib1517(const char *URL) struct t1517_WriteThis pooh; - if(!strcmp(URL, "check")) { -#if (defined(_WIN32) || defined(__CYGWIN__)) - curl_mprintf("Windows TCP does not deliver response data but reports " - "CONNABORTED\n"); - return TEST_ERR_FAILURE; /* skip since it fails on Windows without - workaround */ -#else - return CURLE_OK; /* sure, run this! */ -#endif - } - pooh.readptr = testdata; pooh.sizeleft = strlen(testdata); diff --git a/tests/libtest/lib1557.c b/tests/libtest/lib1557.c index 2381c07b6..0e33f48fb 100644 --- a/tests/libtest/lib1557.c +++ b/tests/libtest/lib1557.c @@ -36,7 +36,7 @@ static CURLcode test_lib1557(const char *URL) global_init(CURL_GLOBAL_ALL); multi_init(curlm); - multi_setopt(curlm, CURLMOPT_MAX_HOST_CONNECTIONS, 1); + multi_setopt(curlm, CURLMOPT_MAX_HOST_CONNECTIONS, 1L); easy_init(curl1); easy_setopt(curl1, CURLOPT_URL, URL); diff --git a/tests/libtest/test613.pl b/tests/libtest/test613.pl index 429168abf..48179833f 100755 --- a/tests/libtest/test613.pl +++ b/tests/libtest/test613.pl @@ -55,7 +55,7 @@ if($ARGV[0] eq "prepare") { print FILE "Test file to support curl test suite\n"; close(FILE); # The mtime is specifically chosen to be an even number so that it can be - # represented exactly on a FAT filesystem. + # represented exactly on a FAT file system. utime time, timegm(0,0,12,1,0,100), "plainfile.txt"; chmod 0666, "plainfile.txt"; @@ -64,7 +64,7 @@ if($ARGV[0] eq "prepare") { print FILE "Read-only test file to support curl test suite\n"; close(FILE); # The mtime is specifically chosen to be an even number so that it can be - # represented exactly on a FAT filesystem. + # represented exactly on a FAT file system. utime time, timegm(0,0,12,31,11,100), "rofile.txt"; chmod 0444, "rofile.txt"; if($^O eq 'cygwin') { @@ -114,7 +114,7 @@ elsif($ARGV[0] eq "postprocess") { next; } # Erase all directory metadata except for the name, as it is not - # consistent for across all test systems and filesystems + # consistent for across all test systems and file systems push @canondir, "d????????? N U U N ??? N NN:NN $8\n"; } elsif($1 eq "-") { # Ignore group and other permissions, because these may vary on diff --git a/tests/libtest/test795.pl b/tests/libtest/test795.pl new file mode 100755 index 000000000..6aa793f7f --- /dev/null +++ b/tests/libtest/test795.pl @@ -0,0 +1,46 @@ +#!/usr/bin/env perl +#*************************************************************************** +# _ _ ____ _ +# Project ___| | | | _ \| | +# / __| | | | |_) | | +# | (__| |_| | _ <| |___ +# \___|\___/|_| \_\_____| +# +# Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al. +# +# This software is licensed as described in the file COPYING, which +# you should have received as part of this distribution. The terms +# are also available at https://curl.se/docs/copyright.html. +# +# You may opt to use, copy, modify, merge, publish, distribute and/or sell +# copies of the Software, and permit persons to whom the Software is +# furnished to do so, under the terms of the COPYING file. +# +# This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY +# KIND, either express or implied. +# +# SPDX-License-Identifier: curl +# +########################################################################### +use strict; +use warnings; + +my $ok = 1; +my $exp_duration = $ARGV[1] + 0.0; + +# Read the output of curl --version +open(F, $ARGV[0]) || die "Can't open test result from $ARGV[0]\n"; +$_ = <F>; +chomp; +/\s*([\.\d]+)\s*/; +my $duration = $1 + 0.0; +close F; + +if ($duration <= $exp_duration) { + print "OK: duration of $duration in expected range\n"; + $ok = 0; +} +else { + print "FAILED: duration of $duration is larger than $exp_duration\n"; +} +exit $ok; diff --git a/tests/processhelp.pm b/tests/processhelp.pm index 43513aae0..f1f8ef525 100644 --- a/tests/processhelp.pm +++ b/tests/processhelp.pm @@ -29,6 +29,12 @@ use warnings; use Time::HiRes; +use pathhelp qw( + os_is_win + ); + +my $has_win32_process; + BEGIN { use base qw(Exporter); @@ -43,6 +49,18 @@ BEGIN { set_advisor_read_lock clear_advisor_read_lock ); + + if(os_is_win() && $^O ne 'MSWin32') { + $has_win32_process = eval { + no warnings "all"; + # https://metacpan.org/pod/Win32::Process + require Win32::Process; + # https://metacpan.org/pod/Win32::Process::List + require Win32::Process::List; + }; + } else { + $has_win32_process = 0; + } } use serverhelp qw( @@ -51,10 +69,6 @@ use serverhelp qw( datasockf_pidfilename ); -use pathhelp qw( - os_is_win - ); - use globalconfig qw( $dev_null ); @@ -114,11 +128,18 @@ sub pidexists { if($pid > 4194304 && os_is_win()) { $pid -= 4194304; if($^O ne 'MSWin32') { - my $filter = "PID eq $pid"; - # https://ss64.com/nt/tasklist.html - my $result = `tasklist -fi \"$filter\" 2>$dev_null`; - if(index($result, "$pid") != -1) { - return -$pid; + if($has_win32_process) { + my %processes = Win32::Process::List->new()->GetProcesses(); + if(exists $processes{$pid}) { + return -$pid; + } + } else { + my $filter = "PID eq $pid"; + # https://ss64.com/nt/tasklist.html + my $result = `tasklist -fi \"$filter\" 2>$dev_null`; + if(index($result, "$pid") != -1) { + return -$pid; + } } return 0; } @@ -145,10 +166,14 @@ sub pidterm { if($pid > 4194304 && os_is_win()) { $pid -= 4194304; if($^O ne 'MSWin32') { - # https://ss64.com/nt/taskkill.html - my $cmd = "taskkill -f -t -pid $pid >$dev_null 2>&1"; - print "Executing: '$cmd'\n"; - system($cmd); + if($has_win32_process) { + Win32::Process::KillProcess($pid, 0); + } else { + # https://ss64.com/nt/taskkill.html + my $cmd = "taskkill -f -t -pid $pid >$dev_null 2>&1"; + print "Executing: '$cmd'\n"; + system($cmd); + } return; } } @@ -170,10 +195,14 @@ sub pidkill { if($pid > 4194304 && os_is_win()) { $pid -= 4194304; if($^O ne 'MSWin32') { - # https://ss64.com/nt/taskkill.html - my $cmd = "taskkill -f -t -pid $pid >$dev_null 2>&1"; - print "Executing: '$cmd'\n"; - system($cmd); + if($has_win32_process) { + Win32::Process::KillProcess($pid, 0); + } else { + # https://ss64.com/nt/taskkill.html + my $cmd = "taskkill -f -t -pid $pid >$dev_null 2>&1"; + print "Executing: '$cmd'\n"; + system($cmd); + } return; } } diff --git a/tests/runtests.pl b/tests/runtests.pl index a470597bf..fd6232710 100755 --- a/tests/runtests.pl +++ b/tests/runtests.pl @@ -568,6 +568,9 @@ sub checksystemfeatures { $pwd = sys_native_current_path(); $feature{"win32"} = 1; } + if($curl =~ /cygwin|msys/i) { + $feature{"cygwin"} = 1; + } if($libcurl =~ /\sschannel\b/i) { $feature{"Schannel"} = 1; $feature{"SSLpinning"} = 1; @@ -853,14 +856,6 @@ sub checksystemfeatures { chomp $hosttype; my $hostos=$^O; - my $havediff; - if(system("diff $TESTDIR/DISABLED $TESTDIR/DISABLED 2>$dev_null") == 0) { - $havediff = 'available'; - } - else { - $havediff = 'missing'; - } - # display summary information about curl and the test host logmsg("********* System characteristics ******** \n", "* $curl\n", @@ -869,14 +864,10 @@ sub checksystemfeatures { "* Features: $feat\n", "* Disabled: $dis\n", "* Host: $hostname\n", - "* System: $hosttype\n"); - if($ci) { - logmsg("* OS: $hostos\n", - "* Perl: $^V ($^X)\n", - "* diff: $havediff\n"); - } - logmsg("* Args: $args\n"); - + "* System: $hosttype\n", + "* OS: $hostos\n", + "* Perl: $^V ($^X)\n", + "* Args: $args\n"); if($jobs) { # Only show if not the default for now logmsg "* Jobs: $jobs\n"; @@ -899,6 +890,9 @@ sub checksystemfeatures { logmsg "* Env: $env\n"; } logmsg "* Seed: $randseed\n"; + if(system("diff $TESTDIR/DISABLED $TESTDIR/DISABLED 2>$dev_null") != 0) { + logmsg "* diff: missing\n"; + } } ####################################################################### @@ -2449,8 +2443,8 @@ while(@ARGV) { # lists the test case names only $listonly=1; } - elsif($ARGV[0] eq "--ci") { - $ci=1; + elsif($ARGV[0] eq "--buildinfo") { + $buildinfo=1; } elsif($ARGV[0] =~ /^-j(.*)/) { # parallel jobs @@ -2505,8 +2499,8 @@ Usage: runtests.pl [options] [test selection(s)] -a continue even if a test fails -ac path use this curl only to talk to APIs (currently only CI test APIs) -am automake style output PASS/FAIL: [number] [name] + --buildinfo dump buildinfo.txt -c path use this curl executable - --ci show extra info useful in for CI runs (e.g. buildinfo.txt dump) -d display server debug info -e, --test-event event-based execution --test-duphandle duplicate handles before use @@ -2694,7 +2688,7 @@ if(!$listonly) { ####################################################################### # Output information about the curl build # -if(!$listonly && $ci) { +if(!$listonly && $buildinfo) { if(open(my $fd, "<", "../buildinfo.txt")) { while(my $line = <$fd>) { chomp $line; @@ -3054,7 +3048,7 @@ while() { # If we could be running more tests, don't wait so we can schedule a new # one immediately. If all runners are busy, wait a fraction of a second # for one to finish so we can still loop around to check the abort flag. - my $runnerwait = scalar(@runnersidle) && scalar(@runtests) ? 0 : 1.0; + my $runnerwait = scalar(@runnersidle) && scalar(@runtests) ? 0.1 : 1.0; my (@ridsready, $riderror) = runnerar_ready($runnerwait); if(@ridsready) { for my $ridready (@ridsready) { @@ -3067,6 +3061,7 @@ while() { undef $ridready; } if($ridready) { + $endwaitcnt = 0; # This runner is ready to be serviced my $testnum = $runnersrunning{$ridready}; defined $testnum || die "Internal error: test for runner $ridready unknown"; @@ -3151,7 +3146,8 @@ while() { delete $runnersrunning{$riderror} if(defined $runnersrunning{$riderror}); $globalabort = 1; } - if(!scalar(@runtests) && ++$endwaitcnt == (240 + $jobs)) { + $endwaitcnt += $runnerwait; + if($endwaitcnt >= 10) { # Once all tests have been scheduled on a runner at the end of a test # run, we just wait for their results to come in. If we're still # waiting after a couple of minutes ($endwaitcnt multiplied by @@ -3160,6 +3156,7 @@ while() { # likely point to a single test that has hung. logmsg "Hmmm, the tests are taking a while to finish. Here is the status:\n"; catch_usr1(); + $endwaitcnt = 0; } } diff --git a/tests/test745.pl b/tests/test745.pl index 02ed3be5c..faddda429 100755 --- a/tests/test745.pl +++ b/tests/test745.pl @@ -60,6 +60,18 @@ sub getinclude { $enum{"CURLOPT_CONV_FROM_UTF8_FUNCTION"}++; $enum{"CURLOPT_CONV_TO_NETWORK_FUNCTION"}++; close($f); + + open(my $f, "<", "$root/include/curl/multi.h") + || die "no curl.h"; + while(<$f>) { + if($_ =~ /\((CURLMOPT[^,]*), (CURLOPTTYPE_[^,]*)/) { + my ($opt, $type) = ($1, $2); + if($type !~ /LONG|OFF_T/) { + $enum{$opt}++; + } + } + } + close($f); } gettypecheck(); diff --git a/tests/testutil.pm b/tests/testutil.pm index d1cf0c6b3..e84cc45fd 100644 --- a/tests/testutil.pm +++ b/tests/testutil.pm @@ -58,7 +58,7 @@ use globalconfig qw( $torture $verbose $dev_null -); + ); my $logfunc; # optional reference to function for logging my @logmessages; # array holding logged messages |