user/dev discussion of public-inbox itself
 help / color / mirror / code / Atom feed
From: Eric Wong <e@80x24.org>
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	[thread overview]
Message-ID: <20210912084219.11609-3-e@80x24.org> (raw)
In-Reply-To: <20210912084219.11609-1-e@80x24.org>

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;

  parent reply	other threads:[~2021-09-12  8:42 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-12  8:42 [PATCH 0/3] test dependency fixes for minimal installs Eric Wong
2021-09-12  8:42 ` [PATCH 1/3] t/lei-*.t: guard setup_public_inboxes with test_lei Eric Wong
2021-09-12  8:42 ` Eric Wong [this message]
2021-09-12  8:42 ` [PATCH 3/3] test_common: only print $@ for Gcf2 failure Eric Wong

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://public-inbox.org/README

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210912084219.11609-3-e@80x24.org \
    --to=e@80x24.org \
    --cc=meta@public-inbox.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/public-inbox.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).