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

add timeout.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22302 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
akr 2009-02-14 11:06:23 +00:00
parent 23843e8b3c
commit 9ddde2773f

View file

@ -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
}