Skip to content

Commit 02a29dc

Browse files
committed
Load the same loaded zlib
Zlib is used by also rubygems, the built extension cannot be loaded after the default gem is loaded.
1 parent e59da75 commit 02a29dc

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

test/zlib/test_zlib.rb

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@
99
begin
1010
require 'zlib'
1111
rescue LoadError
12+
else
13+
z = "/zlib.#{RbConfig::CONFIG["DLEXT"]}"
14+
LOADED_ZLIB, = $".select {|f| f.end_with?(z)}
1215
end
1316

1417
if defined? Zlib
@@ -1525,7 +1528,7 @@ def test_gunzip_encoding
15251528
end
15261529

15271530
def test_gunzip_no_memory_leak
1528-
assert_no_memory_leak(%[-rzlib], "#{<<~"{#"}", "#{<<~'};'}")
1531+
assert_no_memory_leak(%W[-r#{LOADED_ZLIB}], "#{<<~"{#"}", "#{<<~'};'}")
15291532
d = Zlib.gzip("data")
15301533
{#
15311534
10_000.times {Zlib.gunzip(d)}

0 commit comments

Comments
 (0)