Skip to content

Commit 9c682d3

Browse files
committed
Set a default EnvUtil.timeout_scale for TruffleRuby to help avoid transient failures
1 parent a5e5fec commit 9c682d3

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

tool/lib/envutil.rb

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,14 @@ 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+
5159
def capture_global_values
5260
@original_internal_encoding = Encoding.default_internal
5361
@original_external_encoding = Encoding.default_external

0 commit comments

Comments
 (0)