]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
runtests: allow client/file to specify multiple directories
authorDaniel Stenberg <daniel@haxx.se>
Sun, 2 Jan 2022 21:22:14 +0000 (22:22 +0100)
committerDaniel Stenberg <daniel@haxx.se>
Fri, 7 Jan 2022 09:08:35 +0000 (10:08 +0100)
... and make sure to mkdir them all

tests/runtests.pl

index 066a91bf5c2fa6a1887d49e05dc2f17dccbccf0c..ca82d09b2ed5081cc923afb77e8dfefa1c57366e 100755 (executable)
@@ -3976,6 +3976,20 @@ sub singletest {
                 return -1;
             }
             my $fileContent = join('', @inputfile);
+
+            # make directories if needed
+            my $path = $filename;
+            # cut off the file name part
+            $path =~ s/^(.*)\/[^\/]*/$1/;
+            my @parts = split(/\//, $path);
+            if($parts[0] eq "log") {
+                # the file is in log/
+                my $d = shift @parts;
+                for(@parts) {
+                    $d .= "/$_";
+                    mkdir $d; # 0777
+                }
+            }
             open(OUTFILE, ">$filename");
             binmode OUTFILE; # for crapage systems, use binary
             if($fileattr{'nonewline'}) {