@@ -43,6 +43,9 @@ def run(ruby:, ruby_description:)
4343 env = benchmark_env ( ruby )
4444 caller_json_path = ENV [ "RESULT_JSON_PATH" ]
4545
46+ # Capture quiet setting before entering unbundled env (which clears ENV)
47+ quiet = ENV [ 'BENCHMARK_QUIET' ] == '1'
48+
4649 benchmark_entries . each_with_index do |entry , idx |
4750 puts ( "Running benchmark \" #{ entry . name } \" (#{ idx +1 } /#{ benchmark_entries . length } )" )
4851
@@ -54,10 +57,10 @@ def run(ruby:, ruby_description:)
5457 # This is important when running tests under `bundle exec rake test`.
5558 result = if defined? ( Bundler )
5659 Bundler . with_unbundled_env do
57- run_single_benchmark ( entry . script_path , result_json_path , ruby , cmd_prefix , env , entry . name )
60+ run_single_benchmark ( entry . script_path , result_json_path , ruby , cmd_prefix , env , entry . name , quiet : quiet )
5861 end
5962 else
60- run_single_benchmark ( entry . script_path , result_json_path , ruby , cmd_prefix , env , entry . name )
63+ run_single_benchmark ( entry . script_path , result_json_path , ruby , cmd_prefix , env , entry . name , quiet : quiet )
6164 end
6265
6366 if result [ :success ]
@@ -130,7 +133,7 @@ def filter_entries(entries, categories:, name_filters:, excludes:, directory_map
130133 entries . select { |entry | filter . match? ( entry . name ) }
131134 end
132135
133- def run_single_benchmark ( script_path , result_json_path , ruby , cmd_prefix , env , benchmark_name )
136+ def run_single_benchmark ( script_path , result_json_path , ruby , cmd_prefix , env , benchmark_name , quiet : false )
134137 # Fix for jruby/jruby#7394 in JRuby 9.4.2.0
135138 script_path = File . expand_path ( script_path )
136139
@@ -151,7 +154,7 @@ def run_single_benchmark(script_path, result_json_path, ruby, cmd_prefix, env, b
151154 ] . compact
152155
153156 # Do the benchmarking
154- result = BenchmarkRunner . check_call ( cmd . shelljoin , env : env , raise_error : false )
157+ result = BenchmarkRunner . check_call ( cmd . shelljoin , env : env , raise_error : false , quiet : quiet )
155158 result [ :command ] = cmd . shelljoin
156159 result
157160 ensure
@@ -187,6 +190,12 @@ def benchmark_env(ruby)
187190 end
188191 end
189192
193+ # Pass benchmark configuration env vars to subprocess.
194+ # These may be set after bundler loads, so they'd be lost with with_unbundled_env.
195+ [ "WARMUP_ITRS" , "MIN_BENCH_ITRS" , "MIN_BENCH_TIME" , "YJIT_BENCH_STATS" , "ZJIT_BENCH_STATS" ] . each do |var |
196+ env [ var ] = ENV [ var ] if ENV . key? ( var )
197+ end
198+
190199 env
191200 end
192201
0 commit comments