зеркало из https://github.com/github/ruby.git
Fix exit locations test (#5995)
I originally added the check for RubyVM::YJIT.trace_exit_locations_enabled? to fix errors when these tests run without the stats feature enabled. However I forgot that this will never be true when this test is booting, so nothing was running when the stats feature is turned on. Instead I've decided to make a new hash in the dump file and check if exit locations are enabled there. If they aren't enabled we return early to avoid checking for keys that won't exit in the dumped exit locations. I chose to add this additional enabled check because empty exit locations might not indicate that stats isn't enabled, it could mean the feature is entirely broken. I do want these tests to fail if stats are on and nothing was collected. Followup to #5970
This commit is contained in:
Родитель
c2468fd88b
Коммит
e69e47f8d6
|
@ -8,7 +8,7 @@ require 'envutil'
|
|||
require 'tmpdir'
|
||||
require_relative '../lib/jit_support'
|
||||
|
||||
return unless defined?(RubyVM::YJIT) && RubyVM::YJIT.enabled? && RubyVM::YJIT.trace_exit_locations_enabled?
|
||||
return unless defined?(RubyVM::YJIT) && RubyVM::YJIT.enabled?
|
||||
|
||||
# Tests for YJIT with assertions on tracing exits
|
||||
# insipired by the MJIT tests in test/ruby/test_yjit.rb
|
||||
|
@ -40,7 +40,10 @@ class TestYJITExitLocations < Test::Unit::TestCase
|
|||
|
||||
def assert_exit_locations(test_script)
|
||||
write_results = <<~RUBY
|
||||
IO.open(3).write Marshal.dump(RubyVM::YJIT.exit_locations)
|
||||
IO.open(3).write Marshal.dump({
|
||||
enabled: RubyVM::YJIT.trace_exit_locations_enabled?,
|
||||
exit_locations: RubyVM::YJIT.exit_locations
|
||||
})
|
||||
RUBY
|
||||
|
||||
script = <<~RUBY
|
||||
|
@ -51,7 +54,13 @@ class TestYJITExitLocations < Test::Unit::TestCase
|
|||
#{write_results}
|
||||
RUBY
|
||||
|
||||
exit_locations = eval_with_jit(script)
|
||||
run_script = eval_with_jit(script)
|
||||
# If stats are disabled when configuring, --yjit-exit-locations
|
||||
# can't be true. We don't want to check if exit_locations hash
|
||||
# is not empty because that could indicate a bug in the exit
|
||||
# locations collection.
|
||||
return unless run_script[:enabled]
|
||||
exit_locations = run_script[:exit_locations]
|
||||
|
||||
assert exit_locations.key?(:raw)
|
||||
assert exit_locations.key?(:frames)
|
||||
|
|
Загрузка…
Ссылка в новой задаче