Only check constant leaks by default for `make test-spec`

* See https://github.com/ruby/ruby/pull/9548
This commit is contained in:
Benoit Daloze 2024-02-14 11:41:33 +01:00 коммит произвёл Hiroshi SHIBATA
Родитель 6f9ca7f453
Коммит d24be39d69
2 изменённых файлов: 9 добавлений и 3 удалений

Просмотреть файл

@ -4,8 +4,8 @@ if (opt = ENV["RUBYOPT"]) and (opt = opt.dup).sub!(/(?:\A|\s)-w(?=\z|\s)/, '')
ENV["RUBYOPT"] = opt
end
# Enable leakcheckers by ruby/mspec
ENV["CHECK_LEAKS"] ||= "true"
# Enable constant leak checks by ruby/mspec
ENV["CHECK_CONSTANT_LEAKS"] ||= "true"
require "./rbconfig" unless defined?(RbConfig)
require_relative "../tool/test-coverage" if ENV.key?("COVERAGE")

Просмотреть файл

@ -5,6 +5,9 @@ require 'mspec/utils/options'
if ENV['CHECK_LEAKS']
require 'mspec/runner/actions/leakchecker'
end
if ENV['CHECK_LEAKS'] || ENV['CHECK_CONSTANT_LEAKS']
require 'mspec/runner/actions/constants_leak_checker'
end
@ -40,8 +43,11 @@ class BaseFormatter
@counter = @tally.counter
if ENV['CHECK_LEAKS']
save = ENV['CHECK_LEAKS'] == 'save'
LeakCheckerAction.new.register
end
if ENV['CHECK_LEAKS'] || ENV['CHECK_CONSTANT_LEAKS']
save = ENV['CHECK_LEAKS'] == 'save' || ENV['CHECK_CONSTANT_LEAKS'] == 'save'
ConstantsLeakCheckerAction.new(save).register
end