mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
Add debug prints to inspect TC_JSONGenerate#test_gc's timeout issue.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35336 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
57fb219905
commit
164ced04de
3 changed files with 17 additions and 15 deletions
|
@ -68,6 +68,7 @@ static void fbuffer_inc_capa(FBuffer *fb, unsigned long requested)
|
||||||
if (!fb->ptr) {
|
if (!fb->ptr) {
|
||||||
fb->ptr = ALLOC_N(char, fb->initial_length);
|
fb->ptr = ALLOC_N(char, fb->initial_length);
|
||||||
fb->capa = fb->initial_length;
|
fb->capa = fb->initial_length;
|
||||||
|
fb->len = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (required = fb->capa; requested > required - fb->len; required <<= 1);
|
for (required = fb->capa; requested > required - fb->len; required <<= 1);
|
||||||
|
|
|
@ -762,6 +762,7 @@ static void generate_json_bignum(FBuffer *buffer, VALUE Vstate, JSON_Generator_S
|
||||||
{
|
{
|
||||||
VALUE tmp = rb_funcall(obj, i_to_s, 0);
|
VALUE tmp = rb_funcall(obj, i_to_s, 0);
|
||||||
fbuffer_append_str(buffer, tmp);
|
fbuffer_append_str(buffer, tmp);
|
||||||
|
RB_GC_GUARD(tmp);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void generate_json_float(FBuffer *buffer, VALUE Vstate, JSON_Generator_State *state, VALUE obj)
|
static void generate_json_float(FBuffer *buffer, VALUE Vstate, JSON_Generator_State *state, VALUE obj)
|
||||||
|
|
|
@ -214,25 +214,25 @@ EOT
|
||||||
assert_equal 128, s.buffer_initial_length
|
assert_equal 128, s.buffer_initial_length
|
||||||
end
|
end
|
||||||
|
|
||||||
require'timeout'
|
|
||||||
def test_gc
|
def test_gc
|
||||||
|
$stdout.puts 'debug: %s:%d:' % [__FILE__, __LINE__]
|
||||||
bignum_too_long_to_embed_as_string = 1234567890123456789012345
|
bignum_too_long_to_embed_as_string = 1234567890123456789012345
|
||||||
expect = nil
|
$stdout.puts 'debug: %s:%d:' % [__FILE__, __LINE__]
|
||||||
stress = nil
|
expect = bignum_too_long_to_embed_as_string.to_s
|
||||||
timeout(1) do
|
$stdout.puts 'debug: %s:%d:' % [__FILE__, __LINE__]
|
||||||
expect = bignum_too_long_to_embed_as_string.to_s
|
GC.start
|
||||||
end
|
$stdout.puts 'debug: %s:%d:' % [__FILE__, __LINE__]
|
||||||
timeout(30) do
|
stress, GC.stress = GC.stress, true
|
||||||
GC.start
|
$stdout.puts 'debug: %s:%d:' % [__FILE__, __LINE__]
|
||||||
stress, GC.stress = GC.stress, true
|
|
||||||
end
|
|
||||||
|
|
||||||
timeout(30) do
|
10.times do |i|
|
||||||
10.times do |i|
|
$stdout.puts 'debug: %s:%d:' % [__FILE__, __LINE__]
|
||||||
tmp = bignum_too_long_to_embed_as_string.to_json
|
tmp = bignum_too_long_to_embed_as_string.to_json
|
||||||
assert_equal expect, tmp
|
$stdout.puts 'debug: %s:%d:' % [__FILE__, __LINE__]
|
||||||
end
|
assert_equal expect, tmp
|
||||||
|
$stdout.puts 'debug: %s:%d:' % [__FILE__, __LINE__]
|
||||||
end
|
end
|
||||||
|
$stdout.puts 'debug: %s:%d:' % [__FILE__, __LINE__]
|
||||||
ensure
|
ensure
|
||||||
GC.stress = stress
|
GC.stress = stress
|
||||||
end if GC.respond_to?(:stress=)
|
end if GC.respond_to?(:stress=)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue