[Ironruby-core] Debugging rubyspecs

Shri Borde Shri.Borde at microsoft.com
Wed Feb 25 16:32:56 EST 2009

I checked a bit, and I don't have a RUBY_EXE environment variable, or a %HOME%\.mspecrc file. Peter, did you use "-B /path/to/default.mspec" in the ir.exe command-line, and does it set :target? I do have both of these, and maybe that is why it works for me.

If mspec-debug.rb works for you, sure, you should add a note on the wiki about it. I would be fine with using either a default.mspec (which already exists) or a mspec-debug.rb.


From: ironruby-core-bounces at rubyforge.org [mailto:ironruby-core-bounces at rubyforge.org] On Behalf Of Pete Bacon Darwin
Sent: Tuesday, February 24, 2009 3:11 AM
To: ironruby-core at rubyforge.org
Subject: Re: [Ironruby-core] Debugging rubyspecs

OK, this is what I mean.  I save the following file (attached also) as Merlin/Main/Languages/Ruby/mspec-debug.rb:

RUBY_EXE = 'd:/dev/ruby/ironruby/current/Merlin/Main/Bin/debug/ir.exe'

$:.unshift 'd:/dev/ruby/mspec/lib'

require 'mspec/commands/mspec-run'
require 'mspec'

class MSpecScript
  set :target, RUBY_EXE
  set :flags, [ ' -D']
  set :ci_files, ["rubyspec/1.8/core",]
  set :tags_patterns, [
    [%r(rubyspec/), 'ironruby-tags/'],
    [/_spec.rb$/, '_tags.txt']


Once you have modified the paths for your setup, you can then run this file just like mspec-run:

/path/to/ir.exe mspec-debug.rb /path/to/rubyspec/some_spec.rb

In the VS Ruby.Console project properties I set the following:

Start Action: Start Project
Start Options:
       Command Line Options: -D mspec-debug.rb -V d:/dev/ruby/rubyspec/core/fixnum/abs_spec.rb
       Working Directory: D:\dev\ruby\ironruby\current\Merlin\Main\Languages\Ruby\

Then I can set breakpoints in the C# code to debug and so on.

This solution is self contained, doesn't require any environment variables, doesn't spawn any sub processes and doesn't rely on mspec guessing the ruby engine.  I personally don't feel that it uses too much of the internals of mspec: the configuration bits are public interfaces to mspec and all we are doing is including a couple of files (that are unlikely to change name) and running a single class method.

Let me know what you think.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://rubyforge.org/pipermail/ironruby-core/attachments/20090225/1f030420/attachment.html>

More information about the Ironruby-core mailing list