Skip to content
Browse files

Backport rails/rails-perftest#2 to fix rake test:benchmark

  • Loading branch information...
1 parent 63d4894 commit 1db54d7d01ea36a9d8c0c6276d66d04a9a6c2fac @senny senny committed
View
2 activesupport/lib/active_support/testing/performance.rb
@@ -23,7 +23,7 @@ module Performance
# each implementation should define metrics and freeze the defaults
DEFAULTS =
- if ARGV.include?('--benchmark') # HAX for rake test
+ if ENV["BENCHMARK_TESTS"]
{ :runs => 4,
:output => 'tmp/performance',
:benchmark => true }
View
2 activesupport/lib/active_support/testing/performance/jruby.rb
@@ -6,7 +6,7 @@ module ActiveSupport
module Testing
module Performance
DEFAULTS.merge!(
- if ARGV.include?('--benchmark')
+ if ENV["BENCHMARK_TESTS"]
{:metrics => [:wall_time, :user_time, :memory, :gc_runs, :gc_time]}
else
{ :metrics => [:wall_time],
View
2 activesupport/lib/active_support/testing/performance/rubinius.rb
@@ -4,7 +4,7 @@ module ActiveSupport
module Testing
module Performance
DEFAULTS.merge!(
- if ARGV.include?('--benchmark')
+ if ENV["BENCHMARK_TESTS"]
{:metrics => [:wall_time, :memory, :objects, :gc_runs, :gc_time]}
else
{ :metrics => [:wall_time],
View
2 activesupport/lib/active_support/testing/performance/ruby.rb
@@ -9,7 +9,7 @@ module ActiveSupport
module Testing
module Performance
DEFAULTS.merge!(
- if ARGV.include?('--benchmark')
+ if ENV["BENCHMARK_TESTS"]
{ :metrics => [:wall_time, :memory, :objects, :gc_runs, :gc_time] }
else
{ :min_percent => 0.01,
View
5 railties/CHANGELOG.md
@@ -21,6 +21,11 @@
* No changes.
+* Fix launching performance tests through rake `test:benchmark`.
+ Fixes #4938.
+ Backport rails/rails-perftest#2.
+
+ *Dmitry Vorotilin + Yves Senn*
## Rails 3.2.11 (Jan 8, 2013) ##
View
3 railties/lib/rails/commands/benchmarker.rb
@@ -2,9 +2,8 @@
require 'rails/test_help'
require 'rails/performance_test_help'
-ARGV.push('--benchmark') # HAX
+ENV["BENCHMARK_TESTS"] = '1'
require 'active_support/testing/performance'
-ARGV.pop
def options
options = {}
View
7 railties/lib/rails/test_unit/testing.rake
@@ -123,10 +123,13 @@ namespace :test do
t.pattern = 'test/integration/**/*_test.rb'
end
- Rails::SubTestTask.new(:benchmark => 'test:prepare') do |t|
+ task 'test:benchmark_mode' do
+ ENV["BENCHMARK_TESTS"] = '1'
+ end
+
+ Rails::SubTestTask.new(:benchmark => ['test:prepare', 'test:benchmark_mode']) do |t|
t.libs << 'test'
t.pattern = 'test/performance/**/*_test.rb'
- t.options = '-- --benchmark'
end
Rails::SubTestTask.new(:profile => 'test:prepare') do |t|

0 comments on commit 1db54d7

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