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

ruby-changes:21407

From: kosaki <ko1@a...>
Date: Tue, 11 Oct 2011 11:36:31 +0900 (JST)
Subject: [ruby-changes:21407] kosaki:r33456 (ruby_1_9_3): merge revision(s) 33296:

kosaki	2011-10-11 11:33:33 +0900 (Tue, 11 Oct 2011)

  New Revision: 33456

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

  Log:
    merge revision(s) 33296:
    
    * test/-ext-/old_thread_select/test_old_thread_select.rb:
      select() with timeout may return early in old Linux kernels
      with 250 Hz tickrate and no dynticks, so skip everything older
      than 2.6.32 (which has long term support).
      And, Make the timing assertions consistently use assert_operator with
      timing difference in error message
      Patch by Eric Wong. [Bug #5335] [ruby-core:39618]

  Modified files:
    branches/ruby_1_9_3/ChangeLog
    branches/ruby_1_9_3/test/-ext-/old_thread_select/test_old_thread_select.rb

Index: ruby_1_9_3/ChangeLog
===================================================================
--- ruby_1_9_3/ChangeLog	(revision 33455)
+++ ruby_1_9_3/ChangeLog	(revision 33456)
@@ -1,3 +1,13 @@
+Mon Oct 10 22:33:12 2011  KOSAKI Motohiro  <kosaki.motohiro@g...>
+
+	* test/-ext-/old_thread_select/test_old_thread_select.rb:
+	  select() with timeout may return early in old Linux kernels
+	  with 250 Hz tickrate and no dynticks, so skip everything older
+	  than 2.6.32 (which has long term support).
+	  And, Make the timing assertions consistently use assert_operator with
+	  timing difference in error message
+	  Patch by Eric Wong. [Bug #5335] [ruby-core:39618]
+
 Tue Oct  4 16:17:50 2011  NARUSE, Yui  <naruse@r...>
 
 	* lib/time.rb (Time.strptime): use Time.at if d[:seconds] is set.
Index: ruby_1_9_3/test/-ext-/old_thread_select/test_old_thread_select.rb
===================================================================
--- ruby_1_9_3/test/-ext-/old_thread_select/test_old_thread_select.rb	(revision 33455)
+++ ruby_1_9_3/test/-ext-/old_thread_select/test_old_thread_select.rb	(revision 33456)
@@ -3,6 +3,8 @@
 class TestOldThreadSelect < Test::Unit::TestCase
   require '-test-/old_thread_select/old_thread_select'
 
+  ANCIENT_LINUX = RUBY_PLATFORM =~ /linux/ && `uname -r`.chomp < '2.6.32'
+
   def with_pipe
     r, w = IO.pipe
     begin
@@ -19,9 +21,9 @@
       rc = IO.old_thread_select([r.fileno], nil, nil, 0.001)
       diff = Time.now - t0
       assert_equal 0, rc
-      assert_operator diff, :>=, 0.001, "returned too early"
+      assert_operator diff, :>=, 0.001, "returned too early: diff=#{diff}"
     end
-  end
+  end unless ANCIENT_LINUX
 
   def test_old_select_error_timeout
     bug5299 = '[ruby-core:39380]'
@@ -30,9 +32,9 @@
       rc = IO.old_thread_select(nil, nil, [r.fileno], 0.001)
       diff = Time.now - t0
       assert_equal 0, rc, bug5299
-      assert_operator diff, :>=, 0.001, "returned too early"
+      assert_operator diff, :>=, 0.001, "returned too early: diff=#{diff}"
     end
-  end
+  end unless ANCIENT_LINUX
 
   def test_old_select_false_positive
     bug5306 = '[ruby-core:39435]'
@@ -76,15 +78,18 @@
     end
 
     rc = nil
-    t0 = Time.now
+    diff = nil
     with_pipe do |r,w|
       assert_nothing_raised do
+        t0 = Time.now
         rc = IO.old_thread_select([r.fileno], nil, nil, 1)
+        diff = Time.now - t0
       end
     end
 
-    diff = Time.now - t0
-    assert_operator diff, :>=, 1.0, "interrupted or short wait"
+    unless ANCIENT_LINUX
+      assert_operator diff, :>=, 1, "interrupted or short wait: diff=#{diff}"
+    end
     assert_equal 0, rc
     assert_equal true, thr.value
     assert_not_equal false, received, "SIGINT not received"

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

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