Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions lib/envutil.rb
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,14 @@ class << self
attr_reader :original_internal_encoding, :original_external_encoding,
:original_verbose, :original_warning

if RUBY_ENGINE == "truffleruby"
# Tests relying on timeout have high variance on TruffleRuby due to the highly-optimizing JIT, deoptimization, profiling interpreter, different GC, etc.
# Setting a default timeout scale helps avoid transient failures for tests relying on timeouts.
# We choose 10 because it is the same number used in CRuby CI on macOS:
# https://github.com/ruby/ruby/blob/9d46b0c735877f152a0b4b16b8153c6f395dee28/.github/workflows/macos.yml#L133
self.timeout_scale = 10
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
self.timeout_scale = 10
@timeout_scale = 10

Alternatively, call self.timeout_scale = 10 in the regular class body (outside the singleton class body). :)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Or EnvUtil.timeout_scale = 10.

end

def capture_global_values
@original_internal_encoding = Encoding.default_internal
@original_external_encoding = Encoding.default_external
Expand Down