autotest: implement much more thorough resumption verification
the test will now make a test run for every journaled step, both right before and right after the logging.
This commit is contained in:
parent
7ce658d14c
commit
efd72b85cc
|
@ -81,6 +81,7 @@ typedef unsigned int uint;
|
|||
#define ZERODELAY 0x2000
|
||||
|
||||
extern int DFlags;
|
||||
extern int JLimit;
|
||||
extern int UseFSync;
|
||||
extern char FieldDelimiter;
|
||||
|
||||
|
|
|
@ -32,6 +32,7 @@
|
|||
#include <sys/wait.h>
|
||||
|
||||
int DFlags;
|
||||
int JLimit;
|
||||
int UseFSync = 1;
|
||||
#if defined(WIN32) || defined(_WIN32) || defined(__WIN32__) || defined(__NT__) || defined(__CYGWIN__)
|
||||
char FieldDelimiter = ';';
|
||||
|
@ -684,6 +685,7 @@ main( int argc, char **argv )
|
|||
break;
|
||||
case 'J':
|
||||
DFlags |= KEEPJOURNAL;
|
||||
JLimit = strtol( ochar, &ochar, 10 );
|
||||
break;
|
||||
case 'Z':
|
||||
DFlags |= ZERODELAY;
|
||||
|
|
|
@ -641,9 +641,10 @@ sub test($$$@)
|
|||
|
||||
return 0 if (scalar(@ARGV) && !grep { $_ eq $ttl } @ARGV);
|
||||
print "Testing: ".$ttl." ...\n";
|
||||
mkchan($$sx[0], $$sx[1], @{ $$sx[2] });
|
||||
&writecfg(@sfx);
|
||||
|
||||
mkchan($$sx[0], $$sx[1], @{ $$sx[2] });
|
||||
|
||||
my ($xc, @ret) = runsync("-J", "1-initial.log");
|
||||
if ($xc || ckchan("slave/.mbsyncstate.new", $tx)) {
|
||||
print "Input:\n";
|
||||
|
@ -662,42 +663,80 @@ sub test($$$@)
|
|||
}
|
||||
|
||||
my @nj = readfile("slave/.mbsyncstate.journal");
|
||||
($xc, @ret) = runsync("-0 --no-expunge", "2-replay.log");
|
||||
if ($xc || ckstate("slave/.mbsyncstate", @{ $$tx[2] })) {
|
||||
my ($jxc, @jret) = runsync("-0 --no-expunge", "2-replay.log");
|
||||
if ($jxc || ckstate("slave/.mbsyncstate", @{ $$tx[2] })) {
|
||||
print "Journal replay failed.\n";
|
||||
print "Options:\n";
|
||||
print " [ ".join(", ", map('"'.qm($_).'"', @sfx))." ], [ \"-0\", \"--no-expunge\" ]\n";
|
||||
print "Old State:\n";
|
||||
printstate(@{ $$sx[2] });
|
||||
print "Journal:\n".join("", @nj)."\n";
|
||||
if (!$xc) {
|
||||
if (!$jxc) {
|
||||
print "Expected New State:\n";
|
||||
printstate(@{ $$tx[2] });
|
||||
print "New State:\n";
|
||||
showstate("slave/.mbsyncstate");
|
||||
}
|
||||
print "Debug output:\n";
|
||||
print @ret;
|
||||
print @jret;
|
||||
exit 1;
|
||||
}
|
||||
|
||||
($xc, @ret) = runsync("", "3-verify.log");
|
||||
if ($xc || ckchan("slave/.mbsyncstate", $tx)) {
|
||||
my ($ixc, @iret) = runsync("", "3-verify.log");
|
||||
if ($ixc || 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";
|
||||
if (!$xc) {
|
||||
if (!$ixc) {
|
||||
print "Actual result:\n";
|
||||
showchan("slave/.mbsyncstate");
|
||||
}
|
||||
print "Debug output:\n";
|
||||
print @ret;
|
||||
print @iret;
|
||||
exit 1;
|
||||
}
|
||||
|
||||
rmtree "slave";
|
||||
rmtree "master";
|
||||
|
||||
my $njl = (@nj - 1) * 2;
|
||||
for (my $l = 2; $l < $njl; $l++) {
|
||||
mkchan($$sx[0], $$sx[1], @{ $$sx[2] });
|
||||
|
||||
my ($nxc, @nret) = runsync("-J$l", "4-interrupt.log");
|
||||
if ($nxc != (100 + ($l & 1)) << 8) {
|
||||
print "Interrupting at step $l/$njl failed.\n";
|
||||
print "Debug output:\n";
|
||||
print @nret;
|
||||
exit 1;
|
||||
}
|
||||
|
||||
($nxc, @nret) = runsync("-J", "5-resume.log");
|
||||
if ($nxc || ckchan("slave/.mbsyncstate.new", $tx)) {
|
||||
print "Resuming from step $l/$njl failed.\n";
|
||||
print "Input:\n";
|
||||
printchan($sx);
|
||||
print "Options:\n";
|
||||
print " [ ".join(", ", map('"'.qm($_).'"', @sfx))." ]\n";
|
||||
my @nnj = readfile("slave/.mbsyncstate.journal");
|
||||
print "Journal:\n".join("", @nnj[0..($l / 2 - 1)])."-------\n".join("", @nnj[($l / 2)..$#nnj])."\n";
|
||||
print "Full journal:\n".join("", @nj)."\n";
|
||||
if (!$nxc) {
|
||||
print "Expected result:\n";
|
||||
printchan($tx);
|
||||
print "Actual result:\n";
|
||||
showchan("slave/.mbsyncstate");
|
||||
}
|
||||
print "Debug output:\n";
|
||||
print @nret;
|
||||
exit 1;
|
||||
}
|
||||
|
||||
killcfg();
|
||||
rmtree "slave";
|
||||
rmtree "master";
|
||||
}
|
||||
|
||||
killcfg();
|
||||
}
|
||||
|
|
|
@ -212,9 +212,13 @@ jFprintf( sync_vars_t *svars, const char *msg, ... )
|
|||
{
|
||||
va_list va;
|
||||
|
||||
if (JLimit && !--JLimit)
|
||||
exit( 101 );
|
||||
va_start( va, msg );
|
||||
vFprintf( svars->jfp, msg, va );
|
||||
va_end( va );
|
||||
if (JLimit && !--JLimit)
|
||||
exit( 100 );
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
Loading…
Reference in New Issue
Block a user