Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bodgy time sensitive test at test/externals/ruby1.8/zlib/test_zlib.rb:317 #618

Closed
ghost opened this issue Mar 31, 2013 · 3 comments
Closed
Assignees
Labels
Milestone

Comments

@ghost
Copy link

ghost commented Mar 31, 2013

@BanzaiMan wants some more stuff to fix to keep up his commit streak, so here is one ;-)

The following test from test/externals/ruby1.8/zlib/test_zlib.rb:317 sporadically fails:

    def test_mtime
      tim = Time.now

      t = Tempfile.new("test_zlib_gzip_file")
      t.close
      Zlib::GzipWriter.open(t.path) do |gz|
        gz.mtime = -1
        gz.mtime = tim
        gz.print("foo")
        gz.flush
        assert_raise(Zlib::GzipFile::Error) { gz.mtime = Time.now }
      end

      f = Zlib::GzipReader.open(t.path)
      assert_equal(tim.to_i, f.mtime.to_i)
    end

If the writing of the file crosses the seconds boundary, (i.e. writing does not complete within the same second as the Time.now call) then it will fail.

@ghost ghost assigned BanzaiMan Mar 31, 2013
@BanzaiMan
Copy link
Member

This puts a new twist to the phrase "time-sensitive tests."

@BanzaiMan
Copy link
Member

This should fail for MRI, too, depending on the timing.

@ghost
Copy link
Author

ghost commented Apr 1, 2013

Yep, it would fail on MRI - it is a crap test.

@kares kares added this to the Won't Fix milestone Jan 10, 2016
@kares kares closed this as completed Jan 10, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants