From 021b5f36df21750d953b2553512c509d06e79bee Mon Sep 17 00:00:00 2001 From: Peter Zhu Date: Fri, 27 Nov 2026 14:40:07 +0900 Subject: [PATCH] Fix test_gets_separator_modified_by_io for MMTk The test test_gets_separator_modified_by_io will intermittently fail on MMTk with: TestZlibGzipReader#test_gets_separator_modified_by_io [test/zlib/test_zlib.rb:1274]: Exception(RuntimeError) with message matches to "rs modified". RuntimeError expected but nothing was raised. --- test/zlib/test_zlib.rb | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/test/zlib/test_zlib.rb b/test/zlib/test_zlib.rb index d7c7c04..988a271 100644 --- a/test/zlib/test_zlib.rb +++ b/test/zlib/test_zlib.rb @@ -1282,10 +1282,9 @@ def test_read0 end def test_gets_separator_modified_by_io - # grown from an empty string so that the content lives in a separate - # buffer even with a GC that embeds 1000 bytes in the object (mmtk) - rs = "".dup - rs << "-" * 1000 + # a shared substring stays outside the object even with a GC that embeds + # strings of any length (MMTk) and moves them to larger slots + rs = ("-" * 1000).freeze[0, 1000] src = StringIO.new(Zlib.gzip(Random.new(0).bytes(200_000).tr("-", "x") + rs)) n = 0 io = Object.new