aboutsummaryrefslogtreecommitdiffstats
path: root/Library
diff options
context:
space:
mode:
authorJack Nagel2012-11-17 22:59:06 -0600
committerJack Nagel2012-11-17 22:59:06 -0600
commit37a1ab72375eeafe2f66c65f39f9395bc526f60e (patch)
tree7add49a04669148d6afb9a310c03565dcb7b0c89 /Library
parentd5ab941120fd60f5340595ba46055453d68b6e52 (diff)
downloadhomebrew-37a1ab72375eeafe2f66c65f39f9395bc526f60e.tar.bz2
tests: add profiling support
`rake profile` will run ruby-prof on the test suite if the ruby-prof gem is installed.
Diffstat (limited to 'Library')
-rw-r--r--Library/Homebrew/test/.gitignore1
-rw-r--r--Library/Homebrew/test/Rakefile20
2 files changed, 17 insertions, 4 deletions
diff --git a/Library/Homebrew/test/.gitignore b/Library/Homebrew/test/.gitignore
index 3b6ee585f..f5df6eb3a 100644
--- a/Library/Homebrew/test/.gitignore
+++ b/Library/Homebrew/test/.gitignore
@@ -1 +1,2 @@
/coverage
+/prof
diff --git a/Library/Homebrew/test/Rakefile b/Library/Homebrew/test/Rakefile
index c92b19640..1a9b26f92 100644
--- a/Library/Homebrew/test/Rakefile
+++ b/Library/Homebrew/test/Rakefile
@@ -3,14 +3,13 @@ require 'rake/testtask'
require 'pathname'
TEST_DIRECTORY = Pathname.new(File.expand_path(__FILE__)).parent.realpath
-
TEST_FILES = FileList["#{TEST_DIRECTORY}/test_*.rb"]
-Dir.chdir TEST_DIRECTORY
+Dir.chdir(TEST_DIRECTORY)
task :default => :test
-Rake::TestTask.new :test do |t|
+Rake::TestTask.new(:test) do |t|
t.libs << Dir.pwd
t.test_files = TEST_FILES
end
@@ -39,5 +38,18 @@ begin
t.output_dir = TEST_DIRECTORY+'coverage'
end
rescue LoadError
- nil
+end
+
+begin
+ require 'rubygems'
+ require 'ruby-prof/task'
+
+ RubyProf::ProfileTask.new do |t|
+ t.libs << Dir.pwd
+ t.test_files = TEST_FILES
+ t.output_dir = TEST_DIRECTORY+'prof'
+ t.printer = :graph_html
+ t.min_percent = 2
+ end
+rescue LoadError
end