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

merge revision(s) r44516,r46159,r46196: [Backport #8523]

test_timeout.rb: shorten waiting times
	* test/test_timeout.rb (test_timeout): inverted test condition.
	  [Bug #8523]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_1@46810 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nagachika 2014-07-13 14:35:17 +00:00
parent 9bc1b8e9a0
commit 30c0ad5563
4 changed files with 30 additions and 13 deletions

View file

@ -1,3 +1,8 @@
Sun Jul 13 23:28:41 2014 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
* test/test_timeout.rb (test_timeout): inverted test condition.
[Bug #8523]
Sun Jul 13 23:18:11 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
* ext/digest/digest.c (rb_digest_instance_equal): no need to call

View file

@ -358,6 +358,24 @@ class TestThread < Test::Unit::TestCase
c.kill if c
end
def test_switch_while_busy_loop
bug1402 = "[ruby-dev:38319] [Bug #1402]"
flag = true
th = Thread.current
waiter = Thread.start {
sleep 0.1
flag = false
sleep 1
th.raise(bug1402)
}
assert_nothing_raised(RuntimeError, bug1402) do
nil while flag
end
assert(!flag, bug1402)
ensure
waiter.kill.join
end
def test_safe_level
ok = false
t = Thread.new do

View file

@ -6,22 +6,16 @@ class TestTimeout < Test::Unit::TestCase
def test_queue
q = Queue.new
assert_raise(Timeout::Error, "[ruby-dev:32935]") {
timeout(0.1) { q.pop }
timeout(0.01) { q.pop }
}
end
def test_timeout
@flag = true
Thread.start {
sleep 0.1
@flag = false
}
assert_nothing_raised("[ruby-dev:38319]") do
Timeout.timeout(1) {
nil while @flag
assert_raise(Timeout::Error) do
Timeout.timeout(0.1) {
nil while true
}
end
assert !@flag, "[ruby-dev:38319]"
end
def test_cannot_convert_into_time_interval
@ -34,7 +28,7 @@ class TestTimeout < Test::Unit::TestCase
bug8730 = '[Bug #8730]'
e = nil
assert_raise_with_message(Timeout::Error, /execution expired/, bug8730) do
timeout 0.1 do
timeout 0.01 do
begin
sleep 3
rescue Exception => e
@ -48,7 +42,7 @@ class TestTimeout < Test::Unit::TestCase
exc = Class.new(RuntimeError)
e = nil
assert_nothing_raised(exc) do
timeout 0.1, exc do
timeout 0.01, exc do
begin
sleep 3
rescue exc => e

View file

@ -1,6 +1,6 @@
#define RUBY_VERSION "2.1.2"
#define RUBY_RELEASE_DATE "2014-07-13"
#define RUBY_PATCHLEVEL 174
#define RUBY_PATCHLEVEL 175
#define RUBY_RELEASE_YEAR 2014
#define RUBY_RELEASE_MONTH 7