[前][次][番号順一覧][スレッド一覧]

ruby-changes:25797

From: ko1 <ko1@a...>
Date: Mon, 26 Nov 2012 18:19:11 +0900 (JST)
Subject: [ruby-changes:25797] ko1:r37854 (trunk): * benchmark/driver.rb: accept multiple `-e'.

ko1	2012-11-26 18:19:00 +0900 (Mon, 26 Nov 2012)

  New Revision: 37854

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=37854

  Log:
    * benchmark/driver.rb: accept multiple `-e'.
      You don't need to use `;' separation character.
      [ruby-core:50139] [ruby-trunk - Bug #7380]

  Modified files:
    trunk/ChangeLog
    trunk/benchmark/driver.rb

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 37853)
+++ ChangeLog	(revision 37854)
@@ -1,3 +1,9 @@
+Mon Nov 26 18:15:47 2012  Koichi Sasada  <ko1@a...>
+
+	* 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@g...>
 
 	* string.c (rb_str_enumerate_chars, rb_str_enumerate_codepoints)
Index: benchmark/driver.rb
===================================================================
--- benchmark/driver.rb	(revision 37853)
+++ benchmark/driver.rb	(revision 37854)
@@ -60,13 +60,14 @@
 
       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 @@
     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 @@
 
 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 @@
 
   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

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]