diff options
| author | fukachan <fukachan> | 2001-01-28 08:07:07 +0000 |
|---|---|---|
| committer | fukachan <fukachan> | 2001-01-28 08:07:07 +0000 |
| commit | 872eced3f0bbdbe765e2f8343ba55138f6784e99 (patch) | |
| tree | 5a63b9634352ae059fac5cf12676115b0171946d | |
| parent | 03a19cedcd439693c3b9f5fc6dbe112d098d5400 (diff) | |
| download | fml8-872eced3f0bbdbe765e2f8343ba55138f6784e99.tar.gz fml8-872eced3f0bbdbe765e2f8343ba55138f6784e99.tar.bz2 fml8-872eced3f0bbdbe765e2f8343ba55138f6784e99.zip | |
check the result
| -rwxr-xr-x | fml/lib/IO/t/file_map_getpos.pl | 32 | ||||
| -rwxr-xr-x | fml/lib/IO/t/unixgroup_map.pl | 20 |
2 files changed, 44 insertions, 8 deletions
diff --git a/fml/lib/IO/t/file_map_getpos.pl b/fml/lib/IO/t/file_map_getpos.pl index 8d2f8068..4f86bedb 100755 --- a/fml/lib/IO/t/file_map_getpos.pl +++ b/fml/lib/IO/t/file_map_getpos.pl @@ -11,8 +11,11 @@ use strict; use Carp; -my $file = "/etc/passwd"; -my $map = "file:". $file; +my $debug = 0; +my $file = "/etc/passwd"; +my $map = "file:". $file; + +print STDERR "roll back test\n" if $debug; use IO::MapAdapter; my $obj = new IO::MapAdapter $map; @@ -23,20 +26,28 @@ my $pobot = 0; my $done = 0; my $i = 0; my $pebot = 0; -my $x; +my ($x, $prev_buf, $buf); + while ($x = $obj->getline) { $i++; - print "$i ", $x; + if ($i == 4 || $i == 7) { + print STDERR " > ", $x if $debug; + unless ($prev_buf) { + $prev_buf = $x; + } + $buf = $x; + } if ($i == 3) { $pebot = $obj->getpos; - print STDERR "*** roll back here\n"; + print STDERR " * roll back here\n" if $debug; } my $pos = $obj->getpos; unless ($done) { if ($i == 6) { - print STDERR "*** try to roll back ... \n"; + print STDERR " now> ", $x if $debug;; + print STDERR " * try to roll back ... \n" if $debug;; $obj->setpos( $pebot ); $done = 1; } @@ -44,4 +55,13 @@ while ($x = $obj->getline) { } $obj->close; + +if ($prev_buf eq $buf) { + print STDERR "roll back test ... ok\n"; + exit 0; +} +else { + exit 1; +} + exit 0; diff --git a/fml/lib/IO/t/unixgroup_map.pl b/fml/lib/IO/t/unixgroup_map.pl index 1bce0d95..c4ef7719 100755 --- a/fml/lib/IO/t/unixgroup_map.pl +++ b/fml/lib/IO/t/unixgroup_map.pl @@ -13,15 +13,31 @@ use strict; my $map = 'unix.group:wheel'; +my @group = getgrnam( 'wheel' ); +my @member = split(/\s+/,$group[3]); + use IO::MapAdapter; my $obj = new IO::MapAdapter $map; $obj->open || croak("cannot open $map"); if ($obj->error) { croak( $obj->error );} my $x; -my @recipients = (); -while ($x = $obj->get_recipient) { print $x, "\n";} +my @x = (); +while ($x = $obj->get_recipient) { push(@x, $x);} $obj->close; +my $bad = 0; +my $id = $$.time; +my $x = join("-${id}-", sort @x); +my $m = join("-${id}-", sort @member); + +if ($x eq $m) { + print "unix.group ... ok\n"; + exit 0; +} +else { + print "unix.group ... fail\n"; + exit 1; +} exit 0; |
