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
This commit is contained in:
parent
c2a08ef876
commit
17f9ad40f6
@ -3651,10 +3651,15 @@ __END__
|
|||||||
ObjectSpace.count_objects(res) # creates strings on first call
|
ObjectSpace.count_objects(res) # creates strings on first call
|
||||||
[ 'foo'.b, '*' * 24 ].each do |buf|
|
[ 'foo'.b, '*' * 24 ].each do |buf|
|
||||||
with_pipe do |r, w|
|
with_pipe do |r, w|
|
||||||
|
GC.disable
|
||||||
|
begin
|
||||||
before = ObjectSpace.count_objects(res)[:T_STRING]
|
before = ObjectSpace.count_objects(res)[:T_STRING]
|
||||||
n = w.write(buf)
|
n = w.write(buf)
|
||||||
s = w.syswrite(buf)
|
s = w.syswrite(buf)
|
||||||
after = ObjectSpace.count_objects(res)[:T_STRING]
|
after = ObjectSpace.count_objects(res)[:T_STRING]
|
||||||
|
ensure
|
||||||
|
GC.enable
|
||||||
|
end
|
||||||
assert_equal before, after,
|
assert_equal before, after,
|
||||||
"no strings left over after write [ruby-core:78898] [Bug #13085]: #{ before } strings before write -> #{ after } strings after write"
|
"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'
|
assert_not_predicate buf, :frozen?, 'no inadvertent freeze'
|
||||||
|
Loading…
x
Reference in New Issue
Block a user