diff options
author | k0kubun <k0kubun@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2018-05-22 15:48:58 +0000 |
---|---|---|
committer | k0kubun <k0kubun@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2018-05-22 15:48:58 +0000 |
commit | 3d90e2aead58e841a6f2fd2c59c9978849340c84 (patch) | |
tree | ff5b543427105e0e2edebf6b4cd19a8f94ea3aec /test | |
parent | e42b4ae53a65f5101f14edbfa2a6d098553f8769 (diff) | |
download | ruby-3d90e2aead58e841a6f2fd2c59c9978849340c84.tar.gz |
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
Diffstat (limited to 'test')
-rw-r--r-- | test/ruby/test_jit.rb | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/test/ruby/test_jit.rb b/test/ruby/test_jit.rb index 891b7f496f..f212a3f21f 100644 --- a/test/ruby/test_jit.rb +++ b/test/ruby/test_jit.rb @@ -109,10 +109,16 @@ class TestJIT < Test::Unit::TestCase 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 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 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 case insn when :putiseq, :send insns += collect_insns(args.last) + when :defineclass + insns += collect_insns(args[1]) end end insns.uniq |