diff options
| -rw-r--r-- | ChangeLog | 5 | ||||
| -rw-r--r-- | test/ruby/test_thread.rb | 18 | ||||
| -rw-r--r-- | test/test_timeout.rb | 12 | ||||
| -rw-r--r-- | version.h | 2 |
4 files changed, 27 insertions, 10 deletions
@@ -1,3 +1,8 @@ +Mon Jul 7 13:05:04 2014 SHIBATA Hiroshi <shibata.hiroshi@gmail.com> + + * test/test_timeout.rb (test_timeout): inverted test condition. + [Bug #8523] + Mon Jul 7 12:57:26 2014 Masaya Tarui <tarui@ruby-lang.org> * st.c (st_foreach_check): change start point of search at check diff --git a/test/ruby/test_thread.rb b/test/ruby/test_thread.rb index 1e730a1452..a05123f81d 100644 --- a/test/ruby/test_thread.rb +++ b/test/ruby/test_thread.rb @@ -363,6 +363,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 t = Thread.new { $SAFE = 3; sleep } sleep 0.5 diff --git a/test/test_timeout.rb b/test/test_timeout.rb index 57eca3e478..2a10404bf0 100644 --- a/test/test_timeout.rb +++ b/test/test_timeout.rb @@ -11,17 +11,11 @@ class TestTimeout < Test::Unit::TestCase 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 @@ -1,6 +1,6 @@ #define RUBY_VERSION "2.0.0" #define RUBY_RELEASE_DATE "2014-07-07" -#define RUBY_PATCHLEVEL 530 +#define RUBY_PATCHLEVEL 531 #define RUBY_RELEASE_YEAR 2014 #define RUBY_RELEASE_MONTH 7 |
