From 582f4bc1889c3161f47a76b46b60d5b9c6fb0bde Mon Sep 17 00:00:00 2001 From: Yusuke Endoh Date: Fri, 9 Apr 2021 13:59:46 +0900 Subject: [PATCH] test/ruby/test_gc_compact.rb: Use assert_separately for debugging ... the following timeout failure. http://rubyci.s3.amazonaws.com/rhel_zlinux/ruby-master/log/20210408T213303Z.fail.html.gz ``` [ 8871/21204] TestGCCompact#test_ast_compactstimeout: output interval exceeds 600.0 seconds. timeout: the process group 28416 is alive. PSOUT PGID PID ELAPSED %CPU VSZ COMMAND COMMAND PSOUT 28416 28416 12:46 0.0 108120 gmake gmake TESTS=--hide-skip -v RUBYOPT=-w test-all PSOUT 28416 28423 12:46 88.2 1446124 ruby ./test/runner.rb: TestGCCompact#test_ast_compacts timeout: INT signal sent. timeout: INT signal sent. timeout: TERM signal sent. timeout: TERM signal sent. timeout: KILL signal sent. ``` This error repeatedly occurs on RHEL s390x. This change sends SEGV when timeout occurs so that it should dump the backtrace. --- test/ruby/test_gc_compact.rb | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/test/ruby/test_gc_compact.rb b/test/ruby/test_gc_compact.rb index 4a8cff33f4..8dfa66a177 100644 --- a/test/ruby/test_gc_compact.rb +++ b/test/ruby/test_gc_compact.rb @@ -133,18 +133,20 @@ class TestGCCompact < Test::Unit::TestCase assert_equal hash, list_of_objects.hash end - def walk_ast ast - children = ast.children.grep(RubyVM::AbstractSyntaxTree::Node) - children.each do |child| - assert child.type - walk_ast child - end - end - def test_ast_compacts - ast = RubyVM::AbstractSyntaxTree.parse_file __FILE__ - assert GC.compact - walk_ast ast + assert_separately([], "#{<<~"begin;"}\n#{<<~"end;"}", timeout: 10, signal: :SEGV) + begin; + def walk_ast ast + children = ast.children.grep(RubyVM::AbstractSyntaxTree::Node) + children.each do |child| + assert child.type + walk_ast child + end + end + ast = RubyVM::AbstractSyntaxTree.parse_file #{__FILE__.dump} + assert GC.compact + walk_ast ast + end; end def test_compact_count