* [PATCH 2/3] lei sucks: allow it to work without SQLite
2021-09-12 8:42 4% [PATCH 0/3] test dependency fixes for minimal installs Eric Wong
@ 2021-09-12 8:42 7% ` Eric Wong
0 siblings, 0 replies; 2+ results
From: Eric Wong @ 2021-09-12 8:42 UTC (permalink / raw)
To: meta
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;
^ permalink raw reply related [relevance 7%]
* [PATCH 0/3] test dependency fixes for minimal installs
@ 2021-09-12 8:42 4% Eric Wong
2021-09-12 8:42 7% ` [PATCH 2/3] lei sucks: allow it to work without SQLite Eric Wong
0 siblings, 1 reply; 2+ results
From: Eric Wong @ 2021-09-12 8:42 UTC (permalink / raw)
To: meta
Everything that worked in 2014 when this project started
should still work today without new dependencies.
Eric Wong (3):
t/lei-*.t: guard setup_public_inboxes with test_lei
lei sucks: allow it to work without SQLite
test_common: only print $@ for Gcf2 failure
lib/PublicInbox/LeiSucks.pm | 4 ++--
lib/PublicInbox/TestCommon.pm | 14 ++++++++------
t/lei-auto-watch.t | 3 +--
t/lei-up.t | 2 +-
t/lei.t | 4 ++++
5 files changed, 16 insertions(+), 11 deletions(-)
^ permalink raw reply [relevance 4%]
Results 1-2 of 2 | reverse | options above
-- pct% links below jump to the message on this page, permalinks otherwise --
2021-09-12 8:42 4% [PATCH 0/3] test dependency fixes for minimal installs Eric Wong
2021-09-12 8:42 7% ` [PATCH 2/3] lei sucks: allow it to work without SQLite Eric Wong
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).