Issue #5335 has been updated by Motohiro KOSAKI. Assignee changed from Motohiro KOSAKI to Eric Wong > diff --git a/test/-ext-/old_thread_select/test_old_thread_select.rb b/test/-ext-/old_thread_select/test_old_thread_select.rb > index 1ccdb34..a8a0ce2 100644 > --- a/test/-ext-/old_thread_select/test_old_thread_select.rb > +++ b/test/-ext-/old_thread_select/test_old_thread_select.rb > @@ -16,10 +16,10 @@ class TestOldThreadSelect < Test::Unit::TestCase > def test_old_select_read_timeout > with_pipe do |r, w| > t0 = Time.now > - rc = IO.old_thread_select([r.fileno], nil, nil, 0.001) > + rc = IO.old_thread_select([r.fileno], nil, nil, 0.01) > diff = Time.now - t0 > assert_equal 0, rc > - assert diff >= 0.001, "returned too early" > + assert_operator diff, :>=, 0.004, "returned too early: diff=#{diff}" No, I really dislike this. both 0.01 and 0.004 make no sense and no good reason we choose them. I guess 0.004 mean 250Hz. But in fact, only several linux systems use 250Hz. No platform independent meanings. Instead, I just recommend to skip this test if platform is too old linux. (I guess our chkbuild caught the same issue, http://www.rubyist.net/~akr/chkbuild/debian/ruby-trunk/log/20110919T060500Z.log.html.gz) In addition, the correct way is, to detect inaccurate select timeout by configure script and do_select() retry to call select(2) automatically _if_ we really need to care. ---------------------------------------- Bug #5335: [RFC/PATCH] test_old_thread_select: timing tweaks http://redmine.ruby-lang.org/issues/5335 Author: Eric Wong Status: Open Priority: Normal Assignee: Eric Wong Category: core Target version: 1.9.3 ruby -v: ruby 1.9.3dev (2011-09-17 revision 33290) [x86_64-linux] I was getting timing errors and short select() timeouts on CentOS 5.6 2.6.18-238.9.1.el5xen most likely due to CONFIG_HZ=250 and the lack of dynticks, but maybe being a Xen VM has this effect, too. select() itself appears to just be inaccurate on this system: strace -e select -T ./ruby -e 'select([STDIN],nil,nil,0.001)' select(1, [0], NULL, NULL, {0, 1000}) = 0 (Timeout) <0.000046> I'm not happy with timing tests, but I can't think of another way to test functionality like this. -- http://redmine.ruby-lang.org