Project

General

Profile

Actions

Bug #8195

closed

Time-dependent tests

Added by hasari (Hiro Asari) about 11 years ago. Updated about 11 years ago.

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

Description

Updated by akr (Akira Tanaka) about 11 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) :

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

Updated by hasari (Hiro Asari) about 11 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.

Updated by akr (Akira Tanaka) about 11 years ago

  • Status changed from Open to Rejected

No actual log.

Actions

Also available in: Atom PDF

Like0
Like0Like0Like0