implement make test-all TESTS=--gc-compact
79eb5e1acac2339c6ec71db723298bdfcd92b233 implemented RUBY_TEST_GC_COMPACT=1 so why not make it also possible via the command line argument.
This commit is contained in:
parent
53e8589c69
commit
12de92a368
@ -922,13 +922,16 @@ module Test
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
module GCStressOption # :nodoc: all
|
module GCOption # :nodoc: all
|
||||||
def setup_options(parser, options)
|
def setup_options(parser, options)
|
||||||
super
|
super
|
||||||
parser.separator "GC options:"
|
parser.separator "GC options:"
|
||||||
parser.on '--[no-]gc-stress', 'Set GC.stress as true' do |flag|
|
parser.on '--[no-]gc-stress', 'Set GC.stress as true' do |flag|
|
||||||
options[:gc_stress] = flag
|
options[:gc_stress] = flag
|
||||||
end
|
end
|
||||||
|
parser.on '--[no-]gc-compact', 'GC.compact every time' do |flag|
|
||||||
|
options[:gc_compact] = flag
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def non_options(files, options)
|
def non_options(files, options)
|
||||||
@ -945,6 +948,18 @@ module Test
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
if options.delete(:gc_compact)
|
||||||
|
MiniTest::Unit::TestCase.class_eval do
|
||||||
|
oldrun = instance_method(:run)
|
||||||
|
define_method(:run) do |runner|
|
||||||
|
begin
|
||||||
|
oldrun.bind_call(self, runner)
|
||||||
|
ensure
|
||||||
|
GC.compact
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
super
|
super
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -1080,7 +1095,7 @@ module Test
|
|||||||
include Test::Unit::GlobOption
|
include Test::Unit::GlobOption
|
||||||
include Test::Unit::RepeatOption
|
include Test::Unit::RepeatOption
|
||||||
include Test::Unit::LoadPathOption
|
include Test::Unit::LoadPathOption
|
||||||
include Test::Unit::GCStressOption
|
include Test::Unit::GCOption
|
||||||
include Test::Unit::ExcludesOption
|
include Test::Unit::ExcludesOption
|
||||||
include Test::Unit::TimeoutOption
|
include Test::Unit::TimeoutOption
|
||||||
include Test::Unit::RunCount
|
include Test::Unit::RunCount
|
||||||
|
Loading…
x
Reference in New Issue
Block a user