From c4e794f2901a7099cd2babee9c252c52c5beb09d Mon Sep 17 00:00:00 2001 From: Takashi Kokubun Date: Wed, 20 Aug 2025 14:49:26 -0700 Subject: [PATCH] Fix LoadError and warnings for fiddle --- harness/harness-common.rb | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/harness/harness-common.rb b/harness/harness-common.rb index ce55799c..f98da460 100644 --- a/harness/harness-common.rb +++ b/harness/harness-common.rb @@ -71,10 +71,20 @@ def is_macos def get_maxrss unless $LOAD_PATH.resolve_feature_path("fiddle") - gem "fiddle", ">= 1.1.8" # For ruby 3.5.0-dev compatibility + # In Ruby 3.5+, fiddle is no longer a default gem. Load the bundled-gem fiddle instead. + if defined?(Bundler) # benchmarks with Gemfile + bundler_ui_level, Bundler.ui.level = Bundler.ui.level, :error if defined?(Bundler) # suppress warnings from force_activate + Gem::BUNDLED_GEMS.force_activate("fiddle") + Bundler.ui.level = bundler_ui_level if bundler_ui_level + else # benchmarks without Gemfile + gem "fiddle", ">= 1.1.8" + end end - + # Suppress a warning for Ruby 3.4+ on benchmarks with Gemfile + verbose, $VERBOSE = $VERBOSE, nil require 'fiddle' + $VERBOSE = verbose + require 'rbconfig/sizeof' unless Fiddle::SIZEOF_LONG == 8 and RbConfig::CONFIG["host_os"] =~ /linux|darwin/