]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
runner.pm: use `dirname()` in `singletest_prepare()`
authorViktor Szakats <commit@vsz.me>
Fri, 11 Jul 2025 13:07:16 +0000 (15:07 +0200)
committerViktor Szakats <commit@vsz.me>
Mon, 14 Jul 2025 09:24:28 +0000 (11:24 +0200)
Replacing a regex, for portability.

Reported-by: Stefan Eissing
Bug: https://github.com/curl/curl/issues/17871#issuecomment-3051830614

Cherry-picked from #17877
Closes #17900

tests/runner.pm

index 9ebee0598884f6762005f7afa630acafa4adb92a..d4a4dc385223776bf6eee1c1b4e5920c32b32c58 100644 (file)
@@ -38,6 +38,8 @@ use strict;
 use warnings;
 use 5.006;
 
+use File::Basename;
+
 BEGIN {
     use base qw(Exporter);
 
@@ -765,9 +767,7 @@ sub singletest_prepare {
             my $fileContent = join('', @inputfile);
 
             # make directories if needed
-            my $path = $filename;
-            # cut off the file name part
-            $path =~ s/^(.*)\/[^\/]*/$1/;
+            my $path = dirname($filename);
             my @ldparts = split(/\//, $LOGDIR);
             my $nparts = @ldparts;
             my @parts = split(/\//, $path);