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

* test/thread/test_queue.rb (test_thr_kill): show the number of loop

run when the test failed.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34107 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
akr 2011-12-23 01:15:35 +00:00
parent 8beb0d3587
commit e89bebdab4
2 changed files with 28 additions and 12 deletions

View file

@ -1,3 +1,8 @@
Fri Dec 23 10:14:47 2011 Tanaka Akira <akr@fsij.org>
* test/thread/test_queue.rb (test_thr_kill): show the number of loop
run when the test failed.
Fri Dec 23 09:23:48 2011 Tanaka Akira <akr@fsij.org> Fri Dec 23 09:23:48 2011 Tanaka Akira <akr@fsij.org>
* test/test_pty.rb (test_pty_check_default): call PTY.check until * test/test_pty.rb (test_pty_check_default): call PTY.check until

View file

@ -1,5 +1,6 @@
require 'test/unit' require 'test/unit'
require 'thread' require 'thread'
require 'tmpdir'
require_relative '../ruby/envutil' require_relative '../ruby/envutil'
class TestQueue < Test::Unit::TestCase class TestQueue < Test::Unit::TestCase
@ -57,9 +58,14 @@ class TestQueue < Test::Unit::TestCase
def test_thr_kill def test_thr_kill
bug5343 = '[ruby-core:39634]' bug5343 = '[ruby-core:39634]'
assert_normal_exit(<<-'_eom', bug5343, {:timeout => 20}) Dir.mktmpdir {|d|
timeout = 20
total_loop = 2000
begin
assert_normal_exit(<<-"_eom", bug5343, {:timeout => timeout, :chdir=>d})
require "thread" require "thread"
2000.times do #{total_loop}.times do |i|
open("test_thr_kill_count", "w") {|f| f.puts i }
queue = Queue.new queue = Queue.new
r, w = IO.pipe r, w = IO.pipe
th = Thread.start { th = Thread.start {
@ -70,5 +76,10 @@ class TestQueue < Test::Unit::TestCase
th.kill.join th.kill.join
end end
_eom _eom
rescue Timeout::Error
count = File.read("#{d}/test_thr_kill_count").to_i
flunk "only #{count} times looped in #{timeout} seconds. (should run #{total_loop} times)"
end
}
end end
end end