Skip to content

Commit 3dfe3f9

Browse files
committed
Revert "Workaround: Fix test failures on Ubuntu jammy s390x."
This reverts commit 9f3b9c4 because we will fix the issue on alternative way.
1 parent 6267777 commit 3dfe3f9

File tree

1 file changed

+64
-84
lines changed

1 file changed

+64
-84
lines changed

test/zlib/test_zlib.rb

Lines changed: 64 additions & 84 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,6 @@
1212
end
1313

1414
if defined? Zlib
15-
child_env = {}
16-
child_env['DFLTCC'] = '0' if RUBY_PLATFORM =~ /s390x/
17-
Zlib::CHILD_ENV = child_env.freeze
18-
1915
class TestZlibDeflate < Test::Unit::TestCase
2016
def test_initialize
2117
z = Zlib::Deflate.new
@@ -48,63 +44,59 @@ def test_deflate
4844
end
4945

5046
def test_deflate_chunked
51-
assert_separately([Zlib::CHILD_ENV, '-rzlib'], <<~'end;')
52-
original = ''.dup
53-
chunks = []
54-
r = Random.new 0
55-
56-
z = Zlib::Deflate.new
57-
58-
2.times do
59-
input = r.bytes(20000)
60-
original << input
61-
z.deflate(input) do |chunk|
62-
chunks << chunk
63-
end
47+
original = ''.dup
48+
chunks = []
49+
r = Random.new 0
50+
51+
z = Zlib::Deflate.new
52+
53+
2.times do
54+
input = r.bytes(20000)
55+
original << input
56+
z.deflate(input) do |chunk|
57+
chunks << chunk
6458
end
59+
end
6560

66-
assert_equal [16384, 16384],
67-
chunks.map { |chunk| chunk.length }
61+
assert_equal [16384, 16384],
62+
chunks.map { |chunk| chunk.length }
6863

69-
final = z.finish
64+
final = z.finish
7065

71-
assert_equal 7253, final.length
66+
assert_equal 7253, final.length
7267

73-
chunks << final
74-
all = chunks.join
68+
chunks << final
69+
all = chunks.join
7570

76-
inflated = Zlib.inflate all
71+
inflated = Zlib.inflate all
7772

78-
assert_equal original, inflated
79-
end;
73+
assert_equal original, inflated
8074
end
8175

8276
def test_deflate_chunked_break
83-
assert_separately([Zlib::CHILD_ENV, '-rzlib'], <<~'end;')
84-
chunks = []
85-
r = Random.new 0
77+
chunks = []
78+
r = Random.new 0
8679

87-
z = Zlib::Deflate.new
80+
z = Zlib::Deflate.new
8881

89-
input = r.bytes(20000)
90-
z.deflate(input) do |chunk|
91-
chunks << chunk
92-
break
93-
end
82+
input = r.bytes(20000)
83+
z.deflate(input) do |chunk|
84+
chunks << chunk
85+
break
86+
end
9487

95-
assert_equal [16384], chunks.map { |chunk| chunk.length }
88+
assert_equal [16384], chunks.map { |chunk| chunk.length }
9689

97-
final = z.finish
90+
final = z.finish
9891

99-
assert_equal 3632, final.length
92+
assert_equal 3632, final.length
10093

101-
all = chunks.join
102-
all << final
94+
all = chunks.join
95+
all << final
10396

104-
original = Zlib.inflate all
97+
original = Zlib.inflate all
10598

106-
assert_equal input, original
107-
end;
99+
assert_equal input, original
108100
end
109101

110102
def test_addstr
@@ -960,32 +952,30 @@ def test_unused
960952
end
961953

962954
def test_unused2
963-
assert_separately([Zlib::CHILD_ENV, '-rzlib', '-rstringio'], <<~'end;')
964-
zio = StringIO.new
955+
zio = StringIO.new
965956

966-
io = Zlib::GzipWriter.new zio
967-
io.write 'aaaa'
968-
io.finish
957+
io = Zlib::GzipWriter.new zio
958+
io.write 'aaaa'
959+
io.finish
969960

970-
io = Zlib::GzipWriter.new zio
971-
io.write 'bbbb'
972-
io.finish
961+
io = Zlib::GzipWriter.new zio
962+
io.write 'bbbb'
963+
io.finish
973964

974-
zio.rewind
965+
zio.rewind
975966

976-
io = Zlib::GzipReader.new zio
977-
assert_equal('aaaa', io.read)
978-
unused = io.unused
979-
assert_equal(24, unused.bytesize)
980-
io.finish
967+
io = Zlib::GzipReader.new zio
968+
assert_equal('aaaa', io.read)
969+
unused = io.unused
970+
assert_equal(24, unused.bytesize)
971+
io.finish
981972

982-
zio.pos -= unused.length
973+
zio.pos -= unused.length
983974

984-
io = Zlib::GzipReader.new zio
985-
assert_equal('bbbb', io.read)
986-
assert_equal(nil, io.unused)
987-
io.finish
988-
end;
975+
io = Zlib::GzipReader.new zio
976+
assert_equal('bbbb', io.read)
977+
assert_equal(nil, io.unused)
978+
io.finish
989979
end
990980

991981
def test_read
@@ -1412,46 +1402,36 @@ def test_deflate
14121402
end
14131403

14141404
def test_deflate_stream
1415-
assert_separately([Zlib::CHILD_ENV, '-rzlib'], <<~'end;')
1416-
r = Random.new 0
1405+
r = Random.new 0
14171406

1418-
deflated = ''.dup
1407+
deflated = ''.dup
14191408

1420-
Zlib.deflate(r.bytes(20000)) do |chunk|
1421-
deflated << chunk
1422-
end
1409+
Zlib.deflate(r.bytes(20000)) do |chunk|
1410+
deflated << chunk
1411+
end
14231412

1424-
assert_equal 20016, deflated.length
1425-
end;
1413+
assert_equal 20016, deflated.length
14261414
end
14271415

14281416
def test_gzip
1429-
assert_separately([Zlib::CHILD_ENV, '-rzlib'], <<~'end;')
1430-
actual = Zlib.gzip("foo".freeze)
1431-
actual[4, 4] = "\x00\x00\x00\x00" # replace mtime
1432-
actual[9] = "\xff" # replace OS
1433-
expected = %w[1f8b08000000000000ff4bcbcf07002165738c03000000].pack("H*")
1434-
assert_equal expected, actual
1435-
end;
1436-
end
1417+
actual = Zlib.gzip("foo".freeze)
1418+
actual[4, 4] = "\x00\x00\x00\x00" # replace mtime
1419+
actual[9] = "\xff" # replace OS
1420+
expected = %w[1f8b08000000000000ff4bcbcf07002165738c03000000].pack("H*")
1421+
assert_equal expected, actual
14371422

1438-
def test_gzip_level_0
14391423
actual = Zlib.gzip("foo".freeze, level: 0)
14401424
actual[4, 4] = "\x00\x00\x00\x00" # replace mtime
14411425
actual[9] = "\xff" # replace OS
14421426
expected = %w[1f8b08000000000000ff010300fcff666f6f2165738c03000000].pack("H*")
14431427
assert_equal expected, actual
1444-
end
14451428

1446-
def test_gzip_level_9
14471429
actual = Zlib.gzip("foo".freeze, level: 9)
14481430
actual[4, 4] = "\x00\x00\x00\x00" # replace mtime
14491431
actual[9] = "\xff" # replace OS
14501432
expected = %w[1f8b08000000000002ff4bcbcf07002165738c03000000].pack("H*")
14511433
assert_equal expected, actual
1452-
end
14531434

1454-
def test_gzip_level_9_filtered
14551435
actual = Zlib.gzip("foo".freeze, level: 9, strategy: Zlib::FILTERED)
14561436
actual[4, 4] = "\x00\x00\x00\x00" # replace mtime
14571437
actual[9] = "\xff" # replace OS

0 commit comments

Comments
 (0)