mirror of
				https://github.com/ruby/ruby.git
				synced 2022-11-09 12:17:21 -05:00 
			
		
		
		
	Rename test_jit to test_mjit
to avoid confusion with YJIT
This commit is contained in:
		
							parent
							
								
									aef36bb933
								
							
						
					
					
						commit
						ead96e7b44
					
				
					 7 changed files with 23 additions and 23 deletions
				
			
		
							
								
								
									
										4
									
								
								.github/workflows/compilers.yml
									
										
									
									
										vendored
									
									
								
							
							
						
						
									
										4
									
								
								.github/workflows/compilers.yml
									
										
									
									
										vendored
									
									
								
							| 
						 | 
				
			
			@ -251,8 +251,8 @@ jobs:
 | 
			
		|||
      # FIXME: Skip MJIT tests failing in the annocheck case.
 | 
			
		||||
      # https://bugs.ruby-lang.org/issues/18781
 | 
			
		||||
      - run: |
 | 
			
		||||
          rm test/ruby/test_jit.rb
 | 
			
		||||
          rm test/ruby/test_rubyvm_jit.rb
 | 
			
		||||
          rm test/ruby/test_mjit.rb
 | 
			
		||||
          rm test/ruby/test_rubyvm_mjit.rb
 | 
			
		||||
        if: ${{ endsWith(matrix.entry.name, 'annocheck') }}
 | 
			
		||||
        working-directory: src
 | 
			
		||||
      - run: make test-all TESTS='-- ruby -ext-'
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -3,8 +3,8 @@ require 'test/unit'
 | 
			
		|||
require 'tmpdir'
 | 
			
		||||
require_relative '../lib/jit_support'
 | 
			
		||||
 | 
			
		||||
# Test for --jit option
 | 
			
		||||
class TestJIT < Test::Unit::TestCase
 | 
			
		||||
# Test for --mjit option
 | 
			
		||||
class TestMJIT < Test::Unit::TestCase
 | 
			
		||||
  include JITSupport
 | 
			
		||||
 | 
			
		||||
  IGNORABLE_PATTERNS = [
 | 
			
		||||
| 
						 | 
				
			
			@ -31,7 +31,7 @@ class TestJIT < Test::Unit::TestCase
 | 
			
		|||
    :opt_invokebuiltin_delegate,
 | 
			
		||||
  ].each do |insn|
 | 
			
		||||
    if !RubyVM::INSTRUCTION_NAMES.include?(insn.to_s)
 | 
			
		||||
      warn "instruction #{insn.inspect} is not defined but included in TestJIT::TEST_PENDING_INSNS"
 | 
			
		||||
      warn "instruction #{insn.inspect} is not defined but included in TestMJIT::TEST_PENDING_INSNS"
 | 
			
		||||
    end
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -46,17 +46,17 @@ class TestJIT < Test::Unit::TestCase
 | 
			
		|||
    # ci.rvm.jp caches its build environment. Clean up temporary files left by SEGV.
 | 
			
		||||
    if ENV['RUBY_DEBUG']&.include?('ci')
 | 
			
		||||
      Dir.glob("#{ENV.fetch('TMPDIR', '/tmp')}/_ruby_mjit_p*u*.*").each do |file|
 | 
			
		||||
        puts "test/ruby/test_jit.rb: removing #{file}"
 | 
			
		||||
        puts "test/ruby/test_mjit.rb: removing #{file}"
 | 
			
		||||
        File.unlink(file)
 | 
			
		||||
      end
 | 
			
		||||
    end
 | 
			
		||||
 | 
			
		||||
    # ruby -w -Itest/lib test/ruby/test_jit.rb
 | 
			
		||||
    # ruby -w -Itest/lib test/ruby/test_mjit.rb
 | 
			
		||||
    if $VERBOSE
 | 
			
		||||
      pid = $$
 | 
			
		||||
      at_exit do
 | 
			
		||||
        if pid == $$ && !TestJIT.untested_insns.empty?
 | 
			
		||||
          warn "you may want to add tests for following insns, when you have a chance: #{TestJIT.untested_insns.join(' ')}"
 | 
			
		||||
        if pid == $$ && !TestMJIT.untested_insns.empty?
 | 
			
		||||
          warn "you may want to add tests for following insns, when you have a chance: #{TestMJIT.untested_insns.join(' ')}"
 | 
			
		||||
        end
 | 
			
		||||
      end
 | 
			
		||||
    end
 | 
			
		||||
| 
						 | 
				
			
			@ -620,7 +620,7 @@ class TestJIT < Test::Unit::TestCase
 | 
			
		|||
    end;
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
  def test_jit_output
 | 
			
		||||
  def test_mjit_output
 | 
			
		||||
    out, err = eval_with_jit('5.times { puts "MJIT" }', verbose: 1, min_calls: 5)
 | 
			
		||||
    assert_equal("MJIT\n" * 5, out)
 | 
			
		||||
    assert_match(/^#{JIT_SUCCESS_PREFIX}: block in <main>@-e:1 -> .+_ruby_mjit_p\d+u\d+\.c$/, err)
 | 
			
		||||
| 
						 | 
				
			
			@ -1237,7 +1237,7 @@ class TestJIT < Test::Unit::TestCase
 | 
			
		|||
      $stderr.puts
 | 
			
		||||
      warn "'#{insn}' insn is not included in the script. Actual insns are: #{used_insns.join(' ')}\n", uplevel: uplevel
 | 
			
		||||
    end
 | 
			
		||||
    TestJIT.untested_insns.delete(insn)
 | 
			
		||||
    TestMJIT.untested_insns.delete(insn)
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
  # Collect block's insns or defined method's insns, which are expected to be JIT-ed.
 | 
			
		||||
| 
						 | 
				
			
			@ -1,13 +1,13 @@
 | 
			
		|||
require_relative 'test_jit'
 | 
			
		||||
require_relative 'test_mjit'
 | 
			
		||||
 | 
			
		||||
return unless defined?(TestJIT)
 | 
			
		||||
return unless defined?(TestMJIT)
 | 
			
		||||
return if ENV.key?('APPVEYOR')
 | 
			
		||||
return if ENV.key?('RUBYCI_NICKNAME')
 | 
			
		||||
return if ENV['RUBY_DEBUG']&.include?('ci') # ci.rvm.jp
 | 
			
		||||
return if /mswin/ =~ RUBY_PLATFORM
 | 
			
		||||
 | 
			
		||||
class TestJITDebug < TestJIT
 | 
			
		||||
  @@test_suites.delete TestJIT if self.respond_to? :on_parallel_worker?
 | 
			
		||||
class TestMJITDebug < TestMJIT
 | 
			
		||||
  @@test_suites.delete TestMJIT if self.respond_to? :on_parallel_worker?
 | 
			
		||||
 | 
			
		||||
  def setup
 | 
			
		||||
    super
 | 
			
		||||
| 
						 | 
				
			
			@ -1122,7 +1122,7 @@ class TestRubyOptions < Test::Unit::TestCase
 | 
			
		|||
    assert_in_out_err([IO::NULL], success: true)
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
  def test_jit_debug
 | 
			
		||||
  def test_mjit_debug
 | 
			
		||||
    # mswin uses prebuilt precompiled header. Thus it does not show a pch compilation log to check "-O0 -O1".
 | 
			
		||||
    if JITSupport.supported? && !RUBY_PLATFORM.match?(/mswin/)
 | 
			
		||||
      env = { 'MJIT_SEARCH_BUILD_DIR' => 'true' }
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -11,7 +11,7 @@ require_relative '../lib/jit_support'
 | 
			
		|||
return unless defined?(RubyVM::YJIT) && RubyVM::YJIT.enabled?
 | 
			
		||||
 | 
			
		||||
# Tests for YJIT with assertions on compilation and side exits
 | 
			
		||||
# insipired by the MJIT tests in test/ruby/test_jit.rb
 | 
			
		||||
# insipired by the MJIT tests in test/ruby/test_mjit.rb
 | 
			
		||||
class TestYJIT < Test::Unit::TestCase
 | 
			
		||||
  def test_yjit_in_ruby_description
 | 
			
		||||
    assert_includes(RUBY_DESCRIPTION, '+YJIT')
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -74,16 +74,16 @@ module Test
 | 
			
		|||
        end
 | 
			
		||||
      end
 | 
			
		||||
 | 
			
		||||
      module JITFirst
 | 
			
		||||
      module MJITFirst
 | 
			
		||||
        def group(list)
 | 
			
		||||
          # JIT first
 | 
			
		||||
          jit, others = list.partition {|e| /test_jit/ =~ e}
 | 
			
		||||
          jit + others
 | 
			
		||||
          # MJIT first
 | 
			
		||||
          mjit, others = list.partition {|e| /test_mjit/ =~ e}
 | 
			
		||||
          mjit + others
 | 
			
		||||
        end
 | 
			
		||||
      end
 | 
			
		||||
 | 
			
		||||
      class Alpha < NoSort
 | 
			
		||||
        include JITFirst
 | 
			
		||||
        include MJITFirst
 | 
			
		||||
 | 
			
		||||
        def sort_by_name(list)
 | 
			
		||||
          list.sort_by(&:name)
 | 
			
		||||
| 
						 | 
				
			
			@ -97,7 +97,7 @@ module Test
 | 
			
		|||
 | 
			
		||||
      # shuffle test suites based on CRC32 of their names
 | 
			
		||||
      Shuffle = Struct.new(:seed, :salt) do
 | 
			
		||||
        include JITFirst
 | 
			
		||||
        include MJITFirst
 | 
			
		||||
 | 
			
		||||
        def initialize(seed)
 | 
			
		||||
          self.class::CRC_TBL ||= (0..255).map {|i|
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue