isync

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

commit fbc563e4cb879da3f6a73fc372860baba9b19e55
parent eab4a12a632b14436a4c595676a921fdc0d17319
Author: Oswald Buddenhagen <ossi@users.sf.net>
Date:   Thu, 17 Mar 2022 12:58:05 +0100

autotest skipping doomed messages more thoroughly

ensure that the messages are actually skipped, not subsequently
expunged.

Diffstat:
Msrc/common.h | 1+
Msrc/main.c | 3+++
Msrc/run-tests.pl | 39++++++++++++++++++++++++++++++++++-----
Msrc/sync.c | 3++-
4 files changed, 40 insertions(+), 6 deletions(-)

diff --git a/src/common.h b/src/common.h @@ -117,6 +117,7 @@ BIT_ENUM( KEEPJOURNAL, FORCEJOURNAL, FORCEASYNC(2), + FAKEEXPUNGE, ) #define DEBUG_ANY (DEBUG_MAILDIR | DEBUG_NET | DEBUG_SYNC | DEBUG_MAIN | DEBUG_DRV) diff --git a/src/main.c b/src/main.c @@ -444,6 +444,9 @@ main( int argc, char **argv ) case 's': JLimit = strtol( ochar, &ochar, 10 ); break; + case 'x': + DFlags |= FAKEEXPUNGE; + break; case 'z': DFlags |= ZERODELAY; break; diff --git a/src/run-tests.pl b/src/run-tests.pl @@ -765,7 +765,8 @@ sub test_impl($$$$) mkchan($sx); - my ($xc, $ret) = runsync($async, "-Tj -TJ", "1-initial.log"); + my ($xopt, $xsopt) = @$sfx > 3 ? ($$sfx[3], " ".$$sfx[3]) : ("", ""); + my ($xc, $ret) = runsync($async, "-Tj -TJ".$xsopt, "1-initial.log"); my $rtx = readchan($$sx{state}) if (!$xc); if ($xc || cmpchan($rtx, $tx)) { print "Input:\n"; @@ -797,7 +798,7 @@ sub test_impl($$$$) die("Cannot extract step count.\n"); } - my ($jxc, $jret) = runsync($async, "-0 --no-expunge", "2-replay.log"); + my ($jxc, $jret) = runsync($async, "-0 --no-expunge".$xsopt, "2-replay.log"); my $jrcs = readstate() if (!$jxc); if ($jxc || cmpstate({ far => $$tx{far}, near => $$tx{near}, state => $jrcs }, $tx)) { print "Journal replay failed.\n"; @@ -818,7 +819,7 @@ sub test_impl($$$$) } } - my ($ixc, $iret) = runsync($async, "", "3-verify.log"); + my ($ixc, $iret) = runsync($async, $xopt, "3-verify.log"); my $irtx = readchan() if (!$ixc); if ($ixc || cmpchan($irtx, $tx)) { print "Idempotence verification run failed.\n"; @@ -843,7 +844,7 @@ sub test_impl($$$$) for (my $l = 1; $l <= $njl; $l++) { mkchan($sx); - my ($nxc, $nret) = runsync($async, "-Ts$l", "4-interrupt.log"); + my ($nxc, $nret) = runsync($async, "-Ts$l".$xsopt, "4-interrupt.log"); if ($nxc != 100 << 8) { print "Interrupting at step $l/$njl failed.\n"; print "Debug output:\n"; @@ -853,7 +854,7 @@ sub test_impl($$$$) my $pnnj = readfile("near/.mbsyncstate.journal"); - ($nxc, $nret) = runsync($async, "-Tj", "5-resume.log"); + ($nxc, $nret) = runsync($async, "-Tj".$xsopt, "5-resume.log"); my $nrtx = readchan($$sx{state}) if (!$nxc); if ($nxc || cmpchan($nrtx, $tx)) { print "Resuming from step $l/$njl failed.\n"; @@ -1192,6 +1193,26 @@ my @X61 = ( ); test("maxuid topping", \@x60, \@X61, \@O61); +# Messages that would be instantly expunged on the target side. + +my @x90 = ( + C, 0, C, + A, "*DRT*", "*>D", "*DFP?", + B, "*DR*", "*>D", "*DFPT?", + C, "*", "*", "*", + D, "*T", "", "", +); + +my @O91 = ("", "", "Expunge Near\n", "-Tx"); +my @X91 = ( + D, 0, C, + A, "+P", ">+P", "|", + A, "&", "^", "+T", + B, "+PT", ">+PT", "|", + B, "&", "^", "", +); +test("doomed", \@x90, \@X91, \@O91); + # Trashing my @x10 = ( @@ -1203,6 +1224,8 @@ my @x10 = ( E, "*", "*", "_", F, "**", "*>", "*T?", G, "*T?", "*<", "**", + H, "**", "*>", "*FT?", + I, "*FT?", "*<", "**", J, "**", "*>", "*F?", K, "*F?", "*<", "**", L, "*T", "", "", @@ -1222,6 +1245,8 @@ my @X11 = ( E, "#/", "/", "", F, "#/", "/", "/", G, "/", "/", "#/", + H, "#/", "/", "/", + I, "/", "/", "#/", J, "", ">->", "^*", J, "", "", "&1/", K, "^*", "<-<", "", @@ -1244,6 +1269,8 @@ my @X12 = ( E, "#/", "/", "", F, "#/", "/", "/", G, "/", "/", "#/", + H, "#/", "/", "/", + I, "/", "/", "#/", J, "", ">->", "^*", J, "", "", "&1/", K, "^*", "<-<", "", @@ -1266,6 +1293,8 @@ my @X13 = ( E, "#/", "/", "", F, "#/", "/", "/", G, "#/", "/", "/", + H, "#/", "/", "/", + I, "#/", "/", "/", J, "", ">->", "^*", J, "", "", "&1/", K, "^*", "<-<", "", diff --git a/src/sync.c b/src/sync.c @@ -1754,7 +1754,8 @@ sync_close( sync_vars_t *svars, int t ) return; svars->state[t] |= ST_CLOSING; - if ((svars->chan->ops[t] & OP_EXPUNGE) /*&& !(svars->state[t] & ST_TRASH_BAD)*/) { + if ((svars->chan->ops[t] & OP_EXPUNGE) && !(DFlags & FAKEEXPUNGE) + /*&& !(svars->state[t] & ST_TRASH_BAD)*/) { debug( "expunging %s\n", str_fn[t] ); svars->drv[t]->close_box( svars->ctx[t], box_closed, AUX ); } else {