Sha256: 0b47538c3f74b1821735d21c858fff1d2edce1682c8d0d0deef51be0e2fabf71
Contents?: true
Size: 968 Bytes
Versions: 3
Compression:
Stored size: 968 Bytes
Contents
require_relative 'helper' class TestEpollGC < Test::Unit::TestCase include SleepyPenguin def setup GC.stress = true if GC.respond_to?(:stress=) @ep = Epoll.new end def teardown GC.stress = false if GC.respond_to?(:stress=) end def add_pipe_no_tailcall(m, depth) add_pipe(m, depth += 1) end def add_pipe(m, depth = 0) if depth > 6000 _, wr = IO.pipe warn "wr: #{wr.fileno}" @ep.__send__(m, wr, Epoll::OUT) else add_pipe_no_tailcall(m, depth + 1) end end def test_gc_safety done = false begin if done x = nil @ep.wait(nil, 10) { |flags, obj| p [ flags, x = obj ] } assert x, "#{x.inspect}" break else add_pipe(:add) 2048.times { IO.pipe; File.open(__FILE__)} done = true end rescue Errno::EMFILE, Errno::ENFILE Thread.new { GC.start }.join end while true end end if ENV["GC_STRESS"].to_i != 0
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
sleepy_penguin-3.5.2 | test/test_epoll_gc.rb |
sleepy_penguin-3.5.1 | test/test_epoll_gc.rb |
sleepy_penguin-3.5.0 | test/test_epoll_gc.rb |