Spec::Rake::SpecTask failing under IronRuby 0.6

This problem has been solved.

Tried the same setup with regular Ruby, worked fine. It's unclear to me whether this is a problem internal to IronRuby or a configuration issue. Any input would be greatly appreciated.

Stacktrace below.


Execute spec (5s)
[01:20:55]: [Execute spec]
RuntimeError: Command C:/IronRuby/lib/IronRuby/../..//bin/ir.exe -I"C:/IronRuby/lib/ironruby/gems/1.8/gems/rspec-1.2.7/lib"  "C:/IronRuby/lib/ironruby/gems/1.8/gems/rspec-1.2.7/bin/spec" "my_spec.rb" --require 'teamcity/spec/runner/formatter/teamcity/formatter' --format Spec::Runner::Formatter::TeamcityFormatter:matrix failed

Stacktrace:
C:/IronRuby/lib/ironruby/gems/1.8/gems/rspec-1.2.7/lib/spec/rake/spectask.rb:16707566:in `define'
C:/IronRuby/lib/ironruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:1112:in `verbose'
C:/IronRuby/lib/ironruby/gems/1.8/gems/rspec-1.2.7/lib/spec/rake/spectask.rb:153:in `define'
C:/IronRuby/lib/ironruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:632:in `execute'
C:/IronRuby/lib/ironruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:631:in `execute'
C:/TeamCity/buildAgent/plugins/rake-runner/lib/rb/runner/rake_ext.rb:260:in `execute'
:0:in `call'
C:/TeamCity/buildAgent/plugins/rake-runner/lib/rb/runner/rake_ext.rb:90:in `target_exception_handling'
C:/TeamCity/buildAgent/plugins/rake-runner/lib/rb/runner/rake_ext.rb:263:in `execute'
:0:in `each'
C:/IronRuby/lib/ironruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:597:in `invoke_with_call_chain'
C:/IronRuby/lib/ruby/1.8/monitor.rb:242:in `mon_synchronize'
C:/IronRuby/lib/ironruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:590:in `invoke_with_call_chain'
C:/IronRuby/lib/ironruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:607:in `invoke_prerequisites'
C:/IronRuby/lib/ironruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:604:in `invoke_prerequisites'
C:/IronRuby/lib/ironruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:596:in `invoke_with_call_chain'
C:/IronRuby/lib/ruby/1.8/monitor.rb:242:in `mon_synchronize'
C:/IronRuby/lib/ironruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:590:in `invoke_with_call_chain'
C:/IronRuby/lib/ironruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:583:in `invoke'
C:/TeamCity/buildAgent/plugins/rake-runner/lib/rb/runner/rake_ext.rb:235:in `my_invoke_with_call_chain'
C:/TeamCity/buildAgent/plugins/rake-runner/lib/rb/runner/rake_ext.rb:90:in `target_exception_handling'
C:/TeamCity/buildAgent/plugins/rake-runner/lib/rb/runner/rake_ext.rb:234:in `my_invoke_with_call_chain'
:0:in `each'
C:/IronRuby/lib/ironruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2051:in `invoke_task'
C:/IronRuby/lib/ironruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2029:in `top_level'
C:/IronRuby/lib/ironruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2024:in `top_level'
C:/TeamCity/buildAgent/plugins/rake-runner/lib/rb/runner/rake_ext.rb:311:in `standard_exception_handling'
C:/IronRuby/lib/ironruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2023:in `top_level'
C:/IronRuby/lib/ironruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2001:in `run'
C:/TeamCity/buildAgent/plugins/rake-runner/lib/rb/runner/rake_ext.rb:311:in `standard_exception_handling'
C:/IronRuby/lib/ironruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:1998:in `run'
C:/TeamCity/buildAgent/plugins/rake-runner/lib/rb/runner/rake_ext.rb:179:in `run'
C:/TeamCity/buildAgent/plugins/rake-runner/lib/rb/runner/rakerunner.rb:40
:0:in `each'
[01:20:55]:
Rake aborted!

4 comments
Comment actions Permalink

Hello Michael,

Does rest part of build log contains any errors? Also could you try to run your spec rake tasks manually(on agent) from command line using IronRuby. Does it work without errors?

0
Comment actions Permalink

Update: It looks like spec.bat is broken under IronRuby. It can handle --require "path/to/file" with double-quotes, but not --require 'path/to/file' with single quotes.

I added this line to try to fix it in the meantime:

ENV['SPEC_OPTS'] = ENV['SPEC_OPTS'].gsub("'", '"')


Which at leasts runs the specs and shows me how many pass, but it always fails:

This is apparently because IronRuby's IO class doesn't have a 'reopen' method.

[14:50:55]: Checking for changes
[14:50:55]: Clean build enabled: removing old files from C:\TeamCity\buildAgent\work\7f9958ec3623d9ac
[14:50:55]: Clearing temporary directory: C:\TeamCity\buildAgent\temp\buildTmp
[14:50:55]: Checkout directory: C:\TeamCity\buildAgent\work\7f9958ec3623d9ac
[14:50:55]: Updating sources
[14:50:55]:
[Updating sources] Will perform clean checkout
[14:50:55]: [Updating sources] Clean checkout reasons
[14:50:55]:
[Clean checkout reasons] Checkout directory is empty or doesn't exist
[14:50:55]: [Clean checkout reasons] "Clean all files before build" turned on
[14:50:55]: [Updating sources] Transferring cached clean patch for VCS root: My Root
[14:50:55]: [Updating sources] Building incremental patch over the cached patch
[14:50:55]: [Updating sources] Repository sources transferred
[14:50:55]: [Updating sources] Removing C:\TeamCity\buildAgent\work\7f9958ec3623d9ac
[14:50:55]: [Updating sources] Updating C:\TeamCity\buildAgent\work\7f9958ec3623d9ac
[14:51:07]: Starting build process in C:\TeamCity\buildAgent\work\7f9958ec3623d9ac
[14:51:07]: C:\IronRuby\bin\ir.exe C:\TeamCity\buildAgent\plugins\rake-runner\lib\rb\runner\rakerunner.rb ci:teamcity "SPEC_OPTS=--require 'teamcity/spec/runner/formatter/teamcity/formatter' --format Spec::Runner::Formatter::TeamcityFormatter:matrix"
[14:51:19]: (in C:/TeamCity/buildAgent/work/7f9958ec3623d9ac)
[14:51:19]: Execute build
[14:51:19]:
[Execute build] building...
[14:51:19]: Execute spec (12s)
[14:51:30]: [Execute spec] Starting.. (3 examples)
[14:51:31]: [Execute spec] this guy
[14:51:31]:
[this guy] does other stuff
[14:51:31]:
[this guy] does more stuff
[14:51:31]:
[Execute spec] some other thing
[14:51:31]:
[some other thing] does some more stuff
[14:51:31]:
[some other thing] RuntimeError: Command C:/IronRuby/lib/IronRuby/../..//bin/ir.exe -I"C:/IronRuby/lib/ironruby/gems/1.8/gems/rspec-1.2.7/lib"  "C:/IronRuby/lib/ironruby/gems/1.8/gems/rspec-1.2.7/bin/spec" "another_spec.rb" "my_spec.rb" --require "teamcity/spec/runner/formatter/teamcity/formatter" --format Spec::Runner::Formatter::TeamcityFormatter:matrix failed Stacktrace: C:/IronRuby/lib/ironruby/gems/1.8/gems/rspec-1.2.7/lib/spec/rake/spectask.rb:16707566:in `define' C:/IronRuby/lib/ironruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:1112:in `verbose' C:/IronRuby/lib/ironruby/gems/1.8/gems/rspec-1.2.7/lib/spec/rake/spectask.rb:153:in `define' C:/IronRuby/lib/ironruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:632:in `execute' C:/IronRuby/lib/ironruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:631:in `execute' C:/TeamCity/buildAgent/plugins/rake-runner/lib/rb/runner/rake_ext.rb:260:in `execute' :in `call' C:/TeamCity/buildAgent/plugins/rake-runner/lib/rb/runner/rake_ext.rb:90:in `target_exception_handling' C:/TeamCity/buildAgent/plugins/rake-runner/lib/rb/runner/rake_ext.rb:263:in `execute' :in `each' C:/IronRuby/lib/ironruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:597:in `invoke_with_call_chain' C:/IronRuby/lib/ruby/1.8/monitor.rb:242:in `mon_synchronize' C:/IronRuby/lib/ironruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:590:in `invoke_with_call_chain' C:/IronRuby/lib/ironruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:607:in `invoke_prerequisites' C:/IronRuby/lib/ironruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:604:in `invoke_prerequisites' C:/IronRuby/lib/ironruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:596:in `invoke_with_call_chain' C:/IronRuby/lib/ruby/1.8/monitor.rb:242:in `mon_synchronize' C:/IronRuby/lib/ironruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:590:in `invoke_with_call_chain' C:/IronRuby/lib/ironruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:583:in `invoke' C:/TeamCity/buildAgent/plugins/rake-runner/lib/rb/runner/rake_ext.rb:235:in `my_invoke_with_call_chain' C:/TeamCity/buildAgent/plugins/rake-runner/lib/rb/runner/rake_ext.rb:90:in `target_exception_handling' C:/TeamCity/buildAgent/plugins/rake-runner/lib/rb/runner/rake_ext.rb:234:in `my_invoke_with_call_chain' :in `each' C:/IronRuby/lib/ironruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2051:in `invoke_task' C:/IronRuby/lib/ironruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2029:in `top_level' C:/IronRuby/lib/ironruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2024:in `top_level' C:/TeamCity/buildAgent/plugins/rake-runner/lib/rb/runner/rake_ext.rb:311:in `standard_exception_handling' C:/IronRuby/lib/ironruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2023:in `top_level' C:/IronRuby/lib/ironruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2001:in `run' C:/TeamCity/buildAgent/plugins/rake-runner/lib/rb/runner/rake_ext.rb:311:in `standard_exception_handling' C:/IronRuby/lib/ironruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:1998:in `run' C:/TeamCity/buildAgent/plugins/rake-runner/lib/rb/runner/rake_ext.rb:179:in `run' C:/TeamCity/buildAgent/plugins/rake-runner/lib/rb/runner/rakerunner.rb:40 :in `each'
[14:51:31]: Rake aborted!
[14:51:31]: Process exit code: 1
[14:51:31]: Build finished


Attachment(s):
ir_log.txt
ruby_ir.diff
rubyfail.txt
irfail.txt
0
Comment actions Permalink

I've come up with a tentative solution, which I'll post here for the good of future generations.

1.)
Because 'spec' under IronRuby can handle double double-quotes but not single-quotes, you need to put this at the top of your rakefile:

ENV['SPEC_OPTS'] = ENV['SPEC_OPTS'].gsub("'", '"')

2.)
Because the current version of IronRuby (0.6) doesn't have IO#reopen, you need to at least define an empty method for it. Commit this file (which I call reopen_hack.rb) to a place that 'spec' can see. I just threw it in the root, but another place is probably better for organization's sake.

# reopen_hack.rb
class IO
  def reopen(*args)
  end
end




3.)
Require this file in your SPEC_OPTS, in your Build Configuration, under Runner: Rake -> Test Parameters

--require 'reopen_hack'



4.)
Add C:\TeamCity\buildAgent\plugins\rake-runner\lib\rb\patch to your RUBYLIB environment variable.

This should give you everything you need to use IronRuby with TeamCity for the time being, at least until a real solution comes along.

0
Comment actions Permalink

Michael,

Thank you for the workaround.

2.)
Because the current version of IronRuby (0.6) doesn't have IO#reopen, you need to at least define an empty method for it. Commit this file (which I call reopen_hack.rb) to a place that 'spec' can see. I just threw it in the root, but another place is probably better for organization's sake.

# reopen_hack.rb
class IO
  def reopen(*args)
  end
end

I'll take a look on Rake runner sources, in Teamcity 4.5.4 we doesn't need to reopen IO.

4.)
Add C:\TeamCity\buildAgent\plugins\rake-runner\lib\rb\patch to your RUBYLIB environment variable.



 

This isn't required because Rake-runner plugin for TeamCity patches RUBYLIB before running rake script.

0

Please sign in to leave a comment.