2013/4/1 hasari (Hiro Asari) asari.ruby@gmail.com:
Bug #8195: Time-dependent tests
https://bugs.ruby-lang.org/issues/8195
There are some tests that depend on timing of the execution, and fail sporadically.
I have not surveyed the entire suite, but one is pointed out in https://github.com/jruby/jruby/issues/618.
https://github.com/ruby/ruby/blob/v1_8_7_371/test/zlib/test_zlib.rb#L318
https://github.com/ruby/ruby/blob/v1_9_3_392/test/zlib/test_zlib.rb#L293
https://github.com/ruby/ruby/blob/v2_0_0_0/test/zlib/test_zlib.rb#L469
https://github.com/ruby/ruby/blob/6a23960/test/zlib/test_zlib.rb#L471
Perhaps defining a margin of error might be permissible.
Show us a actual log of the test failure.
Is it really with CRuby?
What is the logic for the test failure?
The test doesn't fail with following modification, which causes
two Time.now returns values different 10 years.
% svn diff test/zlib/test_zlib.rb
Index: test/zlib/test_zlib.rb¶
--- test/zlib/test_zlib.rb (revision 40019)
+++ test/zlib/test_zlib.rb (working copy)
@@ -455,7 +455,7 @@
end
-
tim = Time.utc(2000)
t = Tempfile.new("test_zlib_gzip_file_mtime")
t.close
@@ -464,7 +464,7 @@
gz.mtime = tim
gz.print("foo")
gz.flush
-
assert_raise(Zlib::GzipFile::Error) { gz.mtime = Time.now }
-
assert_raise(Zlib::GzipFile::Error) { gz.mtime = Time.utc(2010) }
end
Zlib::GzipReader.open(t.path) do |f|
% ./ruby test/runner.rb test/zlib/test_zlib.rb -n test_mtime
Run options: -n test_mtime
Running tests:¶
Finished tests in 0.030804s, 32.4634 tests/s, 64.9268 assertions/s.
1 tests, 2 assertions, 0 failures, 0 errors, 0 skips
% ./ruby -v
ruby 2.1.0dev (2013-03-31 trunk 40019) [x86_64-linux]¶
Tanaka Akira