autotest: factor out readfile() function

This commit is contained in:
Oswald Buddenhagen 2017-03-29 16:24:55 +02:00
parent 2da7951fe0
commit 991e809c38

View File

@ -605,6 +605,16 @@ sub printchan($)
printstate(@{ $$cs[2] }); printstate(@{ $$cs[2] });
} }
sub readfile($)
{
my ($file) = @_;
open(FILE, $file) or return;
my @nj = <FILE>;
close FILE;
return @nj;
}
# $title, \@source_state, \@target_state, @channel_configs # $title, \@source_state, \@target_state, @channel_configs
sub test($$$@) sub test($$$@)
{ {
@ -632,10 +642,7 @@ sub test($$$@)
exit 1; exit 1;
} }
open(FILE, "<", "slave/.mbsyncstate.journal") or my @nj = readfile("slave/.mbsyncstate.journal");
die "Cannot read journal.\n";
my @nj = <FILE>;
close FILE;
($xc, @ret) = runsync("-0 --no-expunge"); ($xc, @ret) = runsync("-0 --no-expunge");
if ($xc || ckstate("slave/.mbsyncstate", @{ $$tx[2] })) { if ($xc || ckstate("slave/.mbsyncstate", @{ $$tx[2] })) {
print "Journal replay failed.\n"; print "Journal replay failed.\n";