From 019543aa3a1074582a460b944ad5ebcddecd4394 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Sun, 6 Oct 2013 11:02:38 +0000 Subject: buffer: remove ioctl syscall in common paths We do not need this for single sink situations (the common case) at all. We also do not need to check IO#nread for splice, either; we can just do non-blocking I/O. The only common path where we might still need it is the non-splice case with multiple sinks. --- test/test_buffer.rb | 20 -------------------- 1 file changed, 20 deletions(-) (limited to 'test/test_buffer.rb') diff --git a/test/test_buffer.rb b/test/test_buffer.rb index d74cdce..13f4352 100644 --- a/test/test_buffer.rb +++ b/test/test_buffer.rb @@ -51,13 +51,9 @@ class TestBuffer < Testcase def test_broadcast_1 buf = new_buffer r, w = IO.pipe - assert_equal :wait_readable, buf.broadcast([w]) - assert_equal 0, buf.bytes_xfer buf.wr.write "HIHI" assert_equal :wait_readable, buf.broadcast([w]) assert_equal 4, buf.bytes_xfer - assert_equal :wait_readable, buf.broadcast([w]) - assert_equal 4, buf.bytes_xfer tmp = [w] r.close buf.wr.write "HIHI" @@ -90,20 +86,6 @@ class TestBuffer < Testcase a[1].nonblock = false b[0].read(b[0].nread) b[1].write(max) - t = Thread.new do - sleep 0.005 - [ a[0].read(max.size).size, b[0].read(max.size).size ] - end - assert_equal 5, buf.__broadcast_tee(blocked, [a[1], b[1]], 5) - assert_equal [a[1]], blocked - assert_equal [ max.size, max.size ], t.value - b[0].close - tmp = [a[1], b[1]] - - newerr = tmperr { assert_equal 5, buf.__broadcast_tee(blocked, tmp, 5) } - assert_equal [a[1]], blocked - assert_match(%r{dropping}, newerr.string) - assert_equal [a[1]], tmp end def test_broadcast @@ -115,8 +97,6 @@ class TestBuffer < Testcase assert_equal 5, buf.bytes_xfer assert_equal "HELLO", a[0].read(5) assert_equal "HELLO", b[0].read(5) - assert_equal :wait_readable, buf.broadcast([a[1], b[1]]) - assert_equal 5, buf.bytes_xfer return unless b[1].respond_to?(:pipe_size) -- cgit v1.2.3-24-ge0c7