From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: X-Spam-Status: No, score=-4.2 required=3.0 tests=ALL_TRUSTED,BAYES_00, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF shortcircuit=no autolearn=ham autolearn_force=no version=3.4.6 Received: from localhost (dcvr.yhbt.net [127.0.0.1]) by dcvr.yhbt.net (Postfix) with ESMTP id 789BB1F565 for ; Tue, 12 Sep 2023 12:25:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=80x24.org; s=selector1; t=1694521525; bh=htVcjb6zkUZMakQIgs47XVrr7m2fccJZgutj/rF+gTw=; h=From:To:Subject:Date:In-Reply-To:References:From; b=F0kZ1UCftrKMctHBVzNuk3dV4X+IofJJXLj6C+XBX1lBrRQHXgZ21YvF20FkKjHfM I8wfeZWHK5w9Bz1wCr1+EN2MNTzyHCn7U3xVMncdEc6sNBKkEg86JTIPbXkIeOhA10 19NWESc1f7Hvg87SZgz8aMCiETeR7/9VYt/TRE0c= From: Eric Wong To: meta@public-inbox.org Subject: [PATCH 2/2] tests: allow more tests to pass without xapian-compact Date: Tue, 12 Sep 2023 12:25:24 +0000 Message-ID: <20230912122525.1776117-3-e@80x24.org> In-Reply-To: <20230912122525.1776117-1-e@80x24.org> References: <20230912122525.1776117-1-e@80x24.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit List-Id: --- lib/PublicInbox/TestCommon.pm | 3 ++- t/extsearch.t | 2 +- t/nntpd.t | 4 ++-- t/xcpdb-reshard.t | 2 +- 4 files changed, 6 insertions(+), 5 deletions(-) diff --git a/lib/PublicInbox/TestCommon.pm b/lib/PublicInbox/TestCommon.pm index b1a37ced..a8323e4d 100644 --- a/lib/PublicInbox/TestCommon.pm +++ b/lib/PublicInbox/TestCommon.pm @@ -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 (;$) { diff --git a/t/extsearch.t b/t/extsearch.t index 545330aa..8ded3382 100644 --- a/t/extsearch.t +++ b/t/extsearch.t @@ -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 diff --git a/t/nntpd.t b/t/nntpd.t index f98d638e..9a7efd86 100644 --- 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'); diff --git a/t/xcpdb-reshard.t b/t/xcpdb-reshard.t index cde9f151..7797aaaf 100644 --- a/t/xcpdb-reshard.t +++ b/t/xcpdb-reshard.t @@ -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');