Browse Source

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.
1.4
Oswald Buddenhagen 4 years ago
parent
commit
30af61fb24
  1. 21
      src/main.c
  2. 8
      src/run-tests.pl

21
src/main.c

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

8
src/run-tests.pl

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

Loading…
Cancel
Save