ruby-changes:52964
From: k0kubun <ko1@a...>
Date: Fri, 19 Oct 2018 23:26:33 +0900 (JST)
Subject: [ruby-changes:52964] k0kubun:r65178 (trunk): test/lib/jit_support.rb: continue to skip test_jit
k0kubun 2018-10-19 23:26:29 +0900 (Fri, 19 Oct 2018) New Revision: 65178 https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=65178 Log: test/lib/jit_support.rb: continue to skip test_jit for icc since it's not supported yet but running on rubyci. This reverts some part of r65175, r65176 and r65177. Modified files: trunk/test/lib/jit_support.rb trunk/test/ruby/test_jit.rb trunk/test/ruby/test_rubyoptions.rb trunk/test/ruby/test_rubyvm_mjit.rb Index: test/ruby/test_rubyvm_mjit.rb =================================================================== --- test/ruby/test_rubyvm_mjit.rb (revision 65177) +++ test/ruby/test_rubyvm_mjit.rb (revision 65178) @@ -5,6 +5,12 @@ require_relative '../lib/jit_support' https://github.com/ruby/ruby/blob/trunk/test/ruby/test_rubyvm_mjit.rb#L5 class TestRubyVMMJIT < Test::Unit::TestCase include JITSupport + def setup + unless JITSupport.supported? + skip 'JIT seems not supported on this platform' + end + end + def test_pause out, err = eval_with_jit(<<~'EOS', verbose: 1, min_calls: 1, wait: false) i = 0 Index: test/ruby/test_jit.rb =================================================================== --- test/ruby/test_jit.rb (revision 65177) +++ test/ruby/test_jit.rb (revision 65178) @@ -32,6 +32,10 @@ class TestJIT < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/ruby/test_jit.rb#L32 end def setup + unless JITSupport.supported? + skip 'JIT seems not supported on this platform' + end + # ruby -w -Itest/lib test/ruby/test_jit.rb if $VERBOSE && !defined?(@@at_exit_hooked) at_exit do Index: test/ruby/test_rubyoptions.rb =================================================================== --- test/ruby/test_rubyoptions.rb (revision 65177) +++ test/ruby/test_rubyoptions.rb (revision 65178) @@ -138,9 +138,11 @@ class TestRubyOptions < Test::Unit::Test https://github.com/ruby/ruby/blob/trunk/test/ruby/test_rubyoptions.rb#L138 end def test_enable - assert_in_out_err(%w(--enable all -e) + [""], "", [], []) - assert_in_out_err(%w(--enable-all -e) + [""], "", [], []) - assert_in_out_err(%w(--enable=all -e) + [""], "", [], []) + if JITSupport.supported? + assert_in_out_err(%w(--enable all -e) + [""], "", [], []) + assert_in_out_err(%w(--enable-all -e) + [""], "", [], []) + assert_in_out_err(%w(--enable=all -e) + [""], "", [], []) + end assert_in_out_err(%w(--enable foobarbazqux -e) + [""], "", [], /unknown argument for --enable: `foobarbazqux'/) assert_in_out_err(%w(--enable), "", [], /missing argument for --enable/) @@ -198,19 +200,21 @@ class TestRubyOptions < Test::Unit::Test https://github.com/ruby/ruby/blob/trunk/test/ruby/test_rubyoptions.rb#L200 end end - [ - %w(--version --jit), - %w(--version --enable=jit), - %w(--version --enable-jit), - ].each do |args| - assert_in_out_err(args) do |r, e| - assert_match(VERSION_PATTERN_WITH_JIT, r[0]) - if RubyVM::MJIT.enabled? - assert_equal(RUBY_DESCRIPTION, r[0]) - else - assert_equal(EnvUtil.invoke_ruby(['--jit', '-e', 'print RUBY_DESCRIPTION'], '', true).first, r[0]) + if JITSupport.supported? + [ + %w(--version --jit), + %w(--version --enable=jit), + %w(--version --enable-jit), + ].each do |args| + assert_in_out_err(args) do |r, e| + assert_match(VERSION_PATTERN_WITH_JIT, r[0]) + if RubyVM::MJIT.enabled? + assert_equal(RUBY_DESCRIPTION, r[0]) + else + assert_equal(EnvUtil.invoke_ruby(['--jit', '-e', 'print RUBY_DESCRIPTION'], '', true).first, r[0]) + end + assert_equal([], e) end - assert_equal([], e) end end end Index: test/lib/jit_support.rb =================================================================== --- test/lib/jit_support.rb (revision 65177) +++ test/lib/jit_support.rb (revision 65178) @@ -1,9 +1,8 @@ https://github.com/ruby/ruby/blob/trunk/test/lib/jit_support.rb#L1 module JITSupport JIT_TIMEOUT = 600 # 10min for each... JIT_SUCCESS_PREFIX = 'JIT success \(\d+\.\dms\)' - SUPPORTED_COMPILERS = [ - 'gcc', - 'clang', + UNSUPPORTED_COMPILERS = [ + 'icc', ] module_function @@ -35,6 +34,11 @@ module JITSupport https://github.com/ruby/ruby/blob/trunk/test/lib/jit_support.rb#L34 ) end + def supported? + return @supported if defined?(@supported) + @supported = !UNSUPPORTED_COMPILERS.include?(RbConfig::CONFIG['CC']) + end + def remove_mjit_logs(stderr) if RubyVM::MJIT.enabled? stderr.gsub(/^MJIT warning: Skipped to compile unsupported instruction: \w+\n/m, '') -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/