]> Sergey Matveev's repositories - public-inbox.git/commitdiff
dskqxs: fix missing EV_DISPATCH define
authorEric Wong <e@80x24.org>
Wed, 27 Nov 2019 01:33:32 +0000 (01:33 +0000)
committerEric Wong <e@80x24.org>
Wed, 27 Nov 2019 10:25:41 +0000 (10:25 +0000)
Oops, IO::KQueue support was broken due to this missing
constant.  Add a new ds-kqxs.t test case to ensure we
test the IO::KQueue path if IO::KQueue is available.

MANIFEST
lib/PublicInbox/DSKQXS.pm
t/ds-kqxs.t [new file with mode: 0644]
t/ds-poll.t

index 9fd639f592c9104a9b82473b33e9ad9c7ae59dfe..a50c12468e9216ccbf7b62668faf805391b384c2 100644 (file)
--- a/MANIFEST
+++ b/MANIFEST
@@ -207,6 +207,7 @@ t/config_limiter.t
 t/content_id.t
 t/convert-compact.t
 t/data/0001.patch
+t/ds-kqxs.t
 t/ds-leak.t
 t/ds-poll.t
 t/edit.t
index 1c3b970b7a332d3fd681fd885157005c70fea504..84e146f8ed67bd5f4e62dc88e395dac1329d6afd 100644 (file)
@@ -21,6 +21,8 @@ use PublicInbox::Syscall qw(EPOLLONESHOT EPOLLIN EPOLLOUT EPOLLET
 our @EXPORT_OK = qw(epoll_ctl epoll_wait);
 my $owner_pid = -1; # kqueue is close-on-fork (yes, fork, not exec)
 
+sub EV_DISPATCH () { 0x0080 }
+
 # map EPOLL* bits to kqueue EV_* flags for EV_SET
 sub kq_flag ($$) {
        my ($bit, $ev) = @_;
diff --git a/t/ds-kqxs.t b/t/ds-kqxs.t
new file mode 100644 (file)
index 0000000..785570c
--- /dev/null
@@ -0,0 +1,14 @@
+# Copyright (C) 2019 all contributors <meta@public-inbox.org>
+# Licensed the same as Danga::Socket (and Perl5)
+# License: GPL-1.0+ or Artistic-1.0-Perl
+#  <https://www.gnu.org/licenses/gpl-1.0.txt>
+#  <https://dev.perl.org/licenses/artistic.html>
+use strict;
+use Test::More;
+unless (eval { require IO::KQueue }) {
+       my $m = $^O !~ /bsd/ ? 'DSKQXS is only for *BSD systems'
+                               : "no IO::KQueue, skipping $0: $@";
+       plan skip_all => $m;
+}
+local $ENV{TEST_IOPOLLER} = 'PublicInbox::DSKQXS';
+require './t/ds-poll.t';
index c9dcdd22cf86607f5905cc2981785b15d14deef7..21f8b295b37520d10c71773061ecab4ef20483cc 100644 (file)
@@ -7,7 +7,7 @@ use strict;
 use warnings;
 use Test::More;
 use PublicInbox::Syscall qw(:epoll);
-my $cls = 'PublicInbox::DSPoll';
+my $cls = $ENV{TEST_IOPOLLER} // 'PublicInbox::DSPoll';
 use_ok $cls;
 my $p = $cls->new;
 
@@ -43,16 +43,8 @@ my @fds = sort(map { $_->[0] } @$events);
 my @exp = sort((fileno($r), fileno($x)));
 is_deeply(\@fds, \@exp, 'got both ready FDs');
 
-# EPOLL_CTL_DEL doesn't matter for kqueue, we do it in native epoll
-# to avoid a kernel-wide lock; but its not needed for native kqueue
-# paths so DSKQXS makes it a noop (as did Danga::Socket::close).
-SKIP: {
-       if ($cls ne 'PublicInbox::DSPoll') {
-               skip "$cls doesn't handle EPOLL_CTL_DEL", 2;
-       }
-       is($p->epoll_ctl(EPOLL_CTL_DEL, fileno($r), 0), 0, 'EPOLL_CTL_DEL OK');
-       $n = $p->epoll_wait(9, 0, $events);
-       is($n, 0, 'nothing ready after EPOLL_CTL_DEL');
-};
+is($p->epoll_ctl(EPOLL_CTL_DEL, fileno($r), 0), 0, 'EPOLL_CTL_DEL OK');
+$n = $p->epoll_wait(9, 0, $events);
+is($n, 0, 'nothing ready after EPOLL_CTL_DEL');
 
 done_testing;