isync

mailbox synchronization program
git clone https://git.code.sf.net/p/isync/isync
Log | Files | Refs | README | LICENSE

commit f29bed526befc2bfffc5049f09b982be2c491c56
parent 991e809c389a85bb17cb1e4341df226c0c3812a8
Author: Oswald Buddenhagen <ossi@users.sf.net>
Date:   Wed, 29 Mar 2017 16:31:32 +0200

autotest: write logs to files

they can get long, and having actual files also helps with diffing.

Diffstat:
Msrc/run-tests.pl | 22+++++++++++++++-------
1 file changed, 15 insertions(+), 7 deletions(-)

diff --git a/src/run-tests.pl b/src/run-tests.pl @@ -273,16 +273,24 @@ SyncState * sub killcfg() { + unlink $_ for (glob("*.log")); unlink ".mbsyncrc"; } # $options -sub runsync($) +sub runsync($$) { -# open FILE, "valgrind -q --log-fd=3 $mbsync ".shift()." -c .mbsyncrc test 3>&2 2>&1 |"; - open FILE, "$mbsync -D -Z ".shift()." -c .mbsyncrc test 2>&1 |"; + my ($flags, $file) = @_; + +# open FILE, "valgrind -q --log-fd=3 $mbsync $flags -c .mbsyncrc test 3>&2 2>&1 |"; + open FILE, "$mbsync -D -Z $flags -c .mbsyncrc test 2>&1 |"; my @out = <FILE>; close FILE or push(@out, $! ? "*** error closing mbsync: $!\n" : "*** mbsync exited with signal ".($?&127).", code ".($?>>8)."\n"); + if ($file) { + open FILE, ">$file" or die("Cannot create $file: $!\n"); + print FILE @out; + close FILE; + } return $?, @out; } @@ -408,7 +416,7 @@ sub show($$$) showchan("slave/.mbsyncstate"); print ");\n"; &writecfg(@sfx); - runsync(""); + runsync("", ""); killcfg(); print "my \@X$tx = (\n"; showchan("slave/.mbsyncstate"); @@ -625,7 +633,7 @@ sub test($$$@) mkchan($$sx[0], $$sx[1], @{ $$sx[2] }); &writecfg(@sfx); - my ($xc, @ret) = runsync("-J"); + my ($xc, @ret) = runsync("-J", "1-initial.log"); if ($xc || ckchan("slave/.mbsyncstate.new", $tx)) { print "Input:\n"; printchan($sx); @@ -643,7 +651,7 @@ sub test($$$@) } my @nj = readfile("slave/.mbsyncstate.journal"); - ($xc, @ret) = runsync("-0 --no-expunge"); + ($xc, @ret) = runsync("-0 --no-expunge", "2-replay.log"); if ($xc || ckstate("slave/.mbsyncstate", @{ $$tx[2] })) { print "Journal replay failed.\n"; print "Options:\n"; @@ -662,7 +670,7 @@ sub test($$$@) exit 1; } - ($xc, @ret) = runsync(""); + ($xc, @ret) = runsync("", "3-verify.log"); if ($xc || ckchan("slave/.mbsyncstate", $tx)) { print "Idempotence verification run failed.\n"; print "Input == Expected result:\n";