From: Daniel Stenberg Date: Fri, 28 Nov 2025 16:41:59 +0000 (+0100) Subject: runtests: allow a test to switch off memdebug X-Git-Tag: rc-8_18_0-1~95 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=02aa75a8c240af1a8912145497806e8925859a87;p=thirdparty%2Fcurl.git runtests: allow a test to switch off memdebug Test 3207 now uses this as its multi-threading is not fully memdebug compliant. Closes #19752 --- diff --git a/docs/tests/FILEFORMAT.md b/docs/tests/FILEFORMAT.md index 7851e08e25..1f3aa78991 100644 --- a/docs/tests/FILEFORMAT.md +++ b/docs/tests/FILEFORMAT.md @@ -586,7 +586,7 @@ command has been run. If the variable name has no assignment, no `=`, then that variable is just deleted. -### `` +### `` Command line to run. If the command spans multiple lines, they are concatenated with a space added @@ -608,6 +608,9 @@ otherwise written to verify stdout. Set `option="no-include"` to prevent the test script to slap on the `--include` argument. +Set `option="no-memdebug"` to make the test run without the memdebug tracking +system. For tests that are incompatible - multi-threaded for example. + Set `option="no-q"` avoid using `-q` as the first argument in the curl command line. diff --git a/lib/memdebug.c b/lib/memdebug.c index f5b88731ee..9fd54d026b 100644 --- a/lib/memdebug.c +++ b/lib/memdebug.c @@ -111,8 +111,6 @@ void curl_dbg_memdebug(const char *logname) if(!curl_dbg_logfile) { if(logname && *logname) curl_dbg_logfile = CURLX_FOPEN_LOW(logname, FOPEN_WRITETEXT); - else - curl_dbg_logfile = stderr; #ifdef MEMDEBUG_LOG_SYNC /* Flush the log file after every line so the log is not lost in a crash */ if(curl_dbg_logfile) diff --git a/tests/data/test3207 b/tests/data/test3207 index 4806ef5474..9aa3ee5a36 100644 --- a/tests/data/test3207 +++ b/tests/data/test3207 @@ -37,7 +37,7 @@ concurrent HTTPS GET using shared ssl session cache lib%TESTNUMBER # provide URL and ca-cert - + https://localhost:%HTTPSPORT/%TESTNUMBER %CERTDIR/certs/test-ca.crt diff --git a/tests/runner.pm b/tests/runner.pm index a73f9d5999..b69bbf2420 100644 --- a/tests/runner.pm +++ b/tests/runner.pm @@ -840,6 +840,7 @@ sub singletest_run { $tool = $tool_name . exe_ext('TOOL'); } + my $oldmemdebug; my $disablevalgrind; my $CMDLINE=""; my $cmdargs; @@ -1025,6 +1026,11 @@ sub singletest_run { # timestamp starting of test command $$testtimings{"timetoolini"} = Time::HiRes::time(); + if($cmdhash{'option'} && ($cmdhash{'option'} =~ /no-memdebug/)) { + $oldmemdebug = $ENV{'CURL_MEMDEBUG'}; + delete $ENV{'CURL_MEMDEBUG'}; + } + # run the command line we built if($torture) { $cmdres = torture($CMDLINE, @@ -1048,6 +1054,11 @@ sub singletest_run { ($cmdres, $dumped_core) = normalize_cmdres(runclient("$CMDLINE")); } + # restore contents + if($oldmemdebug) { + $ENV{'CURL_MEMDEBUG'} = $oldmemdebug; + } + # timestamp finishing of test command $$testtimings{"timetoolend"} = Time::HiRes::time(); diff --git a/tests/runtests.pl b/tests/runtests.pl index 3d557d1435..648666fd30 100755 --- a/tests/runtests.pl +++ b/tests/runtests.pl @@ -1763,8 +1763,10 @@ sub singletest_check { if(! -f "$logdir/$MEMDUMP") { my %cmdhash = getpartattr("client", "command"); my $cmdtype = $cmdhash{'type'} || "default"; - logmsg "\n** ALERT! memory tracking with no output file?\n" - if($cmdtype ne "perl"); + if($cmdhash{'option'} !~ /no-memdebug/) { + logmsg "\n** ALERT! memory tracking with no output file?\n" + if($cmdtype ne "perl"); + } $ok .= "-"; # problem with memory checking } else {