diff options
author | Nobuyoshi Nakada <nobu@ruby-lang.org> | 2024-04-28 00:03:09 +0900 |
---|---|---|
committer | Nobuyoshi Nakada <nobu@ruby-lang.org> | 2024-04-28 00:03:09 +0900 |
commit | a0b4f0bcc97331e8feae1bcc9567f821921669b9 (patch) | |
tree | 19b93fa7f3d966ea50c3527c13c9b533f8f9d046 | |
parent | 602193ded761fd0489b82cf705416bdc3f9cf501 (diff) |
Timeout scale in bootstraptest
-rwxr-xr-x | bootstraptest/runner.rb | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/bootstraptest/runner.rb b/bootstraptest/runner.rb index f299e4418e..48d69e1fd5 100755 --- a/bootstraptest/runner.rb +++ b/bootstraptest/runner.rb @@ -77,6 +77,7 @@ bt = Struct.new(:ruby, :indent, :platform, :timeout, + :timeout_scale, ) BT = Class.new(bt) do def indent=(n) @@ -144,6 +145,10 @@ BT = Class.new(bt) do end super wn end + + def apply_timeout_scale(timeout) + timeout&.*(timeout_scale) + end end.new BT_STATE = Struct.new(:count, :error).new @@ -157,6 +162,7 @@ def main BT.tty = nil BT.quiet = false BT.timeout = 180 + BT.timeout_scale = (defined?(RubyVM::RJIT) && RubyVM::RJIT.enabled? ? 3 : 1) # for --jit-wait # BT.wn = 1 dir = nil quiet = false @@ -194,8 +200,9 @@ def main when /\A-j(\d+)?/ BT.wn = $1.to_i true - when /\A--timeout=(\d+(?:_\d+)*(?:\.\d+(?:_\d+)*)?)/ + when /\A--timeout=(\d+(?:_\d+)*(?:\.\d+(?:_\d+)*)?)(?::(\d+(?:_\d+)*(?:\.\d+(?:_\d+)*)?))?/ BT.timeout = $1.to_f + BT.timeout_scale = $2.to_f if defined?($2) true when /\A(-v|--v(erbose))\z/ BT.verbose = true @@ -533,6 +540,7 @@ class Assertion < Struct.new(:src, :path, :lineno, :proc) def get_result_string(opt = '', timeout: BT.timeout, **argh) if BT.ruby + timeout = BT.apply_timeout_scale(timeout) filename = make_srcfile(**argh) begin kw = self.err ? {err: self.err} : {} @@ -627,6 +635,7 @@ end def assert_normal_exit(testsrc, *rest, timeout: BT.timeout, **opt) add_assertion testsrc, -> as do + timeout = BT.apply_timeout_scale(timeout) message, ignore_signals = rest message ||= '' as.show_progress(message) { @@ -680,9 +689,7 @@ end def assert_finish(timeout_seconds, testsrc, message = '') add_assertion testsrc, -> as do - if defined?(RubyVM::RJIT) && RubyVM::RJIT.enabled? # for --jit-wait - timeout_seconds *= 3 - end + timeout_seconds = BT.apply_timeout_scale(timeout_seconds) as.show_progress(message) { faildesc = nil |