diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2016-12-24 00:51:01 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2016-12-24 00:51:01 +0000 |
commit | ea7e4639f61a91c83840a4a65eaba2a379ef5f3b (patch) | |
tree | 08bd87c010886ee6716dfe5a6b6d08a705b6155d /test/lib/test | |
parent | 3ef4f1b2fa1de55d164b769964b96c59d63a1d68 (diff) | |
download | ruby-ea7e4639f61a91c83840a4a65eaba2a379ef5f3b.tar.gz |
test/unit.rb: --subprocess-timeout-scale option
* test/lib/envutil.rb (EnvUtil#invoke_ruby): add subprocess
timeout scaling factor.
* test/lib/test/unit.rb (Test::Unit::SubprocessOption): add
--subprocess-timeout-scale option.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57168 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/lib/test')
-rw-r--r-- | test/lib/test/unit.rb | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/test/lib/test/unit.rb b/test/lib/test/unit.rb index f0bd26f32f..30ead34d0f 100644 --- a/test/lib/test/unit.rb +++ b/test/lib/test/unit.rb @@ -932,6 +932,21 @@ module Test end end + module SubprocessOption + def setup_options(parser, options) + super + parser.separator "subprocess options:" + parser.on '--subprocess-timeout-scale NUM', "Scale subprocess timeout", Float do |scale| + raise OptionParser::InvalidArgument, "timeout scale must be positive" unless scale > 0 + options[:timeout_scale] = scale + end + if scale = options[:timeout_scale] or + (scale = ENV["RUBY_TEST_SUBPROCESS_TIMEOUT_SCALE"] and (scale = scale.to_f) > 0) + EnvUtil.subprocess_timeout_scale = scale + end + end + end + class Runner < MiniTest::Unit # :nodoc: all include Test::Unit::Options include Test::Unit::StatusLine @@ -942,6 +957,7 @@ module Test include Test::Unit::LoadPathOption include Test::Unit::GCStressOption include Test::Unit::ExcludesOption + include Test::Unit::SubprocessOption include Test::Unit::RunCount class << self; undef autorun; end |