aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-11-07 14:23:58 +0000
committerko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-11-07 14:23:58 +0000
commitcff63404619e061d4b2b79135f7d187351c6b9da (patch)
treefc7850caec4203835d7ca754ee5a89130eea6f55
parent25dc32bc87339358553449640bf99a443f1908ac (diff)
downloadruby-cff63404619e061d4b2b79135f7d187351c6b9da.tar.gz
disable GC.
* test/ruby/test_io.rb (test_write_no_garbage): malloc can cause GC and it will reduce string object counts. So disable GC during this test. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60699 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--test/ruby/test_io.rb13
1 files changed, 9 insertions, 4 deletions
diff --git a/test/ruby/test_io.rb b/test/ruby/test_io.rb
index 3ffc7281df..a0a574e69d 100644
--- a/test/ruby/test_io.rb
+++ b/test/ruby/test_io.rb
@@ -3651,10 +3651,15 @@ __END__
ObjectSpace.count_objects(res) # creates strings on first call
[ 'foo'.b, '*' * 24 ].each do |buf|
with_pipe do |r, w|
- before = ObjectSpace.count_objects(res)[:T_STRING]
- n = w.write(buf)
- s = w.syswrite(buf)
- after = ObjectSpace.count_objects(res)[:T_STRING]
+ GC.disable
+ begin
+ before = ObjectSpace.count_objects(res)[:T_STRING]
+ n = w.write(buf)
+ s = w.syswrite(buf)
+ after = ObjectSpace.count_objects(res)[:T_STRING]
+ ensure
+ GC.enable
+ end
assert_equal before, after,
"no strings left over after write [ruby-core:78898] [Bug #13085]: #{ before } strings before write -> #{ after } strings after write"
assert_not_predicate buf, :frozen?, 'no inadvertent freeze'