]> git.ipfire.org Git - thirdparty/public-inbox.git/commitdiff
tests: allow more tests to pass without xapian-compact
authorEric Wong <e@80x24.org>
Tue, 12 Sep 2023 12:25:24 +0000 (12:25 +0000)
committerEric Wong <e@80x24.org>
Tue, 12 Sep 2023 20:57:48 +0000 (20:57 +0000)
lib/PublicInbox/TestCommon.pm
t/extsearch.t
t/nntpd.t
t/xcpdb-reshard.t

index b1a37cedc91ecea45000d2a5b4a01a14ec851763..a8323e4d946a582e8f16f59c5448e49cb9901c68 100644 (file)
@@ -105,7 +105,8 @@ sub require_cmd ($;$) {
        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 (;$) {
index 545330aa7b694ae0032e23cce892f2927dd177f4..8ded338220e399bbeb14fdac16ccc65d5a88165e 100644 (file)
@@ -480,7 +480,7 @@ SKIP: {
        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
 
index f98d638e6f9f33c3c375dee1657c8deca0a44115..9a7efd86d7f2b099732be5d544802a42ee45a302 100644 (file)
--- a/t/nntpd.t
+++ b/t/nntpd.t
@@ -341,8 +341,8 @@ Date: Fri, 02 Oct 1993 00:00:00 +0000
        }
        # -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');
index cde9f151b4eef913dfc3d2922a6d0ac0ad277140..7797aaaf2fbe84d29243626f36cd787f8b5fa290 100644 (file)
@@ -43,7 +43,7 @@ my $XapianDatabase = do {
 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');