[前][次][番号順一覧][スレッド一覧]

ruby-changes:34727

From: nagachika <ko1@a...>
Date: Sun, 13 Jul 2014 23:35:25 +0900 (JST)
Subject: [ruby-changes:34727] nagachika:r46810 (ruby_2_1): merge revision(s) r44516, r46159, r46196: [Backport #8523]

nagachika	2014-07-13 23:35:17 +0900 (Sun, 13 Jul 2014)

  New Revision: 46810

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=46810

  Log:
    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]

  Modified directories:
    branches/ruby_2_1/
  Modified files:
    branches/ruby_2_1/ChangeLog
    branches/ruby_2_1/test/ruby/test_thread.rb
    branches/ruby_2_1/test/test_timeout.rb
    branches/ruby_2_1/version.h
Index: ruby_2_1/ChangeLog
===================================================================
--- ruby_2_1/ChangeLog	(revision 46809)
+++ ruby_2_1/ChangeLog	(revision 46810)
@@ -1,3 +1,8 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_1/ChangeLog#L1
+Sun Jul 13 23:28:41 2014  SHIBATA Hiroshi  <shibata.hiroshi@g...>
+
+	* test/test_timeout.rb (test_timeout): inverted test condition.
+	  [Bug #8523]
+
 Sun Jul 13 23:18:11 2014  Nobuyoshi Nakada  <nobu@r...>
 
 	* ext/digest/digest.c (rb_digest_instance_equal): no need to call
Index: ruby_2_1/version.h
===================================================================
--- ruby_2_1/version.h	(revision 46809)
+++ ruby_2_1/version.h	(revision 46810)
@@ -1,6 +1,6 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_1/version.h#L1
 #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
Index: ruby_2_1/test/ruby/test_thread.rb
===================================================================
--- ruby_2_1/test/ruby/test_thread.rb	(revision 46809)
+++ ruby_2_1/test/ruby/test_thread.rb	(revision 46810)
@@ -358,6 +358,24 @@ class TestThread < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/ruby_2_1/test/ruby/test_thread.rb#L358
     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
Index: ruby_2_1/test/test_timeout.rb
===================================================================
--- ruby_2_1/test/test_timeout.rb	(revision 46809)
+++ ruby_2_1/test/test_timeout.rb	(revision 46810)
@@ -6,22 +6,16 @@ class TestTimeout < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/ruby_2_1/test/test_timeout.rb#L6
   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 https://github.com/ruby/ruby/blob/trunk/ruby_2_1/test/test_timeout.rb#L28
     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 https://github.com/ruby/ruby/blob/trunk/ruby_2_1/test/test_timeout.rb#L42
     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

Property changes on: ruby_2_1
___________________________________________________________________
Modified: svn:mergeinfo
   Merged /trunk:r44516,46159,46196


--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]