Skip to content

could not run performance test #4938

joneslee85 opened this Issue Feb 8, 2012 · 18 comments
$ 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
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:207:in
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:891:in
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:21:in
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:27:in
from /Users/jasonn/.rvm/rubies/ruby-1.9.3-p125/lib/ruby/1.9.1/test/unit.rb:325:in `block in autorun'
rake aborted!
Command failed with status (1): [/Users/jasonn/.rvm/rubies/ruby-1.9.3-p125/...]

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

Ruby on Rails member

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.

sriedel commented Apr 28, 2012

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.

jmstacey commented Jun 6, 2012

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.

dreki commented Jul 16, 2012

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
Ruby on Rails member

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'

Ruby on Rails member

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.

@route route added a commit to route/rails that referenced this issue Sep 8, 2012
@route route #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.
parndt commented Jan 28, 2013

Did this ever get solved? I see on the PR that this stuff was moved to another repo?

Ruby on Rails member

Yes, performance tests were extracted:

If this is still an issue, please open something on that repo.

teamon commented Mar 6, 2013

@steveklabnik Why there is no single reference to rails-perftest in guides?

Ruby on Rails member
schneems commented Mar 6, 2013

@teamon, Y U NO submit documentation pull request?

teamon commented Mar 6, 2013

I would have to know a working solution for rails 3.x, no luck so far, everything I try is broken.

Ruby on Rails member

@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.

teamon commented Mar 6, 2013

@steveklabnik Can you point me to any reference about using performance testing/profiler with rails?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.