[ruby/zlib] Revert "Workaround: Fix test failures on Ubuntu jammy s390x."
This reverts commit https://github.com/ruby/zlib/commit/9f3b9c470c05 because we will fix the issue on alternative way. https://github.com/ruby/zlib/commit/3dfe3f9110
This commit is contained in:
parent
49d3bbe13b
commit
7278747d08
@ -12,10 +12,6 @@ rescue LoadError
|
|||||||
end
|
end
|
||||||
|
|
||||||
if defined? Zlib
|
if defined? Zlib
|
||||||
child_env = {}
|
|
||||||
child_env['DFLTCC'] = '0' if RUBY_PLATFORM =~ /s390x/
|
|
||||||
Zlib::CHILD_ENV = child_env.freeze
|
|
||||||
|
|
||||||
class TestZlibDeflate < Test::Unit::TestCase
|
class TestZlibDeflate < Test::Unit::TestCase
|
||||||
def test_initialize
|
def test_initialize
|
||||||
z = Zlib::Deflate.new
|
z = Zlib::Deflate.new
|
||||||
@ -48,63 +44,59 @@ if defined? Zlib
|
|||||||
end
|
end
|
||||||
|
|
||||||
def test_deflate_chunked
|
def test_deflate_chunked
|
||||||
assert_separately([Zlib::CHILD_ENV, '-rzlib'], <<~'end;')
|
original = ''.dup
|
||||||
original = ''.dup
|
chunks = []
|
||||||
chunks = []
|
r = Random.new 0
|
||||||
r = Random.new 0
|
|
||||||
|
|
||||||
z = Zlib::Deflate.new
|
z = Zlib::Deflate.new
|
||||||
|
|
||||||
2.times do
|
2.times do
|
||||||
input = r.bytes(20000)
|
input = r.bytes(20000)
|
||||||
original << input
|
original << input
|
||||||
z.deflate(input) do |chunk|
|
z.deflate(input) do |chunk|
|
||||||
chunks << chunk
|
chunks << chunk
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
assert_equal [16384, 16384],
|
assert_equal [16384, 16384],
|
||||||
chunks.map { |chunk| chunk.length }
|
chunks.map { |chunk| chunk.length }
|
||||||
|
|
||||||
final = z.finish
|
final = z.finish
|
||||||
|
|
||||||
assert_equal 7253, final.length
|
assert_equal 7253, final.length
|
||||||
|
|
||||||
chunks << final
|
chunks << final
|
||||||
all = chunks.join
|
all = chunks.join
|
||||||
|
|
||||||
inflated = Zlib.inflate all
|
inflated = Zlib.inflate all
|
||||||
|
|
||||||
assert_equal original, inflated
|
assert_equal original, inflated
|
||||||
end;
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_deflate_chunked_break
|
def test_deflate_chunked_break
|
||||||
assert_separately([Zlib::CHILD_ENV, '-rzlib'], <<~'end;')
|
chunks = []
|
||||||
chunks = []
|
r = Random.new 0
|
||||||
r = Random.new 0
|
|
||||||
|
|
||||||
z = Zlib::Deflate.new
|
z = Zlib::Deflate.new
|
||||||
|
|
||||||
input = r.bytes(20000)
|
input = r.bytes(20000)
|
||||||
z.deflate(input) do |chunk|
|
z.deflate(input) do |chunk|
|
||||||
chunks << chunk
|
chunks << chunk
|
||||||
break
|
break
|
||||||
end
|
end
|
||||||
|
|
||||||
assert_equal [16384], chunks.map { |chunk| chunk.length }
|
assert_equal [16384], chunks.map { |chunk| chunk.length }
|
||||||
|
|
||||||
final = z.finish
|
final = z.finish
|
||||||
|
|
||||||
assert_equal 3632, final.length
|
assert_equal 3632, final.length
|
||||||
|
|
||||||
all = chunks.join
|
all = chunks.join
|
||||||
all << final
|
all << final
|
||||||
|
|
||||||
original = Zlib.inflate all
|
original = Zlib.inflate all
|
||||||
|
|
||||||
assert_equal input, original
|
assert_equal input, original
|
||||||
end;
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_addstr
|
def test_addstr
|
||||||
@ -960,32 +952,30 @@ if defined? Zlib
|
|||||||
end
|
end
|
||||||
|
|
||||||
def test_unused2
|
def test_unused2
|
||||||
assert_separately([Zlib::CHILD_ENV, '-rzlib', '-rstringio'], <<~'end;')
|
zio = StringIO.new
|
||||||
zio = StringIO.new
|
|
||||||
|
|
||||||
io = Zlib::GzipWriter.new zio
|
io = Zlib::GzipWriter.new zio
|
||||||
io.write 'aaaa'
|
io.write 'aaaa'
|
||||||
io.finish
|
io.finish
|
||||||
|
|
||||||
io = Zlib::GzipWriter.new zio
|
io = Zlib::GzipWriter.new zio
|
||||||
io.write 'bbbb'
|
io.write 'bbbb'
|
||||||
io.finish
|
io.finish
|
||||||
|
|
||||||
zio.rewind
|
zio.rewind
|
||||||
|
|
||||||
io = Zlib::GzipReader.new zio
|
io = Zlib::GzipReader.new zio
|
||||||
assert_equal('aaaa', io.read)
|
assert_equal('aaaa', io.read)
|
||||||
unused = io.unused
|
unused = io.unused
|
||||||
assert_equal(24, unused.bytesize)
|
assert_equal(24, unused.bytesize)
|
||||||
io.finish
|
io.finish
|
||||||
|
|
||||||
zio.pos -= unused.length
|
zio.pos -= unused.length
|
||||||
|
|
||||||
io = Zlib::GzipReader.new zio
|
io = Zlib::GzipReader.new zio
|
||||||
assert_equal('bbbb', io.read)
|
assert_equal('bbbb', io.read)
|
||||||
assert_equal(nil, io.unused)
|
assert_equal(nil, io.unused)
|
||||||
io.finish
|
io.finish
|
||||||
end;
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_read
|
def test_read
|
||||||
@ -1412,46 +1402,36 @@ if defined? Zlib
|
|||||||
end
|
end
|
||||||
|
|
||||||
def test_deflate_stream
|
def test_deflate_stream
|
||||||
assert_separately([Zlib::CHILD_ENV, '-rzlib'], <<~'end;')
|
r = Random.new 0
|
||||||
r = Random.new 0
|
|
||||||
|
|
||||||
deflated = ''.dup
|
deflated = ''.dup
|
||||||
|
|
||||||
Zlib.deflate(r.bytes(20000)) do |chunk|
|
Zlib.deflate(r.bytes(20000)) do |chunk|
|
||||||
deflated << chunk
|
deflated << chunk
|
||||||
end
|
end
|
||||||
|
|
||||||
assert_equal 20016, deflated.length
|
assert_equal 20016, deflated.length
|
||||||
end;
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_gzip
|
def test_gzip
|
||||||
assert_separately([Zlib::CHILD_ENV, '-rzlib'], <<~'end;')
|
actual = Zlib.gzip("foo".freeze)
|
||||||
actual = Zlib.gzip("foo".freeze)
|
actual[4, 4] = "\x00\x00\x00\x00" # replace mtime
|
||||||
actual[4, 4] = "\x00\x00\x00\x00" # replace mtime
|
actual[9] = "\xff" # replace OS
|
||||||
actual[9] = "\xff" # replace OS
|
expected = %w[1f8b08000000000000ff4bcbcf07002165738c03000000].pack("H*")
|
||||||
expected = %w[1f8b08000000000000ff4bcbcf07002165738c03000000].pack("H*")
|
assert_equal expected, actual
|
||||||
assert_equal expected, actual
|
|
||||||
end;
|
|
||||||
end
|
|
||||||
|
|
||||||
def test_gzip_level_0
|
|
||||||
actual = Zlib.gzip("foo".freeze, level: 0)
|
actual = Zlib.gzip("foo".freeze, level: 0)
|
||||||
actual[4, 4] = "\x00\x00\x00\x00" # replace mtime
|
actual[4, 4] = "\x00\x00\x00\x00" # replace mtime
|
||||||
actual[9] = "\xff" # replace OS
|
actual[9] = "\xff" # replace OS
|
||||||
expected = %w[1f8b08000000000000ff010300fcff666f6f2165738c03000000].pack("H*")
|
expected = %w[1f8b08000000000000ff010300fcff666f6f2165738c03000000].pack("H*")
|
||||||
assert_equal expected, actual
|
assert_equal expected, actual
|
||||||
end
|
|
||||||
|
|
||||||
def test_gzip_level_9
|
|
||||||
actual = Zlib.gzip("foo".freeze, level: 9)
|
actual = Zlib.gzip("foo".freeze, level: 9)
|
||||||
actual[4, 4] = "\x00\x00\x00\x00" # replace mtime
|
actual[4, 4] = "\x00\x00\x00\x00" # replace mtime
|
||||||
actual[9] = "\xff" # replace OS
|
actual[9] = "\xff" # replace OS
|
||||||
expected = %w[1f8b08000000000002ff4bcbcf07002165738c03000000].pack("H*")
|
expected = %w[1f8b08000000000002ff4bcbcf07002165738c03000000].pack("H*")
|
||||||
assert_equal expected, actual
|
assert_equal expected, actual
|
||||||
end
|
|
||||||
|
|
||||||
def test_gzip_level_9_filtered
|
|
||||||
actual = Zlib.gzip("foo".freeze, level: 9, strategy: Zlib::FILTERED)
|
actual = Zlib.gzip("foo".freeze, level: 9, strategy: Zlib::FILTERED)
|
||||||
actual[4, 4] = "\x00\x00\x00\x00" # replace mtime
|
actual[4, 4] = "\x00\x00\x00\x00" # replace mtime
|
||||||
actual[9] = "\xff" # replace OS
|
actual[9] = "\xff" # replace OS
|
||||||
|
Loading…
x
Reference in New Issue
Block a user