1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* test_socket.rb (test_udp_server): cannot check the existance of sendmsg by

respond_to?.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24199 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
usa 2009-07-19 00:48:40 +00:00
parent 1e18f3a857
commit 828d7a368a

View file

@ -261,10 +261,10 @@ class TestSocket < Test::Unit::TestCase
end end
Socket.udp_server_sockets(0) {|sockets| Socket.udp_server_sockets(0) {|sockets|
skip "need sendmsg and recvmsg" unless sockets[0].respond_to?(:sendmsg)
famlies = {} famlies = {}
sockets.each {|s| famlies[s.local_address.afamily] = true } sockets.each {|s| famlies[s.local_address.afamily] = true }
ip_addrs.reject! {|ai| !famlies[ai.afamily] } ip_addrs.reject! {|ai| !famlies[ai.afamily] }
skipped = false
begin begin
port = sockets.first.local_address.ip_port port = sockets.first.local_address.ip_port
@ -289,13 +289,20 @@ class TestSocket < Test::Unit::TestCase
assert_equal(ai.ip_address, addr.ip_address) assert_equal(ai.ip_address, addr.ip_address)
} }
} }
rescue NotImplementedError
skipped = true
skip "need sendmsg and recvmsg"
ensure ensure
if th if th
Addrinfo.udp("127.0.0.1", port).connect {|s| s.sendmsg "exit" } if skipped
unless th.join(10) Thread.kill th unless th.join(10)
Thread.kill th else
th.join(10) Addrinfo.udp("127.0.0.1", port).connect {|s| s.sendmsg "exit" }
raise "thread killed" unless th.join(10)
Thread.kill th
th.join(10)
raise "thread killed"
end
end end
end end
end end