]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
runtests: flush cached test parts when (re)loading a file master
authorGraham Campbell <hello@gjcampbell.co.uk>
Tue, 14 Jul 2026 00:38:01 +0000 (01:38 +0100)
committerDan Fandrich <dan@coneharvesters.com>
Wed, 15 Jul 2026 23:36:36 +0000 (16:36 -0700)
Force test file reload on client connect in ftpserver.

Closes #22319

tests/ftpserver.pl
tests/getpart.pm
tests/runner.pm

index d0a3e22fa28e6b208f1813651b5cadc3dbc34fe0..0cb8cdc3442c66c1727fa3651cb8640c37ff67b7 100755 (executable)
@@ -3142,7 +3142,8 @@ while(1) {
     $| = 1;
 
     &customize(); # read test control instructions
-    loadtest("$logdir/test$testno");
+    # force a reload, a test retry may have regenerated the file
+    loadtest("$logdir/test$testno", 0, 1);
 
     my $welcome = $commandreply{"welcome"};
     if(!$welcome) {
index fc98da210c0bc716118d812836565a0e33b88400..10838b2675f0ba600dd199c3bd23c4a2ee972573 100644 (file)
@@ -44,7 +44,7 @@ BEGIN {
     );
 }
 
-use Memoize;
+use Memoize qw(memoize flush_cache);
 
 my @xml;      # test data file contents
 my $xmlfile;  # test data filename
@@ -199,9 +199,9 @@ sub partexists {
 # memoize('partexists', NORMALIZER => 'normalize_part');  # cache each result
 
 sub loadtest {
-    my ($file, $original) = @_;
+    my ($file, $original, $force) = @_;
 
-    if(defined $xmlfile && $file eq $xmlfile) {
+    if(!$force && defined $xmlfile && $file eq $xmlfile) {
         # This test is already loaded
         return
     }
@@ -209,6 +209,11 @@ sub loadtest {
     undef @xml;
     $xmlfile = "";
 
+    # flush results cached from an earlier load, the file may have been
+    # regenerated since with new variable substitutions
+    flush_cache('getpart');
+    flush_cache('getpartattr');
+
     if(open(my $xmlh, "<", $file)) {
         if($original) {
             binmode $xmlh, ':crlf';
index 9e514f0e238d3088f4a4f8674aa4280b74be13e0..594e383f74175d555d73e13a8b0bd2e97815b205 100644 (file)
@@ -655,8 +655,8 @@ sub singletest_preprocess {
     }
     close($fulltesth) or die "Failure writing test file";
 
-    # in case the process changed the file, reload it
-    loadtest("$LOGDIR/test${testnum}");
+    # in case the process changed the file, force a reload
+    loadtest("$LOGDIR/test${testnum}", 0, 1);
 }
 
 #######################################################################