autotest skipping doomed messages more thoroughly

ensure that the messages are actually skipped, not subsequently
expunged.
This commit is contained in:
Oswald Buddenhagen 2022-03-17 12:58:05 +01:00
parent eab4a12a63
commit fbc563e4cb
4 changed files with 40 additions and 6 deletions

View File

@ -117,6 +117,7 @@ BIT_ENUM(
KEEPJOURNAL, KEEPJOURNAL,
FORCEJOURNAL, FORCEJOURNAL,
FORCEASYNC(2), FORCEASYNC(2),
FAKEEXPUNGE,
) )
#define DEBUG_ANY (DEBUG_MAILDIR | DEBUG_NET | DEBUG_SYNC | DEBUG_MAIN | DEBUG_DRV) #define DEBUG_ANY (DEBUG_MAILDIR | DEBUG_NET | DEBUG_SYNC | DEBUG_MAIN | DEBUG_DRV)

View File

@ -444,6 +444,9 @@ main( int argc, char **argv )
case 's': case 's':
JLimit = strtol( ochar, &ochar, 10 ); JLimit = strtol( ochar, &ochar, 10 );
break; break;
case 'x':
DFlags |= FAKEEXPUNGE;
break;
case 'z': case 'z':
DFlags |= ZERODELAY; DFlags |= ZERODELAY;
break; break;

View File

@ -765,7 +765,8 @@ sub test_impl($$$$)
mkchan($sx); 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); my $rtx = readchan($$sx{state}) if (!$xc);
if ($xc || cmpchan($rtx, $tx)) { if ($xc || cmpchan($rtx, $tx)) {
print "Input:\n"; print "Input:\n";
@ -797,7 +798,7 @@ sub test_impl($$$$)
die("Cannot extract step count.\n"); 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); my $jrcs = readstate() if (!$jxc);
if ($jxc || cmpstate({ far => $$tx{far}, near => $$tx{near}, state => $jrcs }, $tx)) { if ($jxc || cmpstate({ far => $$tx{far}, near => $$tx{near}, state => $jrcs }, $tx)) {
print "Journal replay failed.\n"; 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); my $irtx = readchan() if (!$ixc);
if ($ixc || cmpchan($irtx, $tx)) { if ($ixc || cmpchan($irtx, $tx)) {
print "Idempotence verification run failed.\n"; print "Idempotence verification run failed.\n";
@ -843,7 +844,7 @@ sub test_impl($$$$)
for (my $l = 1; $l <= $njl; $l++) { for (my $l = 1; $l <= $njl; $l++) {
mkchan($sx); 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) { if ($nxc != 100 << 8) {
print "Interrupting at step $l/$njl failed.\n"; print "Interrupting at step $l/$njl failed.\n";
print "Debug output:\n"; print "Debug output:\n";
@ -853,7 +854,7 @@ sub test_impl($$$$)
my $pnnj = readfile("near/.mbsyncstate.journal"); 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); my $nrtx = readchan($$sx{state}) if (!$nxc);
if ($nxc || cmpchan($nrtx, $tx)) { if ($nxc || cmpchan($nrtx, $tx)) {
print "Resuming from step $l/$njl failed.\n"; print "Resuming from step $l/$njl failed.\n";
@ -1192,6 +1193,26 @@ my @X61 = (
); );
test("maxuid topping", \@x60, \@X61, \@O61); 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 # Trashing
my @x10 = ( my @x10 = (
@ -1203,6 +1224,8 @@ my @x10 = (
E, "*", "*", "_", E, "*", "*", "_",
F, "**", "*>", "*T?", F, "**", "*>", "*T?",
G, "*T?", "*<", "**", G, "*T?", "*<", "**",
H, "**", "*>", "*FT?",
I, "*FT?", "*<", "**",
J, "**", "*>", "*F?", J, "**", "*>", "*F?",
K, "*F?", "*<", "**", K, "*F?", "*<", "**",
L, "*T", "", "", L, "*T", "", "",
@ -1222,6 +1245,8 @@ my @X11 = (
E, "#/", "/", "", E, "#/", "/", "",
F, "#/", "/", "/", F, "#/", "/", "/",
G, "/", "/", "#/", G, "/", "/", "#/",
H, "#/", "/", "/",
I, "/", "/", "#/",
J, "", ">->", "^*", J, "", ">->", "^*",
J, "", "", "&1/", J, "", "", "&1/",
K, "^*", "<-<", "", K, "^*", "<-<", "",
@ -1244,6 +1269,8 @@ my @X12 = (
E, "#/", "/", "", E, "#/", "/", "",
F, "#/", "/", "/", F, "#/", "/", "/",
G, "/", "/", "#/", G, "/", "/", "#/",
H, "#/", "/", "/",
I, "/", "/", "#/",
J, "", ">->", "^*", J, "", ">->", "^*",
J, "", "", "&1/", J, "", "", "&1/",
K, "^*", "<-<", "", K, "^*", "<-<", "",
@ -1266,6 +1293,8 @@ my @X13 = (
E, "#/", "/", "", E, "#/", "/", "",
F, "#/", "/", "/", F, "#/", "/", "/",
G, "#/", "/", "/", G, "#/", "/", "/",
H, "#/", "/", "/",
I, "#/", "/", "/",
J, "", ">->", "^*", J, "", ">->", "^*",
J, "", "", "&1/", J, "", "", "&1/",
K, "^*", "<-<", "", K, "^*", "<-<", "",

View File

@ -1754,7 +1754,8 @@ sync_close( sync_vars_t *svars, int t )
return; return;
svars->state[t] |= ST_CLOSING; 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] ); debug( "expunging %s\n", str_fn[t] );
svars->drv[t]->close_box( svars->ctx[t], box_closed, AUX ); svars->drv[t]->close_box( svars->ctx[t], box_closed, AUX );
} else { } else {