From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: X-Spam-Status: No, score=-4.0 required=3.0 tests=ALL_TRUSTED,BAYES_00 shortcircuit=no autolearn=ham autolearn_force=no version=3.4.2 Received: from localhost (dcvr.yhbt.net [127.0.0.1]) by dcvr.yhbt.net (Postfix) with ESMTP id 55FEA1F934 for ; Sun, 12 Sep 2021 08:42:20 +0000 (UTC) From: Eric Wong To: meta@public-inbox.org Subject: [PATCH 2/3] lei sucks: allow it to work without SQLite Date: Sun, 12 Sep 2021 08:42:18 +0000 Message-Id: <20210912084219.11609-3-e@80x24.org> In-Reply-To: <20210912084219.11609-1-e@80x24.org> References: <20210912084219.11609-1-e@80x24.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit List-Id: And try to improve the message about Inline::C while we're at it, since Socket::Msghdr isn't widely-packaged, yet. --- lib/PublicInbox/LeiSucks.pm | 4 ++-- lib/PublicInbox/TestCommon.pm | 12 +++++++----- t/lei.t | 4 ++++ 3 files changed, 13 insertions(+), 7 deletions(-) diff --git a/lib/PublicInbox/LeiSucks.pm b/lib/PublicInbox/LeiSucks.pm index 3e945d0b..e832f95e 100644 --- a/lib/PublicInbox/LeiSucks.pm +++ b/lib/PublicInbox/LeiSucks.pm @@ -11,7 +11,6 @@ use Digest::SHA (); use Config; use POSIX (); use PublicInbox::Config; -use PublicInbox::Search; sub lei_sucks { my ($lei, @argv) = @_; @@ -41,7 +40,8 @@ sub lei_sucks { } else { push @out, "Unable to load DBI / DBD::SQLite: $@\n"; } - if (PublicInbox::Search::load_xapian()) { + if (eval { require PublicInbox::Search } && + PublicInbox::Search::load_xapian()) { push @out, 'Xapian '. join('.', map { $PublicInbox::Search::Xap->can($_)->(); diff --git a/lib/PublicInbox/TestCommon.pm b/lib/PublicInbox/TestCommon.pm index 14dac03f..d28b32b0 100644 --- a/lib/PublicInbox/TestCommon.pm +++ b/lib/PublicInbox/TestCommon.pm @@ -521,7 +521,8 @@ SKIP: { local $lei_cwdfh; opendir $lei_cwdfh, '.' or xbail "opendir .: $!"; require_git(2.6, 1) or skip('git 2.6+ required for lei test', 2); - require_mods(qw(json DBD::SQLite Search::Xapian), 2); + my $mods = $test_opt->{mods} // [ 'lei' ]; + require_mods(@$mods, 2); require PublicInbox::Config; require File::Path; local %ENV = %ENV; @@ -534,10 +535,11 @@ SKIP: { require PublicInbox::Spawn; state $lei_daemon = PublicInbox::Spawn->can('send_cmd4') || eval { require Socket::MsgHdr; 1 }; - # XXX fix and move this inside daemon-only before 1.7 release - skip <<'EOM', 1 unless $lei_daemon; -Socket::MsgHdr missing or Inline::C is unconfigured/missing -EOM + unless ($lei_daemon) { + skip('Inline::C unconfigured/missing '. +'(mkdir -p ~/.cache/public-inbox/inline-c) OR Socket::MsgHdr missing', + 1); + } $lei_opt = { 1 => \$lei_out, 2 => \$lei_err }; my ($daemon_pid, $for_destroy, $daemon_xrd); my $tmpdir = $test_opt->{tmpdir}; diff --git a/t/lei.t b/t/lei.t index dfbcb1f3..d1f1cbc0 100644 --- a/t/lei.t +++ b/t/lei.t @@ -176,4 +176,8 @@ test_lei(sub { $test_fail->(); }); +test_lei({ mods => [] }, sub { + lei_ok('sucks', \'no optional modules required'); +}); + done_testing;