diff options
| author | fukachan <fukachan> | 2006-01-01 14:06:44 +0000 |
|---|---|---|
| committer | fukachan <fukachan> | 2006-01-01 14:06:44 +0000 |
| commit | 1e31aeac7e84da9e5befa37d3269ad17d8a13cd4 (patch) | |
| tree | 1482914a430781396c5ee70dabe930eff5433f39 | |
| parent | 00de36616e30c48169ab339604a4b5447cd061d7 (diff) | |
| download | fml8-1e31aeac7e84da9e5befa37d3269ad17d8a13cd4.tar.gz fml8-1e31aeac7e84da9e5befa37d3269ad17d8a13cd4.tar.bz2 fml8-1e31aeac7e84da9e5befa37d3269ad17d8a13cd4.zip | |
translate() takes $config as an argv.
avoid exit() exception in config.ph
| -rwxr-xr-x | regress/fml4to8/configtest.pl | 29 |
1 files changed, 25 insertions, 4 deletions
diff --git a/regress/fml4to8/configtest.pl b/regress/fml4to8/configtest.pl index beba4833..5f229e85 100755 --- a/regress/fml4to8/configtest.pl +++ b/regress/fml4to8/configtest.pl @@ -1,6 +1,6 @@ #!/usr/bin/env perl # -# $FML: configtest.pl,v 1.2 2004/12/29 01:02:26 fukachan Exp $ +# $FML: configtest.pl,v 1.3 2004/12/30 04:42:41 fukachan Exp $ # use strict; @@ -11,7 +11,7 @@ use vars qw(@failed_queue %failed_queue $base_dir); my $base_dir = shift || '/var/spool/ml'; for my $f (sort <$base_dir/*/config.ph>) { - if (-f $f) { + if (-f $f && is_ok($f)) { print "\n// check $f\n"; eval q{ check($f); }; print $@ if $@; @@ -19,7 +19,7 @@ for my $f (sort <$base_dir/*/config.ph>) { } for my $f (sort <$base_dir/*/.fml4rc/config.ph>) { - if (-f $f) { + if (-f $f && is_ok($f)) { print "\n// check $f\n"; eval q{ check($f); }; print $@ if $@; @@ -72,7 +72,7 @@ sub check print "# Q: $k => $y\n"; my $query = "# Q: $k => $y\n"; - if ($x = $config_ph->translate($diff, $k, $v)) { + if ($x = $config_ph->translate($config, $diff, $k, $v)) { if ($x =~ /IGNORED (since .*)/) { print "# A: OK (IGNORED $1)\n"; } @@ -115,3 +115,24 @@ sub _sort_order $x cmp $y; } + + +sub is_ok +{ + my ($file) = @_; + + use FileHandle; + my $rh = new FileHandle $file; + if (defined $rh) { + my $buf; + while ($buf = <$rh>) { + if ($buf =~ /^exit/) { + return 0; + } + } + + $rh->close(); + } + + return 1; +} |
