From beb1c085d582b4ac187309560eb871dda5bc3c28 Mon Sep 17 00:00:00 2001 From: nobu Date: Mon, 13 Jul 2015 10:07:01 +0000 Subject: use Timeout.timeout * time: Object#timeout has been deprecated a long time ago, use Timeout.timeout. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51225 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- test/testunit/test_parallel.rb | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) (limited to 'test/testunit/test_parallel.rb') diff --git a/test/testunit/test_parallel.rb b/test/testunit/test_parallel.rb index db3f47e2a5..f068b344df 100644 --- a/test/testunit/test_parallel.rb +++ b/test/testunit/test_parallel.rb @@ -22,7 +22,7 @@ module TestParallel @worker_in.puts "quit" rescue IOError, Errno::EPIPE end - timeout(2) do + Timeout.timeout(2) do Process.waitpid(@worker_pid) end rescue Timeout::Error @@ -38,7 +38,7 @@ module TestParallel end def test_run - timeout(10) do + Timeout.timeout(10) do assert_match(/^ready/,@worker_out.gets) @worker_in.puts "run #{TESTS}/ptest_first.rb test" assert_match(/^okay/,@worker_out.gets) @@ -49,7 +49,7 @@ module TestParallel end def test_run_multiple_testcase_in_one_file - timeout(10) do + Timeout.timeout(10) do assert_match(/^ready/,@worker_out.gets) @worker_in.puts "run #{TESTS}/ptest_second.rb test" assert_match(/^okay/,@worker_out.gets) @@ -62,7 +62,7 @@ module TestParallel end def test_accept_run_command_multiple_times - timeout(10) do + Timeout.timeout(10) do assert_match(/^ready/,@worker_out.gets) @worker_in.puts "run #{TESTS}/ptest_first.rb test" assert_match(/^okay/,@worker_out.gets) @@ -80,7 +80,7 @@ module TestParallel end def test_p - timeout(10) do + Timeout.timeout(10) do @worker_in.puts "run #{TESTS}/ptest_first.rb test" while buf = @worker_out.gets break if /^p (.+?)$/ =~ buf @@ -90,7 +90,7 @@ module TestParallel end def test_done - timeout(10) do + Timeout.timeout(10) do @worker_in.puts "run #{TESTS}/ptest_forth.rb test" 7.times { @worker_out.gets } buf = @worker_out.gets @@ -115,7 +115,7 @@ module TestParallel end def test_quit - timeout(10) do + Timeout.timeout(10) do @worker_in.puts "quit" assert_match(/^bye$/m,@worker_out.read) end @@ -134,7 +134,7 @@ module TestParallel def teardown begin if @test_pid - timeout(2) do + Timeout.timeout(2) do Process.waitpid(@test_pid) end end @@ -151,40 +151,40 @@ module TestParallel "--ruby", @options[:ruby].join(" "), "-j","0", out: File::NULL, err: o) o.close - timeout(10) { + Timeout.timeout(10) { assert_match(/Error: parameter of -j option should be greater than 0/,@test_out.read) } end def test_should_run_all_without_any_leaks spawn_runner - buf = timeout(10){@test_out.read} + buf = Timeout.timeout(10) {@test_out.read} assert_match(/^[SFE\.]{9}$/,buf) end def test_should_retry_failed_on_workers spawn_runner - buf = timeout(10){@test_out.read} + buf = Timeout.timeout(10) {@test_out.read} assert_match(/^Retrying\.+$/,buf) end def test_no_retry_option spawn_runner "--no-retry" - buf = timeout(10){@test_out.read} + buf = Timeout.timeout(10) {@test_out.read} refute_match(/^Retrying\.+$/,buf) assert_match(/^ +\d+\) Failure:\nTestD#test_fail_at_worker/,buf) end def test_jobs_status spawn_runner "--jobs-status" - buf = timeout(10){@test_out.read} + buf = Timeout.timeout(10) {@test_out.read} assert_match(/\d+=ptest_(first|second|third|forth) */,buf) end def test_separate # this test depends to --jobs-status spawn_runner "--jobs-status", "--separate" - buf = timeout(10){@test_out.read} + buf = Timeout.timeout(10) {@test_out.read} assert(buf.scan(/(\d+?)[:=]/).flatten.uniq.size > 1) end end -- cgit v1.2.3