my $bin = $CACHE{$cmd} //= PublicInbox::Spawn::which($cmd);
return $bin if $bin;
return plan(skip_all => "$cmd missing from PATH for $0") if !$nr;
- defined(wantarray) ? undef : skip("$cmd missing, skipping $nr tests")
+ defined(wantarray) ? undef :
+ skip("$cmd missing, skipping $nr tests", $nr);
}
sub have_xapian_compact (;$) {
for my $i (2..3) {
is(grep(m!/ei[0-9]+/$i\z!, @dirs), 0, "no shard [$i]");
}
- skip 'xapian-compact missing', 4 unless have_xapian_compact;
+ have_xapian_compact 1;
ok(run_script([qw(-compact), $d], undef, $o), 'compact');
# n.b. stderr contains xapian-compact output
}
# -compact requires Xapian
SKIP: {
- require_mods('Xapian', 2);
- have_xapian_compact or skip 'xapian-compact missing', 2;
+ require_mods('Xapian', 1);
+ have_xapian_compact 1;
is(xsys(qw(git config), "--file=$home/.public-inbox/config",
"publicinbox.$group.indexlevel", 'medium'),
0, 'upgraded indexlevel');
for my $R (qw(2 4 1 3 3)) {
delete $ibx->{search}; # release old handles
my $cmd = [@xcpdb, "-R$R", $ibx->{inboxdir}];
- push @$cmd, '--compact' if $R == 1 && have_xapian_compact;
+ push @$cmd, '--compact' if $R == 1 && have_xapian_compact(1);
ok(run_script($cmd, $env), "xcpdb -R$R");
my @new_shards = grep(m!/\d+\z!, glob("$ibx->{inboxdir}/xap*/*"));
is(scalar(@new_shards), $R, 'resharded to two shards');