From: Viktor Szakats Date: Sat, 1 Nov 2025 02:07:36 +0000 (+0100) Subject: runtests: add `-m=seconds` to override test curl command timeout X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=2decbb1c1f8a975425e2be5afebb3096b50de599;p=thirdparty%2Fcurl.git runtests: add `-m=seconds` to override test curl command timeout To override the curl default of 5 minutes (300000 ms). Sometimes a simple test data change can result in a stuck test, this option makes it exit with an error early. Possible future use in CI or fast machines to prevent a single test taking 5 minutes and failing the whole job. Example hangers: tests/data/test65: ```diff - + ``` tests/data/tests993: ```diff -%repeat[1000 x 95 328485%0d%0a]% +%repeat[1000 x 95 328485%0d%0a]% + ``` Closes #19319 --- diff --git a/docs/runtests.md b/docs/runtests.md index 373f07618d..b449b3f411 100644 --- a/docs/runtests.md +++ b/docs/runtests.md @@ -180,6 +180,10 @@ regression test suite. Lists all test case names. +## `-m=[seconds]` + +Set timeout for curl commands in tests + ## `-n` Disable the check for and use of valgrind. diff --git a/tests/data/test1400 b/tests/data/test1400 index 1d2ece68e4..9c54240c2f 100644 --- a/tests/data/test1400 +++ b/tests/data/test1400 @@ -59,6 +59,7 @@ $_ = '' if /CURLOPT_HTTP_VERSION/ $_ = '' if /CURLOPT_SSLVERSION/ $_ = '' if /CURLOPT_HTTP09_ALLOWED/ $_ = '' if /CURLOPT_INTERLEAVEDATA/ +$_ = '' if /CURLOPT_TIMEOUT_MS/ /********* Sample code generated by the curl command line tool ********** diff --git a/tests/data/test1401 b/tests/data/test1401 index 31259e079f..e2f51f3911 100644 --- a/tests/data/test1401 +++ b/tests/data/test1401 @@ -68,6 +68,7 @@ $_ = '' if /CURLOPT_SSH_KNOWNHOSTS/ $_ = '' if /CURLOPT_HTTP_VERSION/ $_ = '' if /CURLOPT_INTERLEAVEDATA/ $_ = '' if /CURLOPT_SSLVERSION/ +$_ = '' if /CURLOPT_TIMEOUT_MS/ /********* Sample code generated by the curl command line tool ********** diff --git a/tests/data/test1402 b/tests/data/test1402 index c256611b0d..77c0798da2 100644 --- a/tests/data/test1402 +++ b/tests/data/test1402 @@ -62,6 +62,7 @@ $_ = '' if /CURLOPT_SSH_KNOWNHOSTS/ $_ = '' if /CURLOPT_HTTP_VERSION/ $_ = '' if /CURLOPT_INTERLEAVEDATA/ $_ = '' if /CURLOPT_SSLVERSION/ +$_ = '' if /CURLOPT_TIMEOUT_MS/ /********* Sample code generated by the curl command line tool ********** diff --git a/tests/data/test1403 b/tests/data/test1403 index 2a2f3617cd..94ada0fdd9 100644 --- a/tests/data/test1403 +++ b/tests/data/test1403 @@ -59,6 +59,7 @@ $_ = '' if /CURLOPT_SSH_KNOWNHOSTS/ $_ = '' if /CURLOPT_HTTP_VERSION/ $_ = '' if /CURLOPT_INTERLEAVEDATA/ $_ = '' if /CURLOPT_SSLVERSION/ +$_ = '' if /CURLOPT_TIMEOUT_MS/ /********* Sample code generated by the curl command line tool ********** diff --git a/tests/data/test1404 b/tests/data/test1404 index 732c2678a6..3ffcde8939 100644 --- a/tests/data/test1404 +++ b/tests/data/test1404 @@ -104,6 +104,7 @@ $_ = '' if /CURLOPT_SSH_KNOWNHOSTS/ $_ = '' if /CURLOPT_HTTP_VERSION/ $_ = '' if /CURLOPT_INTERLEAVEDATA/ $_ = '' if /CURLOPT_SSLVERSION/ +$_ = '' if /CURLOPT_TIMEOUT_MS/ # CURL_DOES_CONVERSION generates an extra comment. $_ = '' if /\/\* "value" \*\// diff --git a/tests/data/test1405 b/tests/data/test1405 index a71a522cfa..84ccd6a0fb 100644 --- a/tests/data/test1405 +++ b/tests/data/test1405 @@ -144,6 +144,7 @@ $_ = '' if /CURLOPT_HTTP_VERSION/ $_ = '' if /CURLOPT_HTTP09_ALLOWED/ $_ = '' if /CURLOPT_INTERLEAVEDATA/ $_ = '' if /CURLOPT_SSLVERSION/ +$_ = '' if /CURLOPT_TIMEOUT_MS/ diff --git a/tests/data/test1406 b/tests/data/test1406 index 5f935d2d07..776c880dad 100644 --- a/tests/data/test1406 +++ b/tests/data/test1406 @@ -131,6 +131,7 @@ $_ = '' if /CURLOPT_HTTP_VERSION/ $_ = '' if /CURLOPT_HTTP09_ALLOWED/ $_ = '' if /CURLOPT_INTERLEAVEDATA/ $_ = '' if /CURLOPT_SSLVERSION/ +$_ = '' if /CURLOPT_TIMEOUT_MS/ diff --git a/tests/data/test1407 b/tests/data/test1407 index 9ab40cef40..f767622b0b 100644 --- a/tests/data/test1407 +++ b/tests/data/test1407 @@ -109,6 +109,7 @@ $_ = '' if /CURLOPT_HTTP_VERSION/ $_ = '' if /CURLOPT_HTTP09_ALLOWED/ $_ = '' if /CURLOPT_INTERLEAVEDATA/ $_ = '' if /CURLOPT_SSLVERSION/ +$_ = '' if /CURLOPT_TIMEOUT_MS/ diff --git a/tests/data/test1420 b/tests/data/test1420 index 4a6be82437..22d918acf5 100644 --- a/tests/data/test1420 +++ b/tests/data/test1420 @@ -113,6 +113,7 @@ $_ = '' if /CURLOPT_SSH_KNOWNHOSTS/ $_ = '' if /CURLOPT_HTTP_VERSION/ $_ = '' if /CURLOPT_INTERLEAVEDATA/ $_ = '' if /CURLOPT_SSLVERSION/ +$_ = '' if /CURLOPT_TIMEOUT_MS/ diff --git a/tests/data/test1465 b/tests/data/test1465 index 686c28b0ba..b9e85535ba 100644 --- a/tests/data/test1465 +++ b/tests/data/test1465 @@ -65,6 +65,7 @@ $_ = '' if /CURLOPT_SSH_KNOWNHOSTS/ $_ = '' if /CURLOPT_HTTP_VERSION/ $_ = '' if /CURLOPT_INTERLEAVEDATA/ $_ = '' if /CURLOPT_SSLVERSION/ +$_ = '' if /CURLOPT_TIMEOUT_MS/ /********* Sample code generated by the curl command line tool ********** diff --git a/tests/data/test1481 b/tests/data/test1481 index 209c3f87e0..30b6d420e1 100644 --- a/tests/data/test1481 +++ b/tests/data/test1481 @@ -61,6 +61,7 @@ $_ = '' if /CURLOPT_SSH_KNOWNHOSTS/ $_ = '' if /CURLOPT_HTTP_VERSION/ $_ = '' if /CURLOPT_HTTP09_ALLOWED/ $_ = '' if /CURLOPT_INTERLEAVEDATA/ +$_ = '' if /CURLOPT_TIMEOUT_MS/ /********* Sample code generated by the curl command line tool ********** diff --git a/tests/data/test285 b/tests/data/test285 index 03dc96f6a0..edba1d3300 100644 --- a/tests/data/test285 +++ b/tests/data/test285 @@ -16,7 +16,7 @@ tftp TFTP send --T %LOGDIR/test%TESTNUMBER.txt tftp://%HOSTIP:%TFTPPORT// --connect-timeout 549 +-T %LOGDIR/test%TESTNUMBER.txt tftp://%HOSTIP:%TFTPPORT// --connect-timeout 549 --max-time 599 a chunk of diff --git a/tests/globalconfig.pm b/tests/globalconfig.pm index 6203b62749..8543b3aec4 100644 --- a/tests/globalconfig.pm +++ b/tests/globalconfig.pm @@ -49,6 +49,7 @@ BEGIN { $buildinfo $LOCKDIR $LOGDIR + $maxtime $memanalyze $MEMDUMP $perlcmd @@ -103,6 +104,7 @@ our $anyway; # continue anyway, even if a test fail our $CURLVERSION=""; # curl's reported version number our $CURLVERNUM=""; # curl's reported version number (without -DEV) our $randseed = 0; # random number seed +our $maxtime; # curl command timeout override # paths our $pwd = getcwd(); # current working directory diff --git a/tests/runner.pm b/tests/runner.pm index 6113c18745..a73f9d5999 100644 --- a/tests/runner.pm +++ b/tests/runner.pm @@ -972,6 +972,9 @@ sub singletest_run { if((!$cmdhash{'option'}) || ($cmdhash{'option'} !~ /no-q/)) { $CMDLINE .= " -q"; } + if($maxtime) { + $CMDLINE .= " --max-time $maxtime"; + } } if(use_valgrind() && !$disablevalgrind) { diff --git a/tests/runtests.pl b/tests/runtests.pl index 354be91f08..54ac77e2e9 100755 --- a/tests/runtests.pl +++ b/tests/runtests.pl @@ -2421,6 +2421,10 @@ while(@ARGV) { $short=1; $automakestyle=1; } + elsif($ARGV[0] =~ /-m=(\d+)/) { + my ($num)=($1); + $maxtime=$num; + } elsif($ARGV[0] eq "-n") { # no valgrind undef $valgrind; @@ -2563,6 +2567,7 @@ Usage: runtests.pl [options] [test selection(s)] -k keep stdout and stderr files present after tests -L path require an additional perl library file to replace certain functions -l list all test case names/descriptions + -m=[seconds] set timeout for curl commands in tests -n no valgrind --no-debuginfod disable the valgrind debuginfod functionality -o variable=value set internal variable to the specified value