$ rails new demo
$ cd demo
$ rake db:migrate
$ echo "gem 'ruby-prof'" >> Gemfile
$ bundle install
$ rake test:benchmark
/Users/macbookair/.rvm/rubies/ruby-1.9.3-p0-perf/lib/ruby/1.9.1/test/unit.rb:167:in `block in non_options': file not found: --benchmark (ArgumentError)
from /Users/macbookair/.rvm/rubies/ruby-1.9.3-p0-perf/lib/ruby/1.9.1/test/unit.rb:146:in `map!'
from /Users/macbookair/.rvm/rubies/ruby-1.9.3-p0-perf/lib/ruby/1.9.1/test/unit.rb:146:in `non_options'
from /Users/macbookair/.rvm/rubies/ruby-1.9.3-p0-perf/lib/ruby/1.9.1/test/unit.rb:207:in `non_options'
from /Users/macbookair/.rvm/rubies/ruby-1.9.3-p0-perf/lib/ruby/1.9.1/test/unit.rb:52:in `process_args'
from /Users/macbookair/.rvm/rubies/ruby-1.9.3-p0-perf/lib/ruby/1.9.1/minitest/unit.rb:891:in `_run'
from /Users/macbookair/.rvm/rubies/ruby-1.9.3-p0-perf/lib/ruby/1.9.1/minitest/unit.rb:884:in `run'
from /Users/macbookair/.rvm/rubies/ruby-1.9.3-p0-perf/lib/ruby/1.9.1/test/unit.rb:21:in `run'
from /Users/macbookair/.rvm/rubies/ruby-1.9.3-p0-perf/lib/ruby/1.9.1/test/unit.rb:326:in `block (2 levels) in autorun'
from /Users/macbookair/.rvm/rubies/ruby-1.9.3-p0-perf/lib/ruby/1.9.1/test/unit.rb:27:in `run_once'
from /Users/macbookair/.rvm/rubies/ruby-1.9.3-p0-perf/lib/ruby/1.9.1/test/unit.rb:325:in `block in autorun'
Confirmed with 1.9.3-p125 and rails 3.2.2.rc1.
jasonn@ruby-rules:~/source/issue_4938$ rake test:benchmark
/Users/jasonn/.rvm/rubies/ruby-1.9.3-p125/lib/ruby/1.9.1/test/unit.rb:167:in block in non_options': file not found: --benchmark (ArgumentError)
from /Users/jasonn/.rvm/rubies/ruby-1.9.3-p125/lib/ruby/1.9.1/test/unit.rb:146:in non_options'
from /Users/jasonn/.rvm/rubies/ruby-1.9.3-p125/lib/ruby/1.9.1/test/unit.rb:52:in process_args'
from /Users/jasonn/.rvm/rubies/ruby-1.9.3-p125/lib/ruby/1.9.1/minitest/unit.rb:884:in run'
from /Users/jasonn/.rvm/rubies/ruby-1.9.3-p125/lib/ruby/1.9.1/test/unit.rb:326:in block (2 levels) in autorun'
from /Users/jasonn/.rvm/rubies/ruby-1.9.3-p125/lib/ruby/1.9.1/test/unit.rb:325:in `block in autorun'
Command failed with status (1): [/Users/jasonn/.rvm/rubies/ruby-1.9.3-p125/...]
block in non_options': file not found: --benchmark (ArgumentError)
block (2 levels) in autorun'
Tasks: TOP => test:benchmark
(See full trace by running task with --trace)
having same issue on rails 3.2.0 and 1.9.3-p0
I was able to reproduce this issue some time ago, but didn't have time to look at it again. I'll give it a try in the following days. Thanks.
Looks like the --benchmark option in railsties-3.2.x/lib/rails/test_unit/testing.rake:129 is test_unit dependent and doesn't work with minitest. After I added test-unit to my test group in the Gemfile, this exact problem went away. (Rails 3.2.2, Ruby 1.9.3-p0, Test::Unit 2.4.8)
Caveat: I haven't checked if this has issues with rspec.
I was having this same problem and sriedel's solution of adding 'test-unit' fixes the problem, but this should probably work out of the box...
I can confirm adding 'test-unit' fixes this issue in Rails 3.2.6 on Ruby 1.9.3.
Worked for me as well. Mac OS X, ruby 1.9.3p194 (installed with homebrew), Rails 3.2.6.
Added these to my Gemfile in :test and :development:
gem 'ruby-prof', '~> 0.11.2' # For profiling
gem 'test-unit', '~> 2.5.1' # For profiling
Last comment 1 month ago. Any chance someone can dig into this issue and fix the root cause? If not we could add 'test-unit' to the docs in addition to 'ruby-prof' http://guides.rubyonrails.org/performance_testing.html#using-ruby-prof-on-mri-and-ree
I was unable to get back to it, but was able to reproduce. I still have this issue bookmarked to try again when I find some time, but if someone else wants to give it a try, please feel free, I'd be very happy to help as possible.
#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.
Did this ever get solved? I see on the PR that this stuff was moved to another repo?
Yes, performance tests were extracted: https://github.com/rails/rails-perftest
If this is still an issue, please open something on that repo.
@steveklabnik Why there is no single reference to rails-perftest in guides?
@teamon, Y U NO submit documentation pull request?
I would have to know a working solution for rails 3.x, no luck so far, everything I try is broken.
@teamon as @schneems said, but in a slightly less troll-y way: "because nobody's done it yet."
One of the reasons they were extracted is that they aren't really used by very many people, so that might be why docs are light.
@steveklabnik Can you point me to any reference about using performance testing/profiler with rails?