consolidate testing options behind common switch

don't pollute the namespace with random uppercase switches. instead,
have a new -T switch with suboptions, just like -D.
This commit is contained in:
Oswald Buddenhagen 2020-12-16 13:49:27 +01:00
parent c3d91ae1e8
commit 30af61fb24
2 changed files with 19 additions and 10 deletions

View File

@ -710,12 +710,21 @@ main( int argc, char **argv )
op = DEBUG_ALL | VERBOSE;
DFlags |= op;
break;
case 'J':
DFlags |= KEEPJOURNAL;
JLimit = strtol( ochar, &ochar, 10 );
break;
case 'Z':
DFlags |= ZERODELAY;
case 'T':
for (; *ochar; ) {
switch (*ochar++) {
case 'j':
DFlags |= KEEPJOURNAL;
JLimit = strtol( ochar, &ochar, 10 );
break;
case 'z':
DFlags |= ZERODELAY;
break;
default:
error( "Unknown -T flag '%c'\n", *(ochar - 1) );
return 1;
}
}
break;
case 'v':
version();

View File

@ -345,7 +345,7 @@ sub runsync($$)
} else {
$flags .= " -D";
}
$cmd .= "$mbsync -Z $flags -c .mbsyncrc test";
$cmd .= "$mbsync -Tz $flags -c .mbsyncrc test";
open FILE, "$cmd 2>&1 |";
my @out = <FILE>;
close FILE or push(@out, $! ? "*** error closing mbsync: $!\n" : "*** mbsync exited with signal ".($?&127).", code ".($?>>8)."\n");
@ -692,7 +692,7 @@ sub test($$$@)
mkchan($$sx[0], $$sx[1], @{ $$sx[2] });
my ($xc, @ret) = runsync("-J", "1-initial.log");
my ($xc, @ret) = runsync("-Tj", "1-initial.log");
if ($xc || ckchan("near/.mbsyncstate.new", $tx)) {
print "Input:\n";
printchan($sx);
@ -752,7 +752,7 @@ sub test($$$@)
for (my $l = 1; $l <= $njl; $l++) {
mkchan($$sx[0], $$sx[1], @{ $$sx[2] });
my ($nxc, @nret) = runsync("-J$l", "4-interrupt.log");
my ($nxc, @nret) = runsync("-Tj$l", "4-interrupt.log");
if ($nxc != (100 + ($l & 1)) << 8) {
print "Interrupting at step $l/$njl failed.\n";
print "Debug output:\n";
@ -760,7 +760,7 @@ sub test($$$@)
exit 1;
}
($nxc, @nret) = runsync("-J", "5-resume.log");
($nxc, @nret) = runsync("-Tj", "5-resume.log");
if ($nxc || ckchan("near/.mbsyncstate.new", $tx)) {
print "Resuming from step $l/$njl failed.\n";
print "Input:\n";