1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

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.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63492 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
k0kubun 2018-05-22 15:48:58 +00:00
parent e42b4ae53a
commit 3d90e2aead

View file

@ -109,10 +109,16 @@ class TestJIT < Test::Unit::TestCase
end end
def test_compile_insn_classvariable 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; begin;
class Foo
def self.foo
@@foo = 1 @@foo = 1
@@foo @@foo
end
end
print Foo.foo
end; end;
end end
@ -675,7 +681,7 @@ class TestJIT < Test::Unit::TestCase
else else
script = " #{script} " script = " #{script} "
end 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 end
# Shorthand for normal test cases # Shorthand for normal test cases
@ -714,6 +720,10 @@ class TestJIT < Test::Unit::TestCase
if stdout if stdout
assert_equal(stdout, out, "Expected stdout #{out.inspect} to match #{stdout.inspect} with script:\n#{code_block(script)}") assert_equal(stdout, out, "Expected stdout #{out.inspect} to match #{stdout.inspect} with script:\n#{code_block(script)}")
end 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 end
# Collect block's insns or defined method's insns, which are expected to be JIT-ed. # 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
case insn case insn
when :putiseq, :send when :putiseq, :send
insns += collect_insns(args.last) insns += collect_insns(args.last)
when :defineclass
insns += collect_insns(args[1])
end end
end end
insns.uniq insns.uniq