exe/benchmark-driver in benchmark_driver-0.4.3 vs exe/benchmark-driver in benchmark_driver-0.4.4
- old
+ new
@@ -11,19 +11,19 @@
o.banner = "Usage: #{File.basename($0, '.*')} [options] [YAML]"
o.on('-e', '--executables [EXECS]', 'Ruby executables (e1::path1; e2::path2; e3::path3;...)') do |e|
options[:execs] ||= []
e.split(';').each do |name_path|
name, path = name_path.split('::', 2)
- options[:execs] << Benchmark::Driver::Configuration::Executable.new(name, path || name)
+ options[:execs] << Benchmark::Driver::Configuration::Executable.new(name, [path || name])
end
end
o.on('--rbenv [VERSIONS]', 'Ruby executables in rbenv (2.3.5;2.4.2;...)') do |r|
options[:execs] ||= []
r.split(';').each do |version|
path = `RBENV_VERSION='#{version}' rbenv which ruby`.rstrip
abort "Failed to execute 'rbenv which ruby'" unless $?.success?
- options[:execs] << Benchmark::Driver::Configuration::Executable.new(version, path)
+ options[:execs] << Benchmark::Driver::Configuration::Executable.new(version, [path])
end
end
o.on('-c', '--compare', 'Compare results (currently only supported in ips output)') do |v|
options[:compare] = v
end
@@ -36,10 +36,13 @@
end
o.on('--filter [REGEXP]', 'Filter out benchmarks with given regexp') do |v|
abort '--filter can be used only once' if options.key?(:filter)
options[:filter] = v
end
+ o.on('--bundler', 'Use gems specified in Gemfile (append -rbundler/setup)') do |v|
+ options[:bundler] = v
+ end
o.on('--dir', 'Override __dir__ from "/tmp" to actual directory of YAML') do |v|
options[:dir] = v
end
end.parse!(ARGV)
abort "No YAML file is specified" if args.empty?
@@ -55,20 +58,27 @@
$stderr.puts ' YAML format may be wrong. See error below:'
$stderr.puts
raise
end
+ # Proceed execs first for --bundler
+ if options.key?(:execs)
+ config.runner_options.executables = options.delete(:execs)
+ end
+
options.each do |key, value|
case key
+ when :bundler
+ config.runner_options.executables.each do |executable|
+ executable.command << '-rbundler/setup'
+ end
when :compare
config.output_options.compare = value
when :dir
dir = File.dirname(path)
config.jobs.each do |job|
job.prelude = "__dir__ = #{dir.dump}.freeze; #{job.prelude}"
end
- when :execs
- config.runner_options.executables = value
when :filter
filter = Regexp.compile(value)
config.jobs.select! do |job|
job.name.match(filter)
end