Skip to content

Commit 27af831

Browse files
committed
Fix timeout_scale= call to use the correct receiver
* See ruby/test-unit-ruby-core#23
1 parent 509b0e4 commit 27af831

1 file changed

Lines changed: 8 additions & 8 deletions

File tree

tool/lib/envutil.rb

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -48,14 +48,6 @@ class << self
4848
attr_reader :original_internal_encoding, :original_external_encoding,
4949
:original_verbose, :original_warning
5050

51-
if RUBY_ENGINE == "truffleruby"
52-
# Tests relying on timeout have high variance on TruffleRuby due to the highly-optimizing JIT, deoptimization, profiling interpreter, different GC, etc.
53-
# Setting a default timeout scale helps avoid transient failures for tests relying on timeouts.
54-
# We choose 10 because it is the same number used in CRuby CI on macOS:
55-
# https://github.com/ruby/ruby/blob/9d46b0c735877f152a0b4b16b8153c6f395dee28/.github/workflows/macos.yml#L133
56-
self.timeout_scale = 10
57-
end
58-
5951
def capture_global_values
6052
@original_internal_encoding = Encoding.default_internal
6153
@original_external_encoding = Encoding.default_external
@@ -71,6 +63,14 @@ def capture_global_values
7163
end
7264
end
7365

66+
if RUBY_ENGINE == "truffleruby"
67+
# Tests relying on timeout have high variance on TruffleRuby due to the highly-optimizing JIT, deoptimization, profiling interpreter, different GC, etc.
68+
# Setting a default timeout scale helps avoid transient failures for tests relying on timeouts.
69+
# We choose 10 because it is the same number used in CRuby CI on macOS:
70+
# https://github.com/ruby/ruby/blob/9d46b0c735877f152a0b4b16b8153c6f395dee28/.github/workflows/macos.yml#L133
71+
self.timeout_scale = 10
72+
end
73+
7474
def apply_timeout_scale(t)
7575
if scale = EnvUtil.timeout_scale
7676
t * scale

0 commit comments

Comments
 (0)