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

Projects

None yet

2 participants

@ghost
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.

@BanzaiMan BanzaiMan was assigned Mar 31, 2013
Owner

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

Owner

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

@ghost
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 Jan 10, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment