autotest: write logs to files
they can get long, and having actual files also helps with diffing.
This commit is contained in:
parent
991e809c38
commit
f29bed526b
|
@ -273,16 +273,24 @@ SyncState *
|
||||||
|
|
||||||
sub killcfg()
|
sub killcfg()
|
||||||
{
|
{
|
||||||
|
unlink $_ for (glob("*.log"));
|
||||||
unlink ".mbsyncrc";
|
unlink ".mbsyncrc";
|
||||||
}
|
}
|
||||||
|
|
||||||
# $options
|
# $options
|
||||||
sub runsync($)
|
sub runsync($$)
|
||||||
{
|
{
|
||||||
# open FILE, "valgrind -q --log-fd=3 $mbsync ".shift()." -c .mbsyncrc test 3>&2 2>&1 |";
|
my ($flags, $file) = @_;
|
||||||
open FILE, "$mbsync -D -Z ".shift()." -c .mbsyncrc test 2>&1 |";
|
|
||||||
|
# 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>;
|
my @out = <FILE>;
|
||||||
close FILE or push(@out, $! ? "*** error closing mbsync: $!\n" : "*** mbsync exited with signal ".($?&127).", code ".($?>>8)."\n");
|
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;
|
return $?, @out;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -408,7 +416,7 @@ sub show($$$)
|
||||||
showchan("slave/.mbsyncstate");
|
showchan("slave/.mbsyncstate");
|
||||||
print ");\n";
|
print ");\n";
|
||||||
&writecfg(@sfx);
|
&writecfg(@sfx);
|
||||||
runsync("");
|
runsync("", "");
|
||||||
killcfg();
|
killcfg();
|
||||||
print "my \@X$tx = (\n";
|
print "my \@X$tx = (\n";
|
||||||
showchan("slave/.mbsyncstate");
|
showchan("slave/.mbsyncstate");
|
||||||
|
@ -625,7 +633,7 @@ sub test($$$@)
|
||||||
mkchan($$sx[0], $$sx[1], @{ $$sx[2] });
|
mkchan($$sx[0], $$sx[1], @{ $$sx[2] });
|
||||||
&writecfg(@sfx);
|
&writecfg(@sfx);
|
||||||
|
|
||||||
my ($xc, @ret) = runsync("-J");
|
my ($xc, @ret) = runsync("-J", "1-initial.log");
|
||||||
if ($xc || ckchan("slave/.mbsyncstate.new", $tx)) {
|
if ($xc || ckchan("slave/.mbsyncstate.new", $tx)) {
|
||||||
print "Input:\n";
|
print "Input:\n";
|
||||||
printchan($sx);
|
printchan($sx);
|
||||||
|
@ -643,7 +651,7 @@ sub test($$$@)
|
||||||
}
|
}
|
||||||
|
|
||||||
my @nj = readfile("slave/.mbsyncstate.journal");
|
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] })) {
|
if ($xc || ckstate("slave/.mbsyncstate", @{ $$tx[2] })) {
|
||||||
print "Journal replay failed.\n";
|
print "Journal replay failed.\n";
|
||||||
print "Options:\n";
|
print "Options:\n";
|
||||||
|
@ -662,7 +670,7 @@ sub test($$$@)
|
||||||
exit 1;
|
exit 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
($xc, @ret) = runsync("");
|
($xc, @ret) = runsync("", "3-verify.log");
|
||||||
if ($xc || ckchan("slave/.mbsyncstate", $tx)) {
|
if ($xc || ckchan("slave/.mbsyncstate", $tx)) {
|
||||||
print "Idempotence verification run failed.\n";
|
print "Idempotence verification run failed.\n";
|
||||||
print "Input == Expected result:\n";
|
print "Input == Expected result:\n";
|
||||||
|
|
Loading…
Reference in New Issue
Block a user