@@ -53,42 +53,17 @@ def run
5353
5454 puts ( "Running benchmark \" #{ bench_name } \" (#{ idx +1 } /#{ bench_files . length } )" )
5555
56- # Path to the benchmark runner script
57- script_path = File . join ( bench_dir , entry )
58-
59- if !script_path . end_with? ( '.rb' )
60- script_path = File . join ( script_path , 'benchmark.rb' )
61- end
62-
63- # Set up the environment for the benchmarking command
6456 result_json_path = File . join ( out_path , "temp#{ Process . pid } .json" )
65- ENV [ "RESULT_JSON_PATH" ] = result_json_path
66-
67- # Set up the benchmarking command
68- cmd = base_cmd
69-
70- # Fix for jruby/jruby#7394 in JRuby 9.4.2.0
71- script_path = File . expand_path ( script_path )
72-
73- cmd += [
74- *ruby ,
75- "-I" , harness ,
76- *pre_init ,
77- script_path ,
78- ] . compact
79-
80- # Do the benchmarking
81- result = BenchmarkRunner . check_call ( cmd . shelljoin , env : benchmark_env , raise_error : false )
57+ result = run_single_benchmark ( bench_dir , entry , result_json_path )
8258
8359 if result [ :success ]
8460 bench_data [ bench_name ] = JSON . parse ( File . read ( result_json_path ) ) . tap do |json |
85- json [ "command_line" ] = cmd . shelljoin
61+ json [ "command_line" ] = result [ :command ]
8662 File . unlink ( result_json_path )
8763 end
8864 else
8965 bench_failures [ bench_name ] = result [ :status ] . exitstatus
9066 end
91-
9267 end
9368 end
9469
@@ -97,6 +72,34 @@ def run
9772
9873 private
9974
75+ def run_single_benchmark ( bench_dir , entry , result_json_path )
76+ # Path to the benchmark runner script
77+ script_path = File . join ( bench_dir , entry )
78+
79+ if !script_path . end_with? ( '.rb' )
80+ script_path = File . join ( script_path , 'benchmark.rb' )
81+ end
82+
83+ # Fix for jruby/jruby#7394 in JRuby 9.4.2.0
84+ script_path = File . expand_path ( script_path )
85+
86+ # Set up the environment for the benchmarking command
87+ ENV [ "RESULT_JSON_PATH" ] = result_json_path
88+
89+ # Set up the benchmarking command
90+ cmd = base_cmd + [
91+ *ruby ,
92+ "-I" , harness ,
93+ *pre_init ,
94+ script_path ,
95+ ] . compact
96+
97+ # Do the benchmarking
98+ result = BenchmarkRunner . check_call ( cmd . shelljoin , env : benchmark_env , raise_error : false )
99+ result [ :command ] = cmd . shelljoin
100+ result
101+ end
102+
100103 def benchmark_env
101104 @benchmark_env ||= begin
102105 # When the Ruby running this script is not the first Ruby in PATH, shell commands
0 commit comments