1 |
wakaba |
1.1 |
#!/usr/bin/perl -w |
2 |
|
|
use strict; |
3 |
|
|
|
4 |
|
|
use Getopt::Long; |
5 |
|
|
my $dir; |
6 |
|
|
my $out_dir; |
7 |
|
|
my $file_pattern; |
8 |
|
|
GetOptions ( |
9 |
|
|
'test-directory=s' => \$dir, |
10 |
|
|
'test-file-pattern=s' => \$file_pattern, |
11 |
|
|
'output-directory=s' => \$out_dir, |
12 |
|
|
); |
13 |
|
|
$dir or die "$0: test-directory must be specified"; |
14 |
|
|
$out_dir or die "$0: output-directory must be specified"; |
15 |
|
|
$file_pattern ||= qr/\.xml$/; |
16 |
|
|
|
17 |
|
|
opendir my $dirh, $dir or die "$0: $dir: $!"; |
18 |
|
|
for (grep {$_ ne 'alltests.xml'} grep /$file_pattern/, readdir $dirh) { |
19 |
|
|
my @cmd = ('perl', map ({"-I$_"} @INC), |
20 |
|
|
'domtest2perl.pl', $dir.'/'.$_, |
21 |
|
|
'--output-file' => $out_dir.'/'.$_.'.pl'); |
22 |
|
|
print STDERR join " ", @cmd, "\n"; |
23 |
|
|
system @cmd and die "$0: domtest2perl.pl: $@"; |
24 |
|
|
} |