ruby-changes:34198
From: akr <ko1@a...>
Date: Mon, 2 Jun 2014 09:01:46 +0900 (JST)
Subject: [ruby-changes:34198] akr:r46281 (trunk): Join threads.
akr 2014-05-31 23:05:54 +0900 (Sat, 31 May 2014) New Revision: 46281 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?revision=46281&view=revision Log: Join threads. Modified files: trunk/test/open-uri/test_open-uri.rb trunk/test/open-uri/test_ssl.rb Index: test/open-uri/test_open-uri.rb =================================================================== --- test/open-uri/test_open-uri.rb (revision 46280) +++ test/open-uri/test_open-uri.rb (revision 46281) @@ -24,13 +24,11 @@ class TestOpenURI < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/open-uri/test_open-uri.rb#L24 :Port => 0}) _, port, _, host = srv.listeners[0].addr begin - srv.start + th = srv.start yield srv, dr, "http://#{host}:#{port}" ensure srv.shutdown - until srv.status == :Stop - sleep 0.1 - end + th.join end } end @@ -225,7 +223,7 @@ class TestOpenURI < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/open-uri/test_open-uri.rb#L223 _, proxy_port, _, proxy_host = proxy.listeners[0].addr proxy_url = "http://#{proxy_host}:#{proxy_port}/" begin - proxy.start + proxy_thread = proxy.start srv.mount_proc("/proxy", lambda { |req, res| res.body = "proxy" } ) open("#{url}/proxy", :proxy=>proxy_url) {|f| assert_equal("200", f.status[0]) @@ -256,6 +254,7 @@ class TestOpenURI < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/open-uri/test_open-uri.rb#L254 assert_equal("", log); log.clear ensure proxy.shutdown + proxy_thread.join end } end @@ -278,7 +277,7 @@ class TestOpenURI < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/open-uri/test_open-uri.rb#L277 _, proxy_port, _, proxy_host = proxy.listeners[0].addr proxy_url = "http://#{proxy_host}:#{proxy_port}/" begin - proxy.start + th = proxy.start srv.mount_proc("/proxy", lambda { |req, res| res.body = "proxy" } ) exc = assert_raise(OpenURI::HTTPError) { open("#{url}/proxy", :proxy=>proxy_url) {} } assert_equal("407", exc.io.status[0]) @@ -296,6 +295,7 @@ class TestOpenURI < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/open-uri/test_open-uri.rb#L295 assert_equal("", log); log.clear ensure proxy.shutdown + th.join end } end Index: test/open-uri/test_ssl.rb =================================================================== --- test/open-uri/test_ssl.rb (revision 46280) +++ test/open-uri/test_ssl.rb (revision 46281) @@ -31,13 +31,11 @@ class TestOpenURISSL https://github.com/ruby/ruby/blob/trunk/test/open-uri/test_ssl.rb#L31 :Port => 0}) _, port, _, host = srv.listeners[0].addr begin - srv.start + th = srv.start yield srv, dr, "https://#{host}:#{port}" ensure srv.shutdown - until srv.status == :Stop - sleep 0.1 - end + th.join end } end @@ -85,7 +83,7 @@ class TestOpenURISSL https://github.com/ruby/ruby/blob/trunk/test/open-uri/test_ssl.rb#L83 :Port => 0}) _, p_port, _, p_host = prxy.listeners[0].addr begin - prxy.start + th = prxy.start srv.mount_proc("/proxy", lambda { |req, res| res.body = "proxy" } ) open("#{url}/proxy", :proxy=>"http://#{p_host}:#{p_port}/", :ssl_ca_cert => cacert_filename) {|f| assert_equal("200", f.status[0]) @@ -101,9 +99,7 @@ class TestOpenURISSL https://github.com/ruby/ruby/blob/trunk/test/open-uri/test_ssl.rb#L99 sio.truncate(0); sio.rewind ensure prxy.shutdown - until prxy.status == :Stop - sleep 0.1 - end + th.join end } end -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/