lei/store: stop shard workers + cat-file on idle
[public-inbox.git] / t / epoll.t
blobab9ac22ac2661092604196f52b722e59d8e4eca5
1 #!perl -w
2 # Copyright (C) all contributors <meta@public-inbox.org>
3 # License: AGPL-3.0+ <https://www.gnu.org/licenses/agpl-3.0.txt>
4 use v5.12;
5 use Test::More;
6 use autodie;
7 use PublicInbox::Syscall qw(EPOLLOUT);
8 plan skip_all => 'not Linux' if $^O ne 'linux';
9 require_ok 'PublicInbox::Epoll';
10 my $ep = PublicInbox::Epoll->new;
11 pipe(my $r, my $w);
12 is($ep->ep_add($w, EPOLLOUT), 0, 'epoll_ctl pipe EPOLLOUT');
14 my @events;
15 $ep->ep_wait(10000, \@events);
16 is(scalar(@events), 1, 'got one event');
17 is($events[0], fileno($w), 'got expected FD');
18 close $w;
19 $ep->ep_wait(0, \@events);
20 is(scalar(@events), 0, 'epoll_wait timeout');
22 done_testing;