[Ironruby-core] Debugging rubyspecs
Shri Borde
Shri.Borde at microsoft.com
Thu Feb 26 02:08:55 EST 2009
I am not sure how to describe our version of mspec. I don't see any version number in the mspec folder. Jim should confirm, but it must be the one from http://github.com/ironruby/mspec/tree/master.
Btw, Jim is looking to make it easier to run mspec by adding a .mspecrc file and some other utility commands. Lets see if that clears this up...
From: ironruby-core-bounces at rubyforge.org [mailto:ironruby-core-bounces at rubyforge.org] On Behalf Of Pete Bacon Darwin
Sent: Wednesday, February 25, 2009 8:31 PM
To: ironruby-core at rubyforge.org
Subject: Re: [Ironruby-core] Debugging rubyspecs
Hi Shri,
I tried just using the -B option with this information inside my default.mspec file but in my install of mspec, the default.mspec never gets loaded as the ruby_exe.rb is required before the mspec.default file and it blows up inside ruby_exe.rb. The reason that mspec-debug.rb works is that the RUBY_EXE constant is defined before mspec and therefore ruby_exe are required.
What version of mspec are you running?
Pete
From: ironruby-core-bounces at rubyforge.org [mailto:ironruby-core-bounces at rubyforge.org] On Behalf Of Shri Borde
Sent: Wednesday,25 February 25, 2009 21:33
To: ironruby-core at rubyforge.org
Subject: Re: [Ironruby-core] Debugging rubyspecs
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.
Thanks,
Shri
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']
]
end
MSpecRun.main
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.
Pete
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://rubyforge.org/pipermail/ironruby-core/attachments/20090225/043416d5/attachment-0001.html>
More information about the Ironruby-core
mailing list