user/dev discussion of public-inbox itself
 help / color / Atom feed
From: Eric Wong <e@yhbt.net>
To: meta@public-inbox.org
Subject: [PATCHv2 2/2] t/httpd-unix: skip some tests w/o signalfd|EVFILT_SIGNAL
Date: Fri, 17 Apr 2020 05:22:54 +0000
Message-ID: <20200417052254.GA52830@dcvr> (raw)
In-Reply-To: <20200416014838.5939-3-e@yhbt.net>

After more testing on a FreeBSD 11.2 VM, I'm dropping
https://public-inbox.org/meta/20200416014838.5939-3-e@yhbt.net/
https://public-inbox.org/meta/20200416014838.5939-3-e@yhbt.net/
in favor of the following patch:

-------8<-------
Subject: [PATCHv2 2/2] t/httpd-unix: skip some tests w/o signalfd|EVFILT_SIGNAL

Some of these tests just don't seem reliable enough with the
way Perl does portable signal handling.
---
 t/httpd-unix.t | 16 ++++++++++++----
 1 file changed, 12 insertions(+), 4 deletions(-)

diff --git a/t/httpd-unix.t b/t/httpd-unix.t
index 7ebc3464..363f3648 100644
--- a/t/httpd-unix.t
+++ b/t/httpd-unix.t
@@ -81,17 +81,23 @@ check_sock($unix);
 	ok(-S $unix, 'unix socket still exists');
 }
 
+# portable Perl can delay or miss signal dispatches due to races,
+# so disable some tests on systems lacking signalfd(2) or EVFILT_SIGNAL
+my $has_sigfd = PublicInbox::Sigfd->new({}, 0) ? 1 : $ENV{TEST_UNRELIABLE};
+
 sub delay_until {
 	my $cond = shift;
-	for (1..1000) {
+	my $end = time + 30;
+	do {
 		return if $cond->();
 		select undef, undef, undef, 0.012;
-	}
-	Carp::croak('condition failed');
+	} until (time > $end);
+	Carp::confess('condition failed');
 }
 
 SKIP: {
-	require_mods('Net::Server::Daemonize', 20);
+	require_mods('Net::Server::Daemonize', 52);
+	$has_sigfd or skip('signalfd / EVFILT_SIGNAL not available', 52);
 	my $pid_file = "$tmpdir/pid";
 	my $read_pid = sub {
 		my $f = shift;
@@ -137,9 +143,11 @@ SKIP: {
 	});
 	my $new_pid = $read_pid->($pid_file);
 	isnt($new_pid, $pid, 'new child started');
+	ok($new_pid > 0, '$new_pid valid');
 	delay_until(sub { -s "$pid_file.oldbin" });
 	my $old_pid = $read_pid->("$pid_file.oldbin");
 	is($old_pid, $pid, '.oldbin pid file written');
+	ok($old_pid > 0, '$old_pid valid');
 
 	check_sock($unix); # ensures $new_pid is ready to receive signals
 

      reply index

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-16  1:48 [PATCH 0/2] more test fixes Eric Wong
2020-04-16  1:48 ` [PATCH 1/2] t/httpd-corner: improve reliability and diagnostics Eric Wong
2020-04-16  1:48 ` [PATCH 2/2] t/httpd-unix: reliability for non-signalfd/EVFILT_SIGNAL Eric Wong
2020-04-17  5:22   ` Eric Wong [this message]

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: http://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=20200417052254.GA52830@dcvr \
    --to=e@yhbt.net \
    --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

user/dev discussion of public-inbox itself

Archives are clonable:
	git clone --mirror http://public-inbox.org/meta
	git clone --mirror http://czquwvybam4bgbro.onion/meta
	git clone --mirror http://hjrcffqmbrq6wope.onion/meta
	git clone --mirror http://ou63pmih66umazou.onion/meta

Example config snippet for mirrors

Newsgroups are available over NNTP:
	nntp://news.public-inbox.org/inbox.comp.mail.public-inbox.meta
	nntp://ou63pmih66umazou.onion/inbox.comp.mail.public-inbox.meta
	nntp://czquwvybam4bgbro.onion/inbox.comp.mail.public-inbox.meta
	nntp://hjrcffqmbrq6wope.onion/inbox.comp.mail.public-inbox.meta
	nntp://news.gmane.io/gmane.mail.public-inbox.general

 note: .onion URLs require Tor: https://www.torproject.org/

AGPL code for this site: git clone https://public-inbox.org/public-inbox.git