commit 991e809c389a85bb17cb1e4341df226c0c3812a8 Author: Oswald Buddenhagen <o...@users.sf.net> Date: Wed Mar 29 16:24:55 2017 +0200
autotest: factor out readfile() function src/run-tests.pl | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/src/run-tests.pl b/src/run-tests.pl index 4390173..b864b33 100755 --- a/src/run-tests.pl +++ b/src/run-tests.pl @@ -605,6 +605,16 @@ sub printchan($) 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 sub test($$$@) { @@ -632,10 +642,7 @@ sub test($$$@) exit 1; } - open(FILE, "<", "slave/.mbsyncstate.journal") or - die "Cannot read journal.\n"; - my @nj = <FILE>; - close FILE; + my @nj = readfile("slave/.mbsyncstate.journal"); ($xc, @ret) = runsync("-0 --no-expunge"); if ($xc || ckstate("slave/.mbsyncstate", @{ $$tx[2] })) { print "Journal replay failed.\n"; ------------------------------------------------------------------------------ Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot _______________________________________________ isync-devel mailing list isync-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/isync-devel