Browse Source

verify idempotence of all sync operations

wip/maildir-uid-dupes-test
Oswald Buddenhagen 11 years ago
parent
commit
fe3d19b7eb
  1. 43
      src/run-tests.pl

43
src/run-tests.pl

@ -156,8 +156,6 @@ my @X11 = (
); );
test("max size", \@x10, \@X11, @O11); test("max size", \@x10, \@X11, @O11);
test("max size verification", \@X11, \@X11, @O11);
my @O22 = ("", "MaxSize 1k\n", ""); my @O22 = ("", "MaxSize 1k\n", "");
#show("11", "22", "22"); #show("11", "22", "22");
my @X22 = ( my @X22 = (
@ -193,8 +191,6 @@ my @X31 = (
); );
test("max messages", \@x30, \@X31, @O31); test("max messages", \@x30, \@X31, @O31);
test("max messages verification", \@X31, \@X31, @O31);
my @x50 = ( my @x50 = (
[ 6, [ 6,
1, 1, "FS", 2, 2, "FS", 3, 3, "S", 4, 4, "", 5, 5, "", 6, 6, "" ], 1, 1, "FS", 2, 2, "FS", 3, 3, "S", 4, 4, "", 5, 5, "", 6, 6, "" ],
@ -552,11 +548,11 @@ sub ckstate($@)
return 0; return 0;
} }
# \@chan_state # $statefile, \@chan_state
sub ckchan($) sub ckchan($$)
{ {
my ($cs) = @_; my ($F, $cs) = @_;
my $rslt = ckstate("slave/.mbsyncstate.new", @{ $$cs[2] }); my $rslt = ckstate($F, @{ $$cs[2] });
$rslt |= &ckbox("master", @{ $$cs[0] }); $rslt |= &ckbox("master", @{ $$cs[0] });
$rslt |= &ckbox("slave", @{ $$cs[1] }); $rslt |= &ckbox("slave", @{ $$cs[1] });
return $rslt; return $rslt;
@ -617,6 +613,7 @@ sub test($$$@)
print "Testing: ".$ttl." ...\n"; print "Testing: ".$ttl." ...\n";
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");
if ($xc) { if ($xc) {
print "Input:\n"; print "Input:\n";
@ -629,7 +626,7 @@ sub test($$$@)
print @ret; print @ret;
exit 1; exit 1;
} }
if (ckchan($tx)) { if (ckchan("slave/.mbsyncstate.new", $tx)) {
print "Input:\n"; print "Input:\n";
printchan($sx); printchan($sx);
print "Options:\n"; print "Options:\n";
@ -642,12 +639,12 @@ sub test($$$@)
print @ret; print @ret;
exit 1; exit 1;
} }
open(FILE, "<", "slave/.mbsyncstate.journal") or open(FILE, "<", "slave/.mbsyncstate.journal") or
die "Cannot read journal.\n"; die "Cannot read journal.\n";
my @nj = <FILE>; my @nj = <FILE>;
close FILE; close FILE;
($xc, @ret) = runsync("-0 --no-expunge"); ($xc, @ret) = runsync("-0 --no-expunge");
killcfg();
if ($xc) { if ($xc) {
print "Journal replay failed.\n"; print "Journal replay failed.\n";
print "Input == Expected result:\n"; print "Input == Expected result:\n";
@ -673,6 +670,32 @@ sub test($$$@)
print @ret; print @ret;
exit 1; exit 1;
} }
($xc, @ret) = runsync("");
if ($xc) {
print "Idempotence verification run failed.\n";
print "Input == Expected result:\n";
printchan($tx);
print "Options:\n";
print " [ ".join(", ", map('"'.qm($_).'"', @sfx))." ]\n";
print "Debug output:\n";
print @ret;
exit 1;
}
if (ckchan("slave/.mbsyncstate", $tx)) {
print "Idempotence verification run failed.\n";
print "Input == Expected result:\n";
printchan($tx);
print "Options:\n";
print " [ ".join(", ", map('"'.qm($_).'"', @sfx))." ]\n";
print "Actual result:\n";
showchan("slave/.mbsyncstate");
print "Debug output:\n";
print @ret;
exit 1;
}
killcfg();
rmtree "slave"; rmtree "slave";
rmtree "master"; rmtree "master";
} }

Loading…
Cancel
Save