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
-<data1000 crlf="yes">
+<data1000 crlf="headers">
```

tests/data/tests993:
```diff
-%repeat[1000 x 95 328485%0d%0a]%</data>
+%repeat[1000 x 95 328485%0d%0a]%
+</data>
```

Closes #19319
This commit is contained in:
Viktor Szakats 2025-11-01 03:07:36 +01:00
parent 991119051c
commit 2decbb1c1f
No known key found for this signature in database
GPG Key ID: B5ABD165E2AEF201
16 changed files with 26 additions and 1 deletions

View File

@ -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.

View File

@ -59,6 +59,7 @@ $_ = '' if /CURLOPT_HTTP_VERSION/
$_ = '' if /CURLOPT_SSLVERSION/
$_ = '' if /CURLOPT_HTTP09_ALLOWED/
$_ = '' if /CURLOPT_INTERLEAVEDATA/
$_ = '' if /CURLOPT_TIMEOUT_MS/
</stripfile>
<file name="%LOGDIR/test%TESTNUMBER.c" mode="text">
/********* Sample code generated by the curl command line tool **********

View File

@ -68,6 +68,7 @@ $_ = '' if /CURLOPT_SSH_KNOWNHOSTS/
$_ = '' if /CURLOPT_HTTP_VERSION/
$_ = '' if /CURLOPT_INTERLEAVEDATA/
$_ = '' if /CURLOPT_SSLVERSION/
$_ = '' if /CURLOPT_TIMEOUT_MS/
</stripfile>
<file name="%LOGDIR/test%TESTNUMBER.c" mode="text">
/********* Sample code generated by the curl command line tool **********

View File

@ -62,6 +62,7 @@ $_ = '' if /CURLOPT_SSH_KNOWNHOSTS/
$_ = '' if /CURLOPT_HTTP_VERSION/
$_ = '' if /CURLOPT_INTERLEAVEDATA/
$_ = '' if /CURLOPT_SSLVERSION/
$_ = '' if /CURLOPT_TIMEOUT_MS/
</stripfile>
<file name="%LOGDIR/test%TESTNUMBER.c" mode="text">
/********* Sample code generated by the curl command line tool **********

View File

@ -59,6 +59,7 @@ $_ = '' if /CURLOPT_SSH_KNOWNHOSTS/
$_ = '' if /CURLOPT_HTTP_VERSION/
$_ = '' if /CURLOPT_INTERLEAVEDATA/
$_ = '' if /CURLOPT_SSLVERSION/
$_ = '' if /CURLOPT_TIMEOUT_MS/
</stripfile>
<file name="%LOGDIR/test%TESTNUMBER.c" mode="text">
/********* Sample code generated by the curl command line tool **********

View File

@ -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" \*\//
</stripfile>

View File

@ -144,6 +144,7 @@ $_ = '' if /CURLOPT_HTTP_VERSION/
$_ = '' if /CURLOPT_HTTP09_ALLOWED/
$_ = '' if /CURLOPT_INTERLEAVEDATA/
$_ = '' if /CURLOPT_SSLVERSION/
$_ = '' if /CURLOPT_TIMEOUT_MS/
</stripfile>
</verify>
</testcase>

View File

@ -131,6 +131,7 @@ $_ = '' if /CURLOPT_HTTP_VERSION/
$_ = '' if /CURLOPT_HTTP09_ALLOWED/
$_ = '' if /CURLOPT_INTERLEAVEDATA/
$_ = '' if /CURLOPT_SSLVERSION/
$_ = '' if /CURLOPT_TIMEOUT_MS/
</stripfile>
</verify>
</testcase>

View File

@ -109,6 +109,7 @@ $_ = '' if /CURLOPT_HTTP_VERSION/
$_ = '' if /CURLOPT_HTTP09_ALLOWED/
$_ = '' if /CURLOPT_INTERLEAVEDATA/
$_ = '' if /CURLOPT_SSLVERSION/
$_ = '' if /CURLOPT_TIMEOUT_MS/
</stripfile>
</verify>
</testcase>

View File

@ -113,6 +113,7 @@ $_ = '' if /CURLOPT_SSH_KNOWNHOSTS/
$_ = '' if /CURLOPT_HTTP_VERSION/
$_ = '' if /CURLOPT_INTERLEAVEDATA/
$_ = '' if /CURLOPT_SSLVERSION/
$_ = '' if /CURLOPT_TIMEOUT_MS/
</stripfile>
</verify>
</testcase>

View File

@ -65,6 +65,7 @@ $_ = '' if /CURLOPT_SSH_KNOWNHOSTS/
$_ = '' if /CURLOPT_HTTP_VERSION/
$_ = '' if /CURLOPT_INTERLEAVEDATA/
$_ = '' if /CURLOPT_SSLVERSION/
$_ = '' if /CURLOPT_TIMEOUT_MS/
</stripfile>
<file name="%LOGDIR/test%TESTNUMBER.c" mode="text">
/********* Sample code generated by the curl command line tool **********

View File

@ -61,6 +61,7 @@ $_ = '' if /CURLOPT_SSH_KNOWNHOSTS/
$_ = '' if /CURLOPT_HTTP_VERSION/
$_ = '' if /CURLOPT_HTTP09_ALLOWED/
$_ = '' if /CURLOPT_INTERLEAVEDATA/
$_ = '' if /CURLOPT_TIMEOUT_MS/
</stripfile>
<file name="%LOGDIR/test%TESTNUMBER.c" mode="text">
/********* Sample code generated by the curl command line tool **********

View File

@ -16,7 +16,7 @@ tftp
TFTP send
</name>
<command>
-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
</command>
<file name="%LOGDIR/test%TESTNUMBER.txt">
a chunk of

View File

@ -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

View File

@ -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) {

View File

@ -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