Bug #8195

Time-dependent tests

Added by Hiro Asari almost 2 years ago. Updated almost 2 years ago.

[ruby-core:53861]
Status:Rejected
Priority:Normal
Assignee:-
ruby -v:ruby 2.1.0dev (2013-03-31 trunk 40019) [x86_64-linux] Backport:

Description

History

#1 Updated by Akira Tanaka almost 2 years ago

  • ruby -v changed from ruby 2.1.0dev (2013-03-28 trunk 39971) [x86_64-darwin12.3.0] to ruby 2.1.0dev (2013-03-31 trunk 40019) [x86_64-linux]

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

  def test_mtime
  • tim = Time.now
  •  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

#2 Updated by Hiro Asari almost 2 years ago

On a second thought, this seems to be a poorly chosen "example". You can close this ticket. If I come across a better example, I'll open a new one.

Sorry for the noise.

#3 Updated by Akira Tanaka almost 2 years ago

  • Status changed from Open to Rejected

No actual log.

Also available in: Atom PDF