88require_relative '../lib/parser_support'
99
1010class TestRubyOptions < Test ::Unit ::TestCase
11- def self . yjit_enabled? = defined? ( RubyVM ::YJIT ) && RubyVM ::YJIT . enabled?
12-
1311 # Here we're defining our own RUBY_DESCRIPTION without "+PRISM". We do this
1412 # here so that the various tests that reference RUBY_DESCRIPTION don't have to
1513 # worry about it. The flag itself is tested in its own test.
@@ -22,8 +20,10 @@ def self.yjit_enabled? = defined?(RubyVM::YJIT) && RubyVM::YJIT.enabled?
2220
2321 NO_JIT_DESCRIPTION =
2422 case
25- when yjit_enabled?
26- RUBY_DESCRIPTION . sub ( /\+ YJIT( (dev|dev_nodebug|stats))? / , '' )
23+ when JITSupport . yjit_enabled?
24+ RUBY_DESCRIPTION . sub ( /\+ YJIT( \w +)? / , '' )
25+ when JITSupport . zjit_enabled?
26+ RUBY_DESCRIPTION . sub ( /\+ ZJIT( \w +)? / , '' )
2727 else
2828 RUBY_DESCRIPTION
2929 end
@@ -181,7 +181,7 @@ def test_debug
181181 def test_verbose
182182 assert_in_out_err ( [ { 'RUBY_YJIT_ENABLE' => nil } , "-vve" , "" ] ) do |r , e |
183183 assert_match ( VERSION_PATTERN , r [ 0 ] )
184- if self . class . yjit_enabled? && !JITSupport . yjit_force_enabled?
184+ if ( JITSupport . yjit_enabled? && !JITSupport . yjit_force_enabled? ) || JITSupport . zjit_enabled ?
185185 assert_equal ( NO_JIT_DESCRIPTION , r [ 0 ] )
186186 else
187187 assert_equal ( RUBY_DESCRIPTION , r [ 0 ] )
@@ -247,7 +247,7 @@ def test_version
247247 assert_match ( VERSION_PATTERN , r [ 0 ] )
248248 if ENV [ 'RUBY_YJIT_ENABLE' ] == '1'
249249 assert_equal ( NO_JIT_DESCRIPTION , r [ 0 ] )
250- elsif self . class . yjit_enabled? # checking -DYJIT_FORCE_ENABLE
250+ elsif JITSupport . yjit_enabled? || JITSupport . zjit_enabled ? # checking -DYJIT_FORCE_ENABLE
251251 assert_equal ( EnvUtil . invoke_ruby ( [ '-e' , 'print RUBY_DESCRIPTION' ] , '' , true ) . first , r [ 0 ] )
252252 else
253253 assert_equal ( RUBY_DESCRIPTION , r [ 0 ] )
@@ -852,7 +852,8 @@ def assert_segv(args, message=nil, list: SEGVTest::ExpectedStderrList, **opt, &b
852852 # We want YJIT to be enabled in the subprocess if it's enabled for us
853853 # so that the Ruby description matches.
854854 env = Hash === args . first ? args . shift : { }
855- args . unshift ( "--yjit" ) if self . class . yjit_enabled?
855+ args . unshift ( "--yjit" ) if JITSupport . yjit_enabled?
856+ args . unshift ( "--zjit" ) if JITSupport . zjit_enabled?
856857 env . update ( { 'RUBY_ON_BUG' => nil } )
857858 # ASAN registers a segv handler which prints out "AddressSanitizer: DEADLYSIGNAL" when
858859 # catching sigsegv; we don't expect that output, so suppress it.
0 commit comments