]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
runtests: allow a test to switch off memdebug
authorDaniel Stenberg <daniel@haxx.se>
Fri, 28 Nov 2025 16:41:59 +0000 (17:41 +0100)
committerDaniel Stenberg <daniel@haxx.se>
Fri, 28 Nov 2025 21:39:19 +0000 (22:39 +0100)
Test 3207 now uses this as its multi-threading is not fully memdebug
compliant.

Closes #19752

docs/tests/FILEFORMAT.md
lib/memdebug.c
tests/data/test3207
tests/runner.pm
tests/runtests.pl

index 7851e08e2597ca55ad88e382a68d6254c20124b7..1f3aa78991b80e90059a684d7029ad4cefb686d1 100644 (file)
@@ -586,7 +586,7 @@ command has been run.
 If the variable name has no assignment, no `=`, then that variable is just
 deleted.
 
-### `<command [option="no-q/no-output/no-include/force-output/binary-trace"] [timeout="secs"][delay="secs"][type="perl/shell"]>`
+### `<command [option="no-q/no-output/no-include/no-memdebug/force-output/binary-trace"] [timeout="secs"][delay="secs"][type="perl/shell"]>`
 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.
 
index f5b88731ee354c4c951fc9337b464668b1d65ab2..9fd54d026b69ea090b752d2b1ab515745bcce15d 100644 (file)
@@ -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)
index 4806ef5474d60a025044a428023a410046aadfdf..9aa3ee5a365fb28ec43b5564c9ccb3ddd7de2168 100644 (file)
@@ -37,7 +37,7 @@ concurrent HTTPS GET using shared ssl session cache
 lib%TESTNUMBER
 </tool>
 # provide URL and ca-cert
-<command>
+<command option="no-memdebug">
 https://localhost:%HTTPSPORT/%TESTNUMBER %CERTDIR/certs/test-ca.crt
 </command>
 </client>
index a73f9d599934dca513136ee346133d62d1999b8b..b69bbf2420aa3f69919d873a3f3fd5e23a433ae9 100644 (file)
@@ -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();
 
index 3d557d1435ed0f199c4d2a01d177e4ce800c208b..648666fd301e78a18bd0393ee33c96f394e90ec0 100755 (executable)
@@ -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 {