mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
Sat Mar 5 09:17:54 2016 Rei Odaira <Rei.Odaira@gmail.com>
* test/rinda/test_rinda.rb (test_make_socket_ipv4_multicast): The fifth argument to getsockopt(2) should be modified to indicate the actual size of the value on return, but not in AIX. This is a know bug. Skip related tests. * test/rinda/test_rinda.rb (test_ring_server_ipv4_multicast): ditto. * test/rinda/test_rinda.rb (test_make_socket_unicast): ditto. * test/socket/test_basicsocket.rb (test_getsockopt): ditto. * test/socket/test_sockopt.rb (test_bool): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54004 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
adde0a94a2
commit
1874524d42
4 changed files with 70 additions and 24 deletions
12
ChangeLog
12
ChangeLog
|
@ -1,3 +1,15 @@
|
|||
Sat Mar 5 09:17:54 2016 Rei Odaira <Rei.Odaira@gmail.com>
|
||||
|
||||
* test/rinda/test_rinda.rb (test_make_socket_ipv4_multicast):
|
||||
The fifth argument to getsockopt(2) should be modified to
|
||||
indicate the actual size of the value on return,
|
||||
but not in AIX. This is a know bug. Skip related tests.
|
||||
* test/rinda/test_rinda.rb (test_ring_server_ipv4_multicast):
|
||||
ditto.
|
||||
* test/rinda/test_rinda.rb (test_make_socket_unicast): ditto.
|
||||
* test/socket/test_basicsocket.rb (test_getsockopt): ditto.
|
||||
* test/socket/test_sockopt.rb (test_bool): ditto.
|
||||
|
||||
Sat Mar 5 07:36:27 2016 Rei Odaira <Rei.Odaira@gmail.com>
|
||||
|
||||
* test/-ext-/float/test_nextafter.rb: In AIX,
|
||||
|
|
|
@ -625,10 +625,17 @@ class TestRingServer < Test::Unit::TestCase
|
|||
def test_make_socket_ipv4_multicast
|
||||
v4mc = @rs.make_socket('239.0.0.1')
|
||||
|
||||
if Socket.const_defined?(:SO_REUSEPORT) then
|
||||
assert(v4mc.getsockopt(:SOCKET, :SO_REUSEPORT).bool)
|
||||
else
|
||||
assert(v4mc.getsockopt(:SOCKET, :SO_REUSEADDR).bool)
|
||||
begin
|
||||
if Socket.const_defined?(:SO_REUSEPORT) then
|
||||
assert(v4mc.getsockopt(:SOCKET, :SO_REUSEPORT).bool)
|
||||
else
|
||||
assert(v4mc.getsockopt(:SOCKET, :SO_REUSEADDR).bool)
|
||||
end
|
||||
rescue TypeError
|
||||
if /aix/ =~ RUBY_PLATFORM
|
||||
skip "Known bug in getsockopt(2) on AIX"
|
||||
end
|
||||
raise $!
|
||||
end
|
||||
|
||||
assert_equal('0.0.0.0', v4mc.local_address.ip_address)
|
||||
|
@ -660,10 +667,17 @@ class TestRingServer < Test::Unit::TestCase
|
|||
@rs = Rinda::RingServer.new(@ts, [['239.0.0.1', '0.0.0.0']], @port)
|
||||
v4mc = @rs.instance_variable_get('@sockets').first
|
||||
|
||||
if Socket.const_defined?(:SO_REUSEPORT) then
|
||||
assert(v4mc.getsockopt(:SOCKET, :SO_REUSEPORT).bool)
|
||||
else
|
||||
assert(v4mc.getsockopt(:SOCKET, :SO_REUSEADDR).bool)
|
||||
begin
|
||||
if Socket.const_defined?(:SO_REUSEPORT) then
|
||||
assert(v4mc.getsockopt(:SOCKET, :SO_REUSEPORT).bool)
|
||||
else
|
||||
assert(v4mc.getsockopt(:SOCKET, :SO_REUSEADDR).bool)
|
||||
end
|
||||
rescue TypeError
|
||||
if /aix/ =~ RUBY_PLATFORM
|
||||
skip "Known bug in getsockopt(2) on AIX"
|
||||
end
|
||||
raise $!
|
||||
end
|
||||
|
||||
assert_equal('0.0.0.0', v4mc.local_address.ip_address)
|
||||
|
@ -755,6 +769,11 @@ class TestRingFinger < Test::Unit::TestCase
|
|||
v4 = @rf.make_socket('127.0.0.1')
|
||||
|
||||
assert(v4.getsockopt(:SOL_SOCKET, :SO_BROADCAST).bool)
|
||||
rescue TypeError
|
||||
if /aix/ =~ RUBY_PLATFORM
|
||||
skip "Known bug in getsockopt(2) on AIX"
|
||||
end
|
||||
raise $!
|
||||
ensure
|
||||
v4.close if v4
|
||||
end
|
||||
|
|
|
@ -16,20 +16,28 @@ class TestSocket_BasicSocket < Test::Unit::TestCase
|
|||
|
||||
def test_getsockopt
|
||||
inet_stream do |s|
|
||||
n = s.getsockopt(Socket::SOL_SOCKET, Socket::SO_TYPE)
|
||||
assert_equal([Socket::SOCK_STREAM].pack("i"), n.data)
|
||||
begin
|
||||
n = s.getsockopt(Socket::SOL_SOCKET, Socket::SO_TYPE)
|
||||
assert_equal([Socket::SOCK_STREAM].pack("i"), n.data)
|
||||
|
||||
n = s.getsockopt("SOL_SOCKET", "SO_TYPE")
|
||||
assert_equal([Socket::SOCK_STREAM].pack("i"), n.data)
|
||||
n = s.getsockopt("SOL_SOCKET", "SO_TYPE")
|
||||
assert_equal([Socket::SOCK_STREAM].pack("i"), n.data)
|
||||
|
||||
n = s.getsockopt(:SOL_SOCKET, :SO_TYPE)
|
||||
assert_equal([Socket::SOCK_STREAM].pack("i"), n.data)
|
||||
n = s.getsockopt(:SOL_SOCKET, :SO_TYPE)
|
||||
assert_equal([Socket::SOCK_STREAM].pack("i"), n.data)
|
||||
|
||||
n = s.getsockopt(:SOCKET, :TYPE)
|
||||
assert_equal([Socket::SOCK_STREAM].pack("i"), n.data)
|
||||
n = s.getsockopt(:SOCKET, :TYPE)
|
||||
assert_equal([Socket::SOCK_STREAM].pack("i"), n.data)
|
||||
|
||||
n = s.getsockopt(Socket::SOL_SOCKET, Socket::SO_ERROR)
|
||||
assert_equal([0].pack("i"), n.data)
|
||||
n = s.getsockopt(Socket::SOL_SOCKET, Socket::SO_ERROR)
|
||||
assert_equal([0].pack("i"), n.data)
|
||||
rescue Minitest::Assertion
|
||||
s.close
|
||||
if /aix/ =~ RUBY_PLATFORM
|
||||
skip "Known bug in getsockopt(2) on AIX"
|
||||
end
|
||||
raise $!
|
||||
end
|
||||
|
||||
val = Object.new
|
||||
class << val; self end.send(:define_method, :to_int) {
|
||||
|
|
|
@ -25,12 +25,19 @@ class TestSocketOption < Test::Unit::TestCase
|
|||
assert_equal(true, opt.bool)
|
||||
opt = Socket::Option.int(:INET, :SOCKET, :KEEPALIVE, 2)
|
||||
assert_equal(true, opt.bool)
|
||||
Socket.open(:INET, :STREAM) {|s|
|
||||
s.setsockopt(Socket::Option.bool(:INET, :SOCKET, :KEEPALIVE, true))
|
||||
assert_equal(true, s.getsockopt(Socket::SOL_SOCKET, Socket::SO_KEEPALIVE).bool)
|
||||
s.setsockopt(Socket::Option.bool(:INET, :SOCKET, :KEEPALIVE, false))
|
||||
assert_equal(false, s.getsockopt(Socket::SOL_SOCKET, Socket::SO_KEEPALIVE).bool)
|
||||
}
|
||||
begin
|
||||
Socket.open(:INET, :STREAM) {|s|
|
||||
s.setsockopt(Socket::Option.bool(:INET, :SOCKET, :KEEPALIVE, true))
|
||||
assert_equal(true, s.getsockopt(Socket::SOL_SOCKET, Socket::SO_KEEPALIVE).bool)
|
||||
s.setsockopt(Socket::Option.bool(:INET, :SOCKET, :KEEPALIVE, false))
|
||||
assert_equal(false, s.getsockopt(Socket::SOL_SOCKET, Socket::SO_KEEPALIVE).bool)
|
||||
}
|
||||
rescue TypeError
|
||||
if /aix/ =~ RUBY_PLATFORM
|
||||
skip "Known bug in getsockopt(2) on AIX"
|
||||
end
|
||||
raise $!
|
||||
end
|
||||
end
|
||||
|
||||
def test_ipv4_multicast_loop
|
||||
|
|
Loading…
Reference in a new issue