1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
| | require_relative 'helper'
require 'fcntl'
require 'socket'
require 'thread'
class TestEpollIO < Test::Unit::TestCase
include SleepyPenguin
def setup
@rd, @wr = IO.pipe
@epio = Epoll::IO.new(nil)
end
def test_add_wait
@epio.epoll_ctl(Epoll::CTL_ADD, @wr, Epoll::OUT)
ev = []
@epio.epoll_wait { |events, obj| ev << [ events, obj ] }
assert_equal([[Epoll::OUT, @wr]], ev)
end
class EpSub < Epoll::IO
def self.new
super(:CLOEXEC)
end
end
def test_subclass
tmp = EpSub.new
assert_equal Fcntl::FD_CLOEXEC, tmp.fcntl(Fcntl::F_GETFD)
assert_nil tmp.close
end
end if defined?(SleepyPenguin::Epoll)
|