about summary refs log tree commit homepage
path: root/test/unit/test_socket_helper.rb
diff options
context:
space:
mode:
Diffstat (limited to 'test/unit/test_socket_helper.rb')
-rw-r--r--test/unit/test_socket_helper.rb8
1 files changed, 8 insertions, 0 deletions
diff --git a/test/unit/test_socket_helper.rb b/test/unit/test_socket_helper.rb
index a38082c..abc177b 100644
--- a/test/unit/test_socket_helper.rb
+++ b/test/unit/test_socket_helper.rb
@@ -184,4 +184,12 @@ class TestSocketHelper < Test::Unit::TestCase
     assert_equal 1, cur
     rescue Errno::EAFNOSUPPORT
   end if RUBY_VERSION >= "1.9.2"
+
+  def test_reuseport
+    port = unused_port @test_addr
+    name = "#@test_addr:#{port}"
+    sock = bind_listen(name, :reuseport => true)
+    cur = sock.getsockopt(Socket::SOL_SOCKET, SO_REUSEPORT).unpack('i')[0]
+    assert_equal 1, cur
+  end if defined?(SO_REUSEPORT)
 end