[前][次][番号順一覧][スレッド一覧]

ruby-changes:56082

From: Nobuyoshi <ko1@a...>
Date: Tue, 11 Jun 2019 23:20:54 +0900 (JST)
Subject: [ruby-changes:56082] Nobuyoshi Nakada: eb016d8353 (trunk): Generalize timeout_scale

https://git.ruby-lang.org/ruby.git/commit/?id=eb016d8353

From eb016d835373cdce6f08694e527d7a569c208cb5 Mon Sep 17 00:00:00 2001
From: Nobuyoshi Nakada <nobu@r...>
Date: Tue, 11 Jun 2019 11:03:55 +0900
Subject: Generalize timeout_scale

* test/lib/test/unit.rb (Test::Unit::TimeoutOption): renamed
  SubprocessOption.

* test/lib/test/unit.rb (Test::Unit::TimeoutOption#setup_options):
  prefer `--timeout-scale` option.

* test/lib/test/unit.rb (Test::Unit::TimeoutOption#non_options):
  prefer `ENV["RUBY_TEST_TIMEOUT_SCALE"]`.

diff --git a/appveyor.yml b/appveyor.yml
index 75c5307..06edf95 100644
--- a/appveyor.yml
+++ b/appveyor.yml
@@ -71,9 +71,9 @@ for: https://github.com/ruby/ruby/blob/trunk/appveyor.yml#L71
     - set /a JOBS=%NUMBER_OF_PROCESSORS%
     - nmake -l "TESTOPTS=-v -q" btest
     - nmake -l "TESTOPTS=-v -q" test-basic
-    - nmake -l "TESTOPTS=-q --subprocess-timeout-scale=3.0 --excludes=../test/excludes/_appveyor -j%JOBS% --exclude readline --exclude win32ole --exclude test_bignum --exclude test_syntax --exclude test_open-uri --exclude test_bundled_ca --exclude test_gc_compact" test-all
+    - nmake -l "TESTOPTS=-q --timeout-scale=3.0 --excludes=../test/excludes/_appveyor -j%JOBS% --exclude readline --exclude win32ole --exclude test_bignum --exclude test_syntax --exclude test_open-uri --exclude test_bundled_ca --exclude test_gc_compact" test-all
     # separately execute tests without -j which may crash worker with -j.
-    - nmake -l "TESTOPTS=-v --subprocess-timeout-scale=3.0 --excludes=../test/excludes/_appveyor" test-all TESTS="../test/win32ole ../test/ruby/test_bignum.rb ../test/ruby/test_syntax.rb ../test/open-uri/test_open-uri.rb ../test/rubygems/test_bundled_ca.rb ../test/ruby/test_gc_compact.rb"
+    - nmake -l "TESTOPTS=-v --timeout-scale=3.0 --excludes=../test/excludes/_appveyor" test-all TESTS="../test/win32ole ../test/ruby/test_bignum.rb ../test/ruby/test_syntax.rb ../test/open-uri/test_open-uri.rb ../test/rubygems/test_bundled_ca.rb ../test/ruby/test_gc_compact.rb"
     - nmake -l test-spec MSPECOPT=-fs # not using `-j` because sometimes `mspec -j` silently dies on Windows
 -
   matrix:
@@ -118,9 +118,9 @@ for: https://github.com/ruby/ruby/blob/trunk/appveyor.yml#L118
     - if not "%GEMS_FOR_TEST%" == "" ..\install\bin\gem install --no-document %GEMS_FOR_TEST%
   test_script:
     - mingw32-make test
-    - mingw32-make test-all TESTOPTS="--retry --job-status=normal --show-skip --subprocess-timeout-scale=1.5 --excludes=../ruby/test/excludes/_appveyor -j %JOBS% --exclude win32ole --exclude test_open-uri --exclude test_gc_compact"
+    - mingw32-make test-all TESTOPTS="--retry --job-status=normal --show-skip --timeout-scale=1.5 --excludes=../ruby/test/excludes/_appveyor -j %JOBS% --exclude win32ole --exclude test_open-uri --exclude test_gc_compact"
     # separately execute tests without -j which may crash worker with -j.
-    - mingw32-make test-all TESTOPTS="--retry --job-status=normal --show-skip --subprocess-timeout-scale=1.5 --excludes=../ruby/test/excludes/_appveyor" TESTS="../ruby/test/win32ole ../ruby/test/open-uri/test_open-uri.rb ../ruby/test/ruby/test_gc_compact.rb"
+    - mingw32-make test-all TESTOPTS="--retry --job-status=normal --show-skip --timeout-scale=1.5 --excludes=../ruby/test/excludes/_appveyor" TESTS="../ruby/test/win32ole ../ruby/test/open-uri/test_open-uri.rb ../ruby/test/ruby/test_gc_compact.rb"
     - mingw32-make test-spec MSPECOPT=-fs # not using `-j` because sometimes `mspec -j` silently dies on Windows
 notifications:
   # Using "Webhook" with templated body to skip notification on Pull Request
diff --git a/test/lib/envutil.rb b/test/lib/envutil.rb
index f9c0e57..b4eb63d 100644
--- a/test/lib/envutil.rb
+++ b/test/lib/envutil.rb
@@ -45,7 +45,7 @@ module EnvUtil https://github.com/ruby/ruby/blob/trunk/test/lib/envutil.rb#L45
   RUBYLIB = ENV["RUBYLIB"]
 
   class << self
-    attr_accessor :subprocess_timeout_scale
+    attr_accessor :timeout_scale
     attr_reader :original_internal_encoding, :original_external_encoding,
                 :original_verbose
 
@@ -57,7 +57,7 @@ module EnvUtil https://github.com/ruby/ruby/blob/trunk/test/lib/envutil.rb#L57
   end
 
   def apply_timeout_scale(t)
-    if scale = EnvUtil.subprocess_timeout_scale
+    if scale = EnvUtil.timeout_scale
       t * scale
     else
       t
diff --git a/test/lib/test/unit.rb b/test/lib/test/unit.rb
index 16db7ad..3df6774 100644
--- a/test/lib/test/unit.rb
+++ b/test/lib/test/unit.rb
@@ -195,10 +195,10 @@ module Test https://github.com/ruby/ruby/blob/trunk/test/lib/test/unit.rb#L195
 
       class Worker
         def self.launch(ruby,args=[])
-          scale = EnvUtil.subprocess_timeout_scale
+          scale = EnvUtil.timeout_scale
           io = IO.popen([*ruby, "-W1",
                         "#{File.dirname(__FILE__)}/unit/parallel.rb",
-                        *("--subprocess-timeout-scale=#{scale}" if scale),
+                        *("--timeout-scale=#{scale}" if scale),
                         *args], "rb+")
           new(io, io.pid, :waiting)
         end
@@ -1031,11 +1031,11 @@ module Test https://github.com/ruby/ruby/blob/trunk/test/lib/test/unit.rb#L1031
       end
     end
 
-    module SubprocessOption
+    module TimeoutOption
       def setup_options(parser, options)
         super
-        parser.separator "subprocess options:"
-        parser.on '--subprocess-timeout-scale NUM', "Scale subprocess timeout", Float do |scale|
+        parser.separator "timeout options:"
+        parser.on '--timeout-scale NUM', '--subprocess-timeout-scale NUM', "Scale timeout", Float do |scale|
           raise OptionParser::InvalidArgument, "timeout scale must be positive" unless scale > 0
           options[:timeout_scale] = scale
         end
@@ -1043,8 +1043,9 @@ module Test https://github.com/ruby/ruby/blob/trunk/test/lib/test/unit.rb#L1043
 
       def non_options(files, options)
         if scale = options[:timeout_scale] or
-          (scale = ENV["RUBY_TEST_SUBPROCESS_TIMEOUT_SCALE"] and (scale = scale.to_f) > 0)
-          EnvUtil.subprocess_timeout_scale = scale
+          (scale = ENV["RUBY_TEST_TIMEOUT_SCALE"] || ENV["RUBY_TEST_SUBPROCESS_TIMEOUT_SCALE"] and
+           (scale = scale.to_f) > 0)
+          EnvUtil.timeout_scale = scale
         end
         super
       end
@@ -1061,7 +1062,7 @@ module Test https://github.com/ruby/ruby/blob/trunk/test/lib/test/unit.rb#L1062
       include Test::Unit::LoadPathOption
       include Test::Unit::GCStressOption
       include Test::Unit::ExcludesOption
-      include Test::Unit::SubprocessOption
+      include Test::Unit::TimeoutOption
       include Test::Unit::RunCount
 
       class << self; undef autorun; end
diff --git a/wercker.yml b/wercker.yml
index ac9c2ab..c8b2525 100644
--- a/wercker.yml
+++ b/wercker.yml
@@ -61,7 +61,7 @@ mjit-test1: https://github.com/ruby/ruby/blob/trunk/wercker.yml#L61
         code: /usr/bin/sudo -H -u test -- make test-spec RUN_OPTS="--disable-gems --jit --jit-warnings"
     - script:
         name: make test-all (JIT)
-        code: /usr/local/bin/mjit-debug-on-fail /usr/bin/sudo -H -u test -- make test-all RUN_OPTS="--disable-gems --jit-verbose=1 --jit-save-temps --jit-warnings" TESTOPTS="-v --color=never --job-status=normal --longest 10 --subprocess-timeout-scale=3.0 --excludes=test/excludes/_wercker/jit"
+        code: /usr/local/bin/mjit-debug-on-fail /usr/bin/sudo -H -u test -- make test-all RUN_OPTS="--disable-gems --jit-verbose=1 --jit-save-temps --jit-warnings" TESTOPTS="-v --color=never --job-status=normal --longest 10 --timeout-scale=3.0 --excludes=test/excludes/_wercker/jit"
 
     # --jit-wait (test, test-spec)
     - script:
@@ -100,7 +100,7 @@ mjit-test2: https://github.com/ruby/ruby/blob/trunk/wercker.yml#L100
     # --jit-wait (test-all)
     - script:
         name: make test-all (JIT wait)
-        code: /usr/bin/sudo -H -u test -- make test-all RUN_OPTS="--disable-gems --jit-wait --jit-warnings" TESTOPTS="-v --test-order=random --color=never --job-status=normal --subprocess-timeout-scale=3.0 --excludes=test/excludes/_wercker/jit-wait"
+        code: /usr/bin/sudo -H -u test -- make test-all RUN_OPTS="--disable-gems --jit-wait --jit-warnings" TESTOPTS="-v --test-order=random --color=never --job-status=normal --timeout-scale=3.0 --excludes=test/excludes/_wercker/jit-wait"
 
   after-steps:
     - wantedly/pretty-slack-notify:
-- 
cgit v0.10.2


--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]