summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-01-31 05:29:52 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-01-31 05:29:52 +0000
commit487cc8b5cebfcdfe218058ff9de31d2231e1d5cb (patch)
tree201c9270ad5bdd914dcc02fa47f64d0d20bc4480 /test
parent8dd4353968d672ccd1aa189e1781d7472dd6bcff (diff)
* 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
Diffstat (limited to 'test')
-rw-r--r--test/ruby/test_thread.rb27
1 files changed, 15 insertions, 12 deletions
diff --git a/test/ruby/test_thread.rb b/test/ruby/test_thread.rb
index 6f7d1280bd..f7b33c30ec 100644
--- a/test/ruby/test_thread.rb
+++ b/test/ruby/test_thread.rb
@@ -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