From 9ddde2773f31f95311aa6128fc1809f5b5d06ecc Mon Sep 17 00:00:00 2001 From: akr Date: Sat, 14 Feb 2009 11:06:23 +0000 Subject: [PATCH] add timeout. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22302 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- test/socket/test_socket.rb | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/test/socket/test_socket.rb b/test/socket/test_socket.rb index 630618a7bc..b54c92dec2 100644 --- a/test/socket/test_socket.rb +++ b/test/socket/test_socket.rb @@ -251,6 +251,9 @@ class TestSocket < Test::Unit::TestCase Addrinfo.udp(ai.ip_address, port).connect {|s| msg1 = "<<<#{ai.inspect}>>>" s.sendmsg msg1 + unless IO.select([s], nil, nil, 10) + raise "no response" + end msg2, addr = s.recvmsg msg2, remote_address, local_address = Marshal.load(msg2) assert_equal(msg1, msg2) @@ -260,7 +263,11 @@ class TestSocket < Test::Unit::TestCase ensure if th Addrinfo.udp("127.0.0.1", port).connect {|s| s.sendmsg "exit" } - th.join + unless th.join(10) + Thread.kill th + th.join(10) + raise "thread killed" + end end end }