Skip to content

Loading…

could not run performance test #4938

Closed
joneslee85 opened this Issue · 18 comments
@joneslee85
$ 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'
@jasonnoble

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
map!'
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
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:891:in
_run'
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
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:27:in
run_once'
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)
jasonn@ruby-rules:~/source/issue_4938$

@seanmoon

having same issue on rails 3.2.0 and 1.9.3-p0

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

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

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

@jasperkennis

I can confirm adding 'test-unit' fixes this issue in Rails 3.2.6 on Ruby 1.9.3.

@dreki

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
@schneems
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' http://guides.rubyonrails.org/performance_testing.html#using-ruby-prof-on-mri-and-ree

@carlosantoniodasilva
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 referenced this issue
Commit has since been removed from the repository and is no longer available.
@route route referenced this issue
Commit has since been removed from the repository and is no longer available.
@route route referenced this issue
Commit has since been removed from the repository and is no longer available.
@route route added a commit to route/rails that referenced this issue
@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.
91d4a58
@parndt

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

@steveklabnik
Ruby on Rails member

Yes, performance tests were extracted: https://github.com/rails/rails-perftest

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

@teamon

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

@schneems
Ruby on Rails member

@teamon, Y U NO submit documentation pull request?

@teamon

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

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

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

@gerryster gerryster referenced this issue
Commit has since been removed from the repository and is no longer available.
@gerryster gerryster referenced this issue
Commit has since been removed from the repository and is no longer available.
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.