Permalink
Browse files

#4938 Fix launching performance tests

When we run `rake test:benchmark` for performance tests it raises
ArgumentError that file --benchmark not found. It happens because
gem 'test-unit' passes remaining options to the tests, whereas mintest
doesn't do it.
  • Loading branch information...
route committed Aug 22, 2012
1 parent f415475 commit 91d4a5860bc35bec0862a1431d0dfc50b2bec2e7
@@ -17,7 +17,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 }
@@ -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],
@@ -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],
@@ -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,
@@ -2,9 +2,7 @@
require 'rails/test_help'
require 'rails/performance_test_help'
-ARGV.push('--benchmark') # HAX
require 'active_support/testing/performance'
-ARGV.pop
def options
options = {}
@@ -126,7 +126,7 @@ namespace :test do
Rails::SubTestTask.new(:benchmark => 'test:prepare') do |t|
t.libs << 'test'
t.pattern = 'test/performance/**/*_test.rb'
- t.options = '-- --benchmark'
+ ENV["BENCHMARK_TESTS"] = '1'
end
Rails::SubTestTask.new(:profile => 'test:prepare') do |t|

0 comments on commit 91d4a58

Please sign in to comment.