瀏覽代碼

Refactored paths to work on every OS

Alois Mahdal 12 年之前
父節點
當前提交
a7ce317666
共有 1 個文件被更改,包括 7 次插入5 次删除
  1. 7
    5
      bin/autotest.pl

+ 7
- 5
bin/autotest.pl 查看文件

19
 
19
 
20
 use v5.10;
20
 use v5.10;
21
 use warnings;
21
 use warnings;
22
+use File::Spec;
22
 
23
 
23
 $PLATFORM   = (-d "c:\\windows" ? 'windows' : 'unix' );
24
 $PLATFORM   = (-d "c:\\windows" ? 'windows' : 'unix' );
24
 $DUMPS      = "dumps";
25
 $DUMPS      = "dumps";
40
 }
41
 }
41
 
42
 
42
 sub cat {
43
 sub cat {
43
-    $_  = shift;
44
-    my ($name) = m|^.*/(.*?)$|;
44
+    my $name = File::Spec->splitpath( shift );
45
     printf "$name:\n";
45
     printf "$name:\n";
46
     if (open my $fh,  "<", $_) {
46
     if (open my $fh,  "<", $_) {
47
         my @lines = <$fh>;
47
         my @lines = <$fh>;
58
     my $ret = 0;
58
     my $ret = 0;
59
     printf "===== STDOUT =====\n";
59
     printf "===== STDOUT =====\n";
60
     foreach (@_) {
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
         system($cmd);
66
         system($cmd);
65
         $ret = $? >> 8;
67
         $ret = $? >> 8;
66
         if ($ret) {
68
         if ($ret) {