summaryrefslogtreecommitdiff
path: root/test/socket
diff options
context:
space:
mode:
authorakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-02-14 11:06:23 +0000
committerakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-02-14 11:06:23 +0000
commit9ddde2773f31f95311aa6128fc1809f5b5d06ecc (patch)
tree5b3df7dc09f5a9d9b8264a86ef12afa2ca62ee3e /test/socket
parent23843e8b3cb8598bec5cc2a0148b8cfc5018e026 (diff)
add timeout.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22302 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/socket')
-rw-r--r--test/socket/test_socket.rb9
1 files changed, 8 insertions, 1 deletions
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
}