Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Added trace command to compare number of methods run

[git-p4: depot-paths = "//src/minitest_bench/dev/": change = 6797]
  • Loading branch information...
commit 2bf8791526966cb1c87bec354055cca1730b8ca9 1 parent c46a79c
Ryan Davis authored December 08, 2011

Showing 1 changed file with 34 additions and 0 deletions. Show diff stats Hide diff stats

  1. 34  Rakefile
34  Rakefile
@@ -73,6 +73,14 @@ task :startup => :generate do
73 73
   end
74 74
 end
75 75
 
  76
+task :trace => :generate do
  77
+  Dir["test/*positive_1.*"].each do |path|
  78
+    framework, type, size = test_type path
  79
+    $stderr.puts framework
  80
+    system trace_cmd(path)
  81
+  end
  82
+end
  83
+
76 84
 Gem.find_files("minitest/bench/*.rb").each do |path|
77 85
   require path
78 86
 end
@@ -245,6 +253,32 @@ def run_cmd path, out = "/dev/null"
245 253
   "X=1 time #{cmd} #{path} &> #{out}; true"
246 254
 end
247 255
 
  256
+def trace_cmd path
  257
+  framework, type, size = test_type path
  258
+
  259
+  out = "trace/#{framework}_trace.txt"
  260
+
  261
+  cmd = case framework
  262
+        when "minitestunit", "minitestspec", "testunit2", "shoulda" then
  263
+          "ruby -rubygems -rtracer"
  264
+        when "testunit1" then
  265
+          "ruby -rubygems -rtracer"
  266
+        when "rspec1" then
  267
+          "ruby -rtracer -S spec"
  268
+        when "rspec" then
  269
+          "ruby -rtracer -S rspec"
  270
+        when "bacon" then
  271
+          "ruby -rtracer -S bacon"
  272
+        when "cucumber" then
  273
+          "ruby -rtracer -S cucumber --no-color -f progress --require test/cucumber.rb"
  274
+        else
  275
+          raise "unknown framework: #{framework.inspect}"
  276
+        end
  277
+
  278
+  "X=1 time #{cmd} #{path} 2>&1 > #{out}; true"
  279
+  "X=1 time #{cmd} #{path} 2>&1 | grep -v rubygems > #{out}; true"
  280
+end
  281
+
248 282
 def run_test t
249 283
   out  = t.name
250 284
   path = t.prerequisites.first

0 notes on commit 2bf8791

Please sign in to comment.
Something went wrong with that request. Please try again.