#4938 Fix launching performance tests #7416

Closed
wants to merge 1 commit into
from
@@ -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|