1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* benchmark/driver.rb: accept multiple `-e'.

You don't need to use `;' separation character.
  [ruby-core:50139] [ruby-trunk - Bug #7380]



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37854 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
ko1 2012-11-26 09:19:00 +00:00
parent 6746eecaf1
commit 2e87867a8f
2 changed files with 19 additions and 10 deletions

View file

@ -1,3 +1,9 @@
Mon Nov 26 18:15:47 2012 Koichi Sasada <ko1@atdot.net>
* benchmark/driver.rb: accept multiple `-e'.
You don't need to use `;' separation character.
[ruby-core:50139] [ruby-trunk - Bug #7380]
Mon Nov 26 17:10:04 2012 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
* string.c (rb_str_enumerate_chars, rb_str_enumerate_codepoints)

View file

@ -60,13 +60,14 @@ class BenchmarkDriver
if /(.+)::(.+)/ =~ e
# ex) ruby-a::/path/to/ruby-a
v = $1.strip
e = $2
label = $1.strip
path = $2
version = `#{path} -v`.chomp
else
v = `#{e} -v`.chomp
v.sub!(/ patchlevel \d+/, '')
path = e
version = label = `#{path} -v`.chomp
end
[e, v]
[path, label, version]
}.compact
@dir = dir
@ -86,8 +87,8 @@ class BenchmarkDriver
if @verbose
@start_time = Time.now
message @start_time
@execs.each_with_index{|(_, v), i|
message "target #{i}: #{v}"
@execs.each_with_index{|(path, label, version), i|
message "target #{i}: " + (label == version ? "#{label}" : "#{label} (#{version})") + " at #{path}"
}
end
end
@ -255,7 +256,7 @@ end
if __FILE__ == $0
opt = {
:execs => ['ruby'],
:execs => [],
:dir => File.dirname(__FILE__),
:repeat => 1,
:output => "bmlog-#{Time.now.strftime('%Y%m%d-%H%M%S')}.#{$$}",
@ -263,8 +264,10 @@ if __FILE__ == $0
parser = OptionParser.new{|o|
o.on('-e', '--executables [EXECS]',
"Specify benchmark one or more targets. (exec1;exec2;exec3;...)"){|e|
opt[:execs] = e.split(/;/)
"Specify benchmark one or more targets (e1::path1; e2::path2; e3::path3;...)"){|e|
e.split(/;/).each{|path|
opt[:execs] << path
}
}
o.on('-d', '--directory [DIRECTORY]', "Benchmark suites directory"){|d|
opt[:dir] = d