grosser / parallel_tests

Ruby: 2 CPUs = 2x Testing Speed for RSpec, Test::Unit and Cucumber
3.38k stars 493 forks source link

open3 output and RubyMine. #207

Closed Exoth closed 11 years ago

Exoth commented 11 years ago

Starting from version 0.11 parallel_tests uses open3 for Ruby >1.8 and makes output only when a process finishes its job.

Unfortunately it's incompatible with RubyMine RSpec test runner UI. So it would be great if there's an option to output in the old way, especially since the old output code is anyway there for Ruby 1.8.

grosser commented 11 years ago

Running parallel_tests from Rubymine sounds nice, can you turn that into a wiki page ? :)

When I run parallel_test/rspec it prints dot's one at a time, also the rubymine formatter prints one at a time got it to run via this:

RUBYLIB=/Users/mgrosser/.rvm/gems/ruby-1.9.3-p392/gems/bundler-1.3.4/lib:/Applications/RubyMine.app/rb/testing/patch/common:/Applications/RubyMine.app/rb/testing/patch/bdd parallel_rspec /Users/mgrosser/code/example/parallel_as_gem/spec/xxx_spec.rb --test-options '--require teamcity/spec/runner/formatter/teamcity/formatter --format Spec::Runner::Formatter::TeamcityFormatter --out xxx.log'

can you bundle open parallel_tests and change the open switch to use open -> see if that fixes it ?

Exoth commented 11 years ago

Actually for me parallel_tests run out of the box in RubyMine if I just enable Menu->Run->Edit configurations->Rake section->parallel:spec->Attach test runner UI for frameworks->RSpec

I'm not sure, what you mean by "change the open switch to use open ->". May be this:

If I change this

if RUBY_VERSION =~ /^1\.8/

to this:

if true

in version 0.11.3, then everything works as earlier. Though I can't say that earlier it worked perfectly (spec tree on the left side is buggy), but from 0.11.0 it just hangs with all ruby processes having 0% cpu load.

grosser commented 11 years ago

Ok, got it running and can confirm that open3 makes the output come all at once vs file by file...

grosser commented 11 years ago

Ok, found it, needed more flushing :) -> 0.11.4

Exoth commented 11 years ago

It doesn't hang anymore, but still somewhat sluggish. Can anything else be done to make it as fast as before?

grosser commented 11 years ago

If you open the gem locally (bundle open parallel_tests) and tweak it / add puts you might find out why it's sluggish

On Mon, May 20, 2013 at 9:13 AM, Exoth notifications@github.com wrote:

It doesn't hang anymore, but still somewhat sluggish. Can anything else be done to make it as fast as before?

— Reply to this email directly or view it on GitHubhttps://github.com/grosser/parallel_tests/issues/207#issuecomment-18156291 .

Exoth commented 11 years ago

It's because you removed flushing in commit 3f77794f949a54302ad7fdbc6173478358b5fc91

Now if I write it like this:

  def self.capture_output(out, silence)
    result = ""
    loop do
      begin
        read = out.readpartial(1000000) # read whatever chunk we can get
        result << read
        if !silence
          $stdout.print read
          $stdout.flush
        end
      end
    end rescue EOFError
    result
  end

then everything works nice

grosser commented 11 years ago

-> v0.13.2 !

Exoth commented 11 years ago

Now it works as fast as before, thanks.