]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
runtests: add `-m=seconds` to override test curl command timeout
authorViktor Szakats <commit@vsz.me>
Sat, 1 Nov 2025 02:07:36 +0000 (03:07 +0100)
committerViktor Szakats <commit@vsz.me>
Wed, 19 Nov 2025 21:04:52 +0000 (22:04 +0100)
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

16 files changed:
docs/runtests.md
tests/data/test1400
tests/data/test1401
tests/data/test1402
tests/data/test1403
tests/data/test1404
tests/data/test1405
tests/data/test1406
tests/data/test1407
tests/data/test1420
tests/data/test1465
tests/data/test1481
tests/data/test285
tests/globalconfig.pm
tests/runner.pm
tests/runtests.pl

index 373f07618d5e38b0a7e9491068046072f568063d..b449b3f4118d833c8e65f2af205b20b379dddc44 100644 (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.
index 1d2ece68e4ad7a23f5437fdf754273b9d65406cf..9c54240c2f1a27857ac622e5a06f39d894ecb2e2 100644 (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 **********
index 31259e079f1dae3594b931ceb5421940540ad416..e2f51f39112b505f8fd07917d2894c8c60724ce8 100644 (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 **********
index c256611b0d1ebad4abef4c668a4a14960f8ef590..77c0798da287fddfb606bff4f047291bcc9b3b17 100644 (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 **********
index 2a2f3617cd868d3e37636f90c89640b8631de6ea..94ada0fdd9cd4f5a3b870f013466a9ae8388c27b 100644 (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 **********
index 732c2678a6935fe9137801e8b79a55e171bf760b..3ffcde8939035d025c3d2441da4afafdc3d93415 100644 (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>
index a71a522cfaec14589e68f52142cd739ad35c6cea..84ccd6a0fb59e014b5bf19311b59614f5368558f 100644 (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>
index 5f935d2d075a3737e40dbd2e836873c434f3a0e9..776c880dad67a689547e6bfb321ed2b846d1b5eb 100644 (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>
index 9ab40cef40e39a9c3f45ad285375beab1ea4bec7..f767622b0b04479dc88016922bc1bdfc15ecf909 100644 (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>
index 4a6be824376e8228ae67fce25129b0338c538619..22d918acf52171979691fcd3408e20f09c615870 100644 (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>
index 686c28b0bac43d914183d0c28b9db9d2a2a060d9..b9e85535bac0894c9bb3f441cd6066aa8f8f21ff 100644 (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 **********
index 209c3f87e0a74a8632d24404ffe0959593f757cf..30b6d420e1e7c5d33a9cda89d2cbfe0fe4faa9dd 100644 (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 **********
index 03dc96f6a080806c1f99db0a7144ea10de47bcdd..edba1d33002a67ff6ee2007a1f8028fa6c39d636 100644 (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
index 6203b6274943f964ce5b18ecfdd9ad6665d3d50c..8543b3aec440b5969ff7b4646b6a1119bb37d60c 100644 (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
index 6113c18745278c7f0594f8385493fb73d868b61d..a73f9d599934dca513136ee346133d62d1999b8b 100644 (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) {
index 354be91f08a94a307a48442ab5d32e4f02d70231..54ac77e2e963620bdaf72736929dd20afc45325c 100755 (executable)
@@ -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