diff --git a/ChangeLog b/ChangeLog index e91e817524..440de8f432 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +Sun Jul 13 23:28:41 2014 SHIBATA Hiroshi + + * test/test_timeout.rb (test_timeout): inverted test condition. + [Bug #8523] + Sun Jul 13 23:18:11 2014 Nobuyoshi Nakada * ext/digest/digest.c (rb_digest_instance_equal): no need to call diff --git a/test/ruby/test_thread.rb b/test/ruby/test_thread.rb index 110bbdd6de..6568b8dfbc 100644 --- a/test/ruby/test_thread.rb +++ b/test/ruby/test_thread.rb @@ -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 diff --git a/test/test_timeout.rb b/test/test_timeout.rb index e849cc5741..e71a09f22c 100644 --- a/test/test_timeout.rb +++ b/test/test_timeout.rb @@ -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 diff --git a/version.h b/version.h index f480c17b2f..9786a426a7 100644 --- a/version.h +++ b/version.h @@ -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