ruby-changes:51286
From: k0kubun <ko1@a...>
Date: Wed, 23 May 2018 00:49:03 +0900 (JST)
Subject: [ruby-changes:51286] k0kubun:r63492 (trunk): test_jit.rb: propagate suspicious stderr
k0kubun 2018-05-23 00:48:58 +0900 (Wed, 23 May 2018) New Revision: 63492 https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=63492 Log: test_jit.rb: propagate suspicious stderr of child ruby process to parent stderr using `Kernel#warn`. This fixes a warning in {set,get}classvariable as well. Modified files: trunk/test/ruby/test_jit.rb Index: test/ruby/test_jit.rb =================================================================== --- test/ruby/test_jit.rb (revision 63491) +++ test/ruby/test_jit.rb (revision 63492) @@ -109,10 +109,16 @@ class TestJIT < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/ruby/test_jit.rb#L109 end def test_compile_insn_classvariable - assert_compile_once("#{<<~"begin;"}\n#{<<~"end;"}", result_inspect: '1', insns: %i[getclassvariable setclassvariable]) + assert_eval_with_jit("#{<<~"begin;"}\n#{<<~"end;"}", stdout: '1', success_count: 1, insns: %i[getclassvariable setclassvariable]) begin; - @@foo = 1 - @@foo + class Foo + def self.foo + @@foo = 1 + @@foo + end + end + + print Foo.foo end; end @@ -675,7 +681,7 @@ class TestJIT < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/ruby/test_jit.rb#L681 else script = " #{script} " end - assert_eval_with_jit("p proc {#{script}}.call", stdout: "#{result_inspect}\n", success_count: 1, insns: insns, uplevel: 4) + assert_eval_with_jit("p proc {#{script}}.call", stdout: "#{result_inspect}\n", success_count: 1, insns: insns, uplevel: 2) end # Shorthand for normal test cases @@ -714,6 +720,10 @@ class TestJIT < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/ruby/test_jit.rb#L720 if stdout assert_equal(stdout, out, "Expected stdout #{out.inspect} to match #{stdout.inspect} with script:\n#{code_block(script)}") end + err_lines = err.lines.reject! { |l| l.chomp.empty? || l.match?(/\A#{JIT_SUCCESS_PREFIX}/) || l == "Successful MJIT finish\n" } + unless err_lines.empty? + warn err_lines.join(''), uplevel: uplevel + end end # Collect block's insns or defined method's insns, which are expected to be JIT-ed. @@ -724,6 +734,8 @@ class TestJIT < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/ruby/test_jit.rb#L734 case insn when :putiseq, :send insns += collect_insns(args.last) + when :defineclass + insns += collect_insns(args[1]) end end insns.uniq -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/