mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* test/ruby/test_thread.rb (TestThreadGroup#test_thread_timer_and_interrupt): suppress interrupt message.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34403 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
8dd4353968
commit
487cc8b5ce
1 changed files with 15 additions and 12 deletions
|
@ -689,20 +689,23 @@ class TestThreadGroup < Test::Unit::TestCase
|
|||
def test_thread_timer_and_interrupt
|
||||
bug5757 = '[ruby-dev:44985]'
|
||||
t0 = Time.now.to_f
|
||||
pid = spawn(EnvUtil.rubybin, '-e', 'r,=IO.pipe;r.read')
|
||||
sleep 1;
|
||||
Process.kill(:SIGINT, pid)
|
||||
Process.wait(pid)
|
||||
s = $?
|
||||
if /mswin|mingw/ =~ RUBY_PLATFORM
|
||||
# status of signal is not supported on Windows
|
||||
assert_equal(pid, s.pid)
|
||||
else
|
||||
assert_equal([false, true, false],
|
||||
[s.exited?, s.signaled?, s.stopped?],
|
||||
"[s.exited?, s.signaled?, s.stopped?]")
|
||||
pid = nil
|
||||
cmd = 'r,=IO.pipe; Thread.start {Thread.pass until Thread.main.stop?; puts; STDOUT.flush}; r.read'
|
||||
s, err = EnvUtil.invoke_ruby(['-e', cmd], "", true, true) do |in_p, out_p, err_p, cpid|
|
||||
out_p.gets
|
||||
pid = cpid
|
||||
Process.kill(:SIGINT, pid)
|
||||
Process.wait(pid)
|
||||
[$?, err_p.read]
|
||||
end
|
||||
t1 = Time.now.to_f
|
||||
assert_equal(pid, s.pid)
|
||||
unless /mswin|mingw/ =~ RUBY_PLATFORM
|
||||
# status of signal is not supported on Windows
|
||||
assert_equal([false, true, false, Signal.list["INT"]],
|
||||
[s.exited?, s.signaled?, s.stopped?, s.termsig],
|
||||
"[s.exited?, s.signaled?, s.stopped?, s.termsig]")
|
||||
end
|
||||
assert_in_delta(t1 - t0, 1, 1)
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue