Browse Source

Refactored paths to work on every OS

Alois Mahdal 12 years ago
parent
commit
a7ce317666
1 changed files with 7 additions and 5 deletions
  1. 7
    5
      bin/autotest.pl

+ 7
- 5
bin/autotest.pl View File

@@ -19,6 +19,7 @@
19 19
 
20 20
 use v5.10;
21 21
 use warnings;
22
+use File::Spec;
22 23
 
23 24
 $PLATFORM   = (-d "c:\\windows" ? 'windows' : 'unix' );
24 25
 $DUMPS      = "dumps";
@@ -40,8 +41,7 @@ sub color {
40 41
 }
41 42
 
42 43
 sub cat {
43
-    $_  = shift;
44
-    my ($name) = m|^.*/(.*?)$|;
44
+    my $name = File::Spec->splitpath( shift );
45 45
     printf "$name:\n";
46 46
     if (open my $fh,  "<", $_) {
47 47
         my @lines = <$fh>;
@@ -58,9 +58,11 @@ sub run_tests {
58 58
     my $ret = 0;
59 59
     printf "===== STDOUT =====\n";
60 60
     foreach (@_) {
61
-        s|^$TESTS/*||;
62
-        say "$_:"; 
63
-        $cmd = sprintf 'perl %s 2>%s', "$TESTS\\$_", "$DUMPS\\$_.err";
61
+        my $name = File::Spec->splitpath( $_ );
62
+        say "$name:"; 
63
+        $cmd = sprintf 'perl %s 2>%s', 
64
+                        File::Spec->catdir( $TESTS, $name ),
65
+                        File::Spec->catdir( $DUMPS, $name . '.err' );
64 66
         system($cmd);
65 67
         $ret = $? >> 8;
66 68
         if ($ret) {