From 828d7a368acab6ca389a0d34791368c2e708f48b Mon Sep 17 00:00:00 2001 From: usa Date: Sun, 19 Jul 2009 00:48:40 +0000 Subject: * 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 --- test/socket/test_socket.rb | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) (limited to 'test/socket/test_socket.rb') diff --git a/test/socket/test_socket.rb b/test/socket/test_socket.rb index 17455a421d..ae29ae1ed5 100644 --- a/test/socket/test_socket.rb +++ b/test/socket/test_socket.rb @@ -261,10 +261,10 @@ class TestSocket < Test::Unit::TestCase end Socket.udp_server_sockets(0) {|sockets| - skip "need sendmsg and recvmsg" unless sockets[0].respond_to?(:sendmsg) famlies = {} sockets.each {|s| famlies[s.local_address.afamily] = true } ip_addrs.reject! {|ai| !famlies[ai.afamily] } + skipped = false begin port = sockets.first.local_address.ip_port @@ -289,13 +289,20 @@ class TestSocket < Test::Unit::TestCase assert_equal(ai.ip_address, addr.ip_address) } } + rescue NotImplementedError + skipped = true + skip "need sendmsg and recvmsg" ensure if th - Addrinfo.udp("127.0.0.1", port).connect {|s| s.sendmsg "exit" } - unless th.join(10) - Thread.kill th - th.join(10) - raise "thread killed" + if skipped + Thread.kill th unless th.join(10) + else + Addrinfo.udp("127.0.0.1", port).connect {|s| s.sendmsg "exit" } + unless th.join(10) + Thread.kill th + th.join(10) + raise "thread killed" + end end end end -- cgit v1.2.3