about summary refs log tree commit homepage
path: root/test/unit/test_util.rb
diff options
context:
space:
mode:
Diffstat (limited to 'test/unit/test_util.rb')
-rw-r--r--test/unit/test_util.rb25
1 files changed, 25 insertions, 0 deletions
diff --git a/test/unit/test_util.rb b/test/unit/test_util.rb
index dc6302e..9d5d4ef 100644
--- a/test/unit/test_util.rb
+++ b/test/unit/test_util.rb
@@ -102,4 +102,29 @@ class TestUtil < Test::Unit::TestCase
     }
     tmp.close!
   end
+
+  def test_pipe
+    r, w = Unicorn.pipe
+    assert r
+    assert w
+
+    return if RUBY_PLATFORM !~ /linux/
+
+    begin
+      f_getpipe_sz = 1032
+      IO.pipe do |a, b|
+        a_sz = a.fcntl(f_getpipe_sz)
+        b_sz = b.fcntl(f_getpipe_sz)
+        assert_kind_of Integer, a_sz
+        r_sz = r.fcntl(f_getpipe_sz)
+        assert_equal Raindrops::PAGE_SIZE, r_sz
+        assert_operator a_sz, :>=, r_sz
+      end
+    rescue Errno::EINVAL
+      # Linux <= 2.6.34
+    end
+  ensure
+    w.close
+    r.close
+  end
 end