xap_helper currently relies on FDs passed via SCM_RIGHTS for
robustness against $TMPDIR failures and over-eager FS cleanup
tasks. This depends on stable syscall numbers (Linux) or
Inline::C||Socket::MsgHdr being available, though, as Perl5
itself doesn't support SCM_RIGHTS.
We could probably add FIFO support to xap_helper for portability
to systems where neither Inline::C nor Socket::MsgHdr are available,
but that's for another day.
---
lib/PublicInbox/TestCommon.pm | 23 +++++++++++++----------
t/xap_helper.t | 2 ++
2 files changed, 15 insertions(+), 10 deletions(-)
diff --git a/lib/PublicInbox/TestCommon.pm b/lib/PublicInbox/TestCommon.pm
index ddee58b1..6da993af 100644
--- a/lib/PublicInbox/TestCommon.pm
+++ b/lib/PublicInbox/TestCommon.pm
@@ -22,7 +22,7 @@ BEGIN {
@EXPORT = qw(tmpdir tcp_server tcp_connect require_git require_mods
run_script start_script key2sub xsys xsys_e xqx eml_load tick
have_xapian_compact json_utf8 setup_public_inboxes create_inbox
- create_coderepo
+ create_coderepo no_scm_rights
tcp_host_port test_lei lei lei_ok $lei_out $lei_err $lei_opt
test_httpd xbail require_cmd is_xdeeply tail_f
ignore_inline_c_missing);
@@ -567,6 +567,16 @@ sub ignore_inline_c_missing {
grep(!/\bInline\b/, split(/^/m, $_[0])))));
}
+sub no_scm_rights () {
+ state $ok = PublicInbox::Spawn->can('send_cmd4') || do {
+ require PublicInbox::Syscall;
+ PublicInbox::Syscall->can('send_cmd4');
+ } || eval { require Socket::MsgHdr; 1 };
+ return if $ok;
+ 'Inline::C unconfigured/missing '.
+ '(mkdir -p ~/.cache/public-inbox/inline-c) OR Socket::MsgHdr missing';
+}
+
sub test_lei {
SKIP: {
my ($cb) = pop @_;
@@ -591,15 +601,8 @@ SKIP: {
$ENV{LANG} = $ENV{LC_ALL} = 'C';
my (undef, $fn, $lineno) = caller(0);
my $t = "$fn:$lineno";
- state $lei_daemon = PublicInbox::Spawn->can('send_cmd4') || do {
- require PublicInbox::Syscall;
- PublicInbox::Syscall->can('send_cmd4');
- } || eval { require Socket::MsgHdr; 1 };
- unless ($lei_daemon) {
- skip('Inline::C unconfigured/missing '.
-'(mkdir -p ~/.cache/public-inbox/inline-c) OR Socket::MsgHdr missing',
- 1);
- }
+ state $msg = no_scm_rights();
+ skip $msg, 1 if $msg;
$lei_opt = { 1 => \$lei_out, 2 => \$lei_err };
my ($daemon_pid, $for_destroy, $daemon_xrd);
my $tmpdir = $test_opt->{tmpdir};
diff --git a/t/xap_helper.t b/t/xap_helper.t
index 92da2e6d..3646cf97 100644
--- a/t/xap_helper.t
+++ b/t/xap_helper.t
@@ -4,6 +4,8 @@
use v5.12;
use PublicInbox::TestCommon;
require_mods(qw(DBD::SQLite Search::Xapian));
+my $msg = no_scm_rights;
+plan(skip_all => $msg) if $msg; # TODO: FIFO support?
use PublicInbox::Spawn qw(spawn);
use Socket qw(AF_UNIX SOCK_SEQPACKET SOCK_STREAM MSG_EOR);
require PublicInbox::AutoReap;