rspec always return 1 when executed through DRb server #641

Closed
os97673 opened this Issue Jul 2, 2012 · 9 comments

Projects

None yet

3 participants

@os97673

When I run rspec w/o Spork its's exit code behaves as expected (0 - passed, 1 - failed, and honor --failure-exit-code), but when I run tests using Spork it always exits with code 1.
It looks like the cause of the problem is in RSpec::Core::DRbCommandLine.run() which always returns result of spec_server.run(@options.drb_argv, err, out) which is IO and it looks like it is converted to 1 :(

@justinko

I tested this extensively when trying to reproduce this issue: #640

If you can provide a failing test case, please report back here and I'll re-open. Thanks.

@justinko justinko closed this Jul 3, 2012
@os97673

Gemfile

source "https://rubygems.org"

gem "rspec"
gem 'spork'

spec/test_spec.rb

require 'spec_helper'

describe "simple rspec test" do
  it "should just pass" do
  end
end

spec_helper.rb

require 'rubygems'
require 'spork'

Spork.prefork do
end

Spork.each_run do
end

require 'rspec'

I use ruby 1.8.7p358 on Windows (it is important, since on linux rspec does return 0)

rspec --drb spec
.

Finished in 0.008 seconds
1 example, 0 failures
  <-- Slave(1) run done!

echo %errorlevel%
1

Let me know if you need more information.

@justinko justinko reopened this Jul 5, 2012
@alindeman

@os97673, are you able to take a stab at fixing this? I have no Windows development environment that I can use; like you said, I can't reproduce it in Linux.

@os97673

@alindeman,

well, I think I can try :)

@alindeman

Thanks :D

@alindeman

Any news, @os97673?

@os97673

@alindeman,

sorry for delay, all "back to school" activities eat almost all my free time recently.
Finally I've got some time to investigate the problem.
It looks like the cause of the problem is in Spork. On Windows (and for JRuby) it uses Spork::RunStrategy::Magazine strategy while on Linux Spork::RunStrategy::Forking is used. And the actual result is lost somewhere between Magazine and MagazineSlave. Also, during investigation I've noticed that this strategy doesn't work with ruby 1.9.3.
Thus I'd say there is nothing rspec can fix itself, but Spork should be fixed instead (feel free to close the ticket).
I'm going to file ticket about the problem against Spork and will add link to it here.

@os97673

I've filed sporkrb/spork#210 about this problem.

@alindeman

Thanks so much @os97673. I'll close this issue and follow the sporkrb one.

@alindeman alindeman closed this Sep 23, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment