user/dev discussion of public-inbox itself
 help / color / mirror / code / Atom feed
Search results ordered by [date|relevance]  view[summary|nested|Atom feed]
thread overview below | download mbox.gz: |
* [PATCH 09/10] tests: add `+SCM_RIGHTS' as a require_mods target
  2023-09-04 10:35  7% [PATCH 00/10] signal-handling and *BSD fixes Eric Wong
@ 2023-09-04 10:36  7% ` Eric Wong
  0 siblings, 0 replies; 2+ results
From: Eric Wong @ 2023-09-04 10:36 UTC (permalink / raw)
  To: meta

We'll also ensure the existing `lei' target expands to depend on
`+SCM_RIGHTS', and use require_mods in t/lei-import-nntp.t and
t/lei.t so they can be skipped when Inline::C and Socket::MsgHdr
are missing on OpenBSD.
---
 lib/PublicInbox/TestCommon.pm | 15 +++++++++------
 t/lei-import-nntp.t           |  4 ++--
 t/lei.t                       |  3 ++-
 t/xap_helper.t                |  4 +---
 4 files changed, 14 insertions(+), 12 deletions(-)

diff --git a/lib/PublicInbox/TestCommon.pm b/lib/PublicInbox/TestCommon.pm
index 6da993af..a90e89d1 100644
--- a/lib/PublicInbox/TestCommon.pm
+++ b/lib/PublicInbox/TestCommon.pm
@@ -134,7 +134,7 @@ sub require_mods {
 	while (my $mod = shift(@mods)) {
 		if ($mod eq 'lei') {
 			require_git(2.6, $maybe ? $maybe : ());
-			push @mods, qw(DBD::SQLite Search::Xapian);
+			push @mods, qw(DBD::SQLite Search::Xapian +SCM_RIGHTS);
 			$mod = 'json'; # fall-through
 		}
 		if ($mod eq 'json') {
@@ -155,6 +155,11 @@ sub require_mods {
 				PublicInbox::Search::load_xapian()) {
 				next;
 			}
+		} elsif ($mod eq '+SCM_RIGHTS') {
+			if (my $msg = need_scm_rights()) {
+				push @need, $msg;
+				next;
+			}
 		} elsif (index($mod, '||') >= 0) { # "Foo||Bar"
 			my $ok;
 			for my $m (split(/\Q||\E/, $mod)) {
@@ -567,13 +572,13 @@ sub ignore_inline_c_missing {
 		grep(!/\bInline\b/, split(/^/m, $_[0])))));
 }
 
-sub no_scm_rights () {
+sub need_scm_rights () {
 	state $ok = PublicInbox::Spawn->can('send_cmd4') || do {
 			require PublicInbox::Syscall;
-			PublicInbox::Syscall->can('send_cmd4');
+			PublicInbox::Syscall->can('send_cmd4'); # Linux only
 		} || eval { require Socket::MsgHdr; 1 };
 	return if $ok;
-	'Inline::C unconfigured/missing '.
+	'need SCM_RIGHTS support: Inline::C unconfigured/missing '.
 	'(mkdir -p ~/.cache/public-inbox/inline-c) OR Socket::MsgHdr missing';
 }
 
@@ -601,8 +606,6 @@ SKIP: {
 	$ENV{LANG} = $ENV{LC_ALL} = 'C';
 	my (undef, $fn, $lineno) = caller(0);
 	my $t = "$fn:$lineno";
-	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/lei-import-nntp.t b/t/lei-import-nntp.t
index 2c48d973..c3ee06a2 100644
--- a/t/lei-import-nntp.t
+++ b/t/lei-import-nntp.t
@@ -1,9 +1,9 @@
 #!perl -w
-# Copyright (C) 2021 all contributors <meta@public-inbox.org>
+# Copyright (C) all contributors <meta@public-inbox.org>
 # License: AGPL-3.0+ <https://www.gnu.org/licenses/agpl-3.0.txt>
 use strict; use v5.10.1; use PublicInbox::TestCommon;
 require_git 2.6;
-require_mods(qw(json DBD::SQLite Search::Xapian Net::NNTP));
+require_mods(qw(lei json DBD::SQLite Search::Xapian Net::NNTP));
 my ($ro_home, $cfg_path) = setup_public_inboxes;
 my ($tmpdir, $for_destroy) = tmpdir;
 my $sock = tcp_server;
diff --git a/t/lei.t b/t/lei.t
index 5d0fa622..d83bde69 100644
--- a/t/lei.t
+++ b/t/lei.t
@@ -1,7 +1,8 @@
 #!perl -w
-# Copyright (C) 2020-2021 all contributors <meta@public-inbox.org>
+# Copyright (C) all contributors <meta@public-inbox.org>
 # License: AGPL-3.0+ <https://www.gnu.org/licenses/agpl-3.0.txt>
 use strict; use v5.10.1; use PublicInbox::TestCommon;
+require_mods 'lei';
 use File::Path qw(rmtree);
 
 # this only tests the basic help/config/init/completion bits of lei;
diff --git a/t/xap_helper.t b/t/xap_helper.t
index f4b3581f..0a211329 100644
--- a/t/xap_helper.t
+++ b/t/xap_helper.t
@@ -3,9 +3,7 @@
 # License: AGPL-3.0+ <https://www.gnu.org/licenses/agpl-3.0.txt>
 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?
+require_mods(qw(DBD::SQLite Search::Xapian +SCM_RIGHTS)); # TODO: FIFO support?
 use PublicInbox::Spawn qw(spawn);
 use Socket qw(AF_UNIX SOCK_SEQPACKET SOCK_STREAM);
 require PublicInbox::AutoReap;

^ permalink raw reply related	[relevance 7%]

* [PATCH 00/10] signal-handling and *BSD fixes
@ 2023-09-04 10:35  7% Eric Wong
  2023-09-04 10:36  7% ` [PATCH 09/10] tests: add `+SCM_RIGHTS' as a require_mods target Eric Wong
  0 siblings, 1 reply; 2+ results
From: Eric Wong @ 2023-09-04 10:35 UTC (permalink / raw)
  To: meta

kevent EVFILT_SIGNAL behaves differently than Linux signalfd
in that we can't rely on it to handle signals that were sent
before the existence of the kevent filter.  Thus, [5/10] opens
a window before entering the event.

This difference between OSes was noticed due to lei tests
quickly starting read-only daemons and terminating them before
signal handlers were setup properly from the lack of
SCM_RIGHTS support on *BSDs lacking Inline::C.

Nevertheless [9/10] improves test dependency management to
ensure read-only daemons don't start all when SCM_RIGHTS
support is unavailable.

Patch [10/10] was originally far more aggressive in that it
kept all signals blocked across execve, but that's probably
unrealistic for real-world scenarios

7/10 to add TTOU/TTIN support to xap_helper was actually
the first developed in this series.

Lots more brewing in the portability department...

Eric Wong (10):
  ds: don't block important signals we don't use
  t/sigfd: test EVFILT_SIGNAL vs signalfd differences
  t/sigfd: better checks related to SIGWINCH
  update devel/syscall-list to devel/sysdefs-list
  daemon: workaround pre-EVFILT_SIGNAL signals
  watch: ensure children can use signal handlers
  xap_helper: support SIGTTIN+SIGTTOU worker adjustments
  xap_helper.h: include signal.h for sig* functions
  tests: add `+SCM_RIGHTS' as a require_mods target
  test_common: start_script: set default signals

 MANIFEST                             |   2 +-
 devel/{syscall-list => sysdefs-list} |  47 ++---
 lib/PublicInbox/DS.pm                |  38 +++-
 lib/PublicInbox/IPC.pm               |   2 +-
 lib/PublicInbox/Sigfd.pm             |   3 +-
 lib/PublicInbox/Syscall.pm           |   7 +-
 lib/PublicInbox/TestCommon.pm        |  26 ++-
 lib/PublicInbox/Watch.pm             |   7 +-
 lib/PublicInbox/XapHelper.pm         | 103 +++++++---
 lib/PublicInbox/xap_helper.h         | 283 +++++++++++++++++++++++----
 script/public-inbox-watch            |   4 +-
 t/lei-import-nntp.t                  |   4 +-
 t/lei.t                              |   3 +-
 t/sigfd.t                            |  28 ++-
 t/xap_helper.t                       |  59 ++++--
 15 files changed, 489 insertions(+), 127 deletions(-)
 rename devel/{syscall-list => sysdefs-list} (60%)

^ permalink raw reply	[relevance 7%]

Results 1-2 of 2 | reverse | options above
-- pct% links below jump to the message on this page, permalinks otherwise --
2023-09-04 10:35  7% [PATCH 00/10] signal-handling and *BSD fixes Eric Wong
2023-09-04 10:36  7% ` [PATCH 09/10] tests: add `+SCM_RIGHTS' as a require_mods target 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).