ruby-changes:29586
From: akr <ko1@a...>
Date: Wed, 26 Jun 2013 12:10:06 +0900 (JST)
Subject: [ruby-changes:29586] akr:r41638 (trunk): * test/socket/test_udp.rb: Close sockets explicitly.
akr 2013-06-26 12:09:54 +0900 (Wed, 26 Jun 2013) New Revision: 41638 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=41638 Log: * test/socket/test_udp.rb: Close sockets explicitly. Don't use fixed port number. Modified files: trunk/ChangeLog trunk/test/socket/test_udp.rb Index: ChangeLog =================================================================== --- ChangeLog (revision 41637) +++ ChangeLog (revision 41638) @@ -1,3 +1,8 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1 +Wed Jun 26 12:08:51 2013 Tanaka Akira <akr@f...> + + * test/socket/test_udp.rb: Close sockets explicitly. + Don't use fixed port number. + Wed Jun 26 07:27:17 2013 Tanaka Akira <akr@f...> * bignum.c (bigand_int): Fix a buffer over read. Index: test/socket/test_udp.rb =================================================================== --- test/socket/test_udp.rb (revision 41637) +++ test/socket/test_udp.rb (revision 41638) @@ -35,14 +35,16 @@ class TestSocket_UDPSocket < Test::Unit: https://github.com/ruby/ruby/blob/trunk/test/socket/test_udp.rb#L35 assert_raise(IOError, "[ruby-dev:25057]") { s.bind(host, 2000) } + ensure + s.close if s && !s.closed? end def test_bind_addrinuse host = "127.0.0.1" - port = 2001 in_use = UDPSocket.new - in_use.bind(host, port) + in_use.bind(host, 0) + port = in_use.addr[1] s = UDPSocket.new @@ -51,6 +53,9 @@ class TestSocket_UDPSocket < Test::Unit: https://github.com/ruby/ruby/blob/trunk/test/socket/test_udp.rb#L53 end assert_match "bind(2) for \"#{host}\" port #{port}", e.message + ensure + in_use.close if in_use + s.close if s end def test_send_too_long @@ -61,5 +66,7 @@ class TestSocket_UDPSocket < Test::Unit: https://github.com/ruby/ruby/blob/trunk/test/socket/test_udp.rb#L66 end assert_match 'for "127.0.0.1" port 7', e.message + ensure + u.close if u end end if defined?(UDPSocket) -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/