Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Truffle] jruby+truffle - rspec broken? #3374

Closed
PragTob opened this issue Oct 7, 2015 · 7 comments
Closed

[Truffle] jruby+truffle - rspec broken? #3374

PragTob opened this issue Oct 7, 2015 · 7 comments
Assignees
Milestone

Comments

@PragTob
Copy link

PragTob commented Oct 7, 2015

Hey everyone,

I'm trying to run my rspec specs with truffle as @chrisseaton showed me -it might well be that I have a local setup fault over here.

jruby+truffle seems to work fine:

tobi@tobi-desktop ~/github/rubykon $ jruby+truffle --graal-path ../graalvm-jdk1.8.0/bin/java run --graal -- -e 'p Truffle.graal?'
$ JAVACMD=../graalvm-jdk1.8.0/bin/java ../jruby/bin/jruby -X\+T -Xtruffle.core.load_path\=../jruby/truffle/src/main/ruby -r ./.jruby\+truffle_bundle/bundler/setup.rb -e p\ Truffle.graal\?
true

It even runs my benchmarks fine ( 👍 ) however when trying to run my specs or even a bare spec file then it breaks:

tobi@tobi-desktop ~/github/rubykon $ jruby+truffle run -S rspec bare_spec.rb 
$ ../jruby/bin/jruby -X\+T -Xtruffle.core.load_path\=../jruby/truffle/src/main/ruby -r ./.jruby\+truffle_bundle/bundler/setup.rb .jruby\+truffle_bundle/jruby\+truffle/2.2.0/gems/rspec-core-3.3.2/exe/rspec bare_spec.rb
/home/tobi/github/rubykon/.jruby+truffle_bundle/ruby/2.2.0/gems/rspec-core-3.3.2/lib/rspec/core/shared_example_group.rb:104:in `block in definitions': undefined method `shared_examples' for RSpec (NoMethodError)
    from /home/tobi/github/rubykon/.jruby+truffle_bundle/ruby/2.2.0/gems/rspec-core-3.3.2/lib/rspec/core/shared_example_group.rb:209:in `instance_exec'
    from /home/tobi/github/rubykon/.jruby+truffle_bundle/ruby/2.2.0/gems/rspec-core-3.3.2/lib/rspec/core/shared_example_group.rb:209:in `RSpec'
    from /home/tobi/github/rubykon/.jruby+truffle_bundle/ruby/2.2.0/gems/rspec-core-3.3.2/lib/rspec/core/shared_example_group.rb:1:in `<main>'
    from /home/tobi/github/rubykon/.jruby+truffle_bundle/ruby/2.2.0/gems/rspec-core-3.3.2/lib/rspec/core.rb:8:in `block in <main>'
    from /home/tobi/github/rubykon/.jruby+truffle_bundle/ruby/2.2.0/gems/rspec-support-3.3.0/lib/rspec/support.rb:19:in `call'
    from /home/tobi/github/rubykon/.jruby+truffle_bundle/ruby/2.2.0/gems/rspec-support-3.3.0/lib/rspec/support.rb:19:in `block in define_optimized_require_for_rspec'
    from /home/tobi/github/rubykon/.jruby+truffle_bundle/ruby/2.2.0/gems/rspec-core-3.3.2/lib/rspec/core.rb:37:in `block in <main>'
    from /home/tobi/github/rubykon/.jruby+truffle_bundle/ruby/2.2.0/gems/rspec-core-3.3.2/lib/rspec/core.rb:11:in `each'
    from /home/tobi/github/rubykon/.jruby+truffle_bundle/ruby/2.2.0/gems/rspec-core-3.3.2/lib/rspec/core.rb:11:in `<main>'
    from /home/tobi/github/rubykon/.jruby+truffle_bundle/ruby/2.2.0/gems/rspec-core-3.3.2/exe/rspec:3:in `<main>'

tobi@tobi-desktop ~/github/rubykon $ jruby+truffle --graal-path ../graalvm-jdk1.8.0/bin/java run --graal -J-Xmx1500m -S rspec bare_spec.rb 
$ JAVACMD=../graalvm-jdk1.8.0/bin/java ../jruby/bin/jruby -X\+T -J-Xmx1500m -Xtruffle.core.load_path\=../jruby/truffle/src/main/ruby -r ./.jruby\+truffle_bundle/bundler/setup.rb .jruby\+truffle_bundle/jruby\+truffle/2.2.0/gems/rspec-core-3.3.2/exe/rspec bare_spec.rb
/home/tobi/github/rubykon/.jruby+truffle_bundle/ruby/2.2.0/gems/rspec-core-3.3.2/lib/rspec/core/shared_example_group.rb:104:in `block in definitions': undefined method `shared_examples' for RSpec (NoMethodError)
    from /home/tobi/github/rubykon/.jruby+truffle_bundle/ruby/2.2.0/gems/rspec-core-3.3.2/lib/rspec/core/shared_example_group.rb:209:in `instance_exec'
    from /home/tobi/github/rubykon/.jruby+truffle_bundle/ruby/2.2.0/gems/rspec-core-3.3.2/lib/rspec/core/shared_example_group.rb:209:in `RSpec'
    from /home/tobi/github/rubykon/.jruby+truffle_bundle/ruby/2.2.0/gems/rspec-core-3.3.2/lib/rspec/core/shared_example_group.rb:1:in `<main>'
    from /home/tobi/github/rubykon/.jruby+truffle_bundle/ruby/2.2.0/gems/rspec-core-3.3.2/lib/rspec/core.rb:8:in `block in <main>'
    from /home/tobi/github/rubykon/.jruby+truffle_bundle/ruby/2.2.0/gems/rspec-support-3.3.0/lib/rspec/support.rb:19:in `call'
    from /home/tobi/github/rubykon/.jruby+truffle_bundle/ruby/2.2.0/gems/rspec-support-3.3.0/lib/rspec/support.rb:19:in `block in define_optimized_require_for_rspec'
    from /home/tobi/github/rubykon/.jruby+truffle_bundle/ruby/2.2.0/gems/rspec-core-3.3.2/lib/rspec/core.rb:37:in `block in <main>'
    from /home/tobi/github/rubykon/.jruby+truffle_bundle/ruby/2.2.0/gems/rspec-core-3.3.2/lib/rspec/core.rb:11:in `each'
    from /home/tobi/github/rubykon/.jruby+truffle_bundle/ruby/2.2.0/gems/rspec-core-3.3.2/lib/rspec/core.rb:11:in `<main>'
    from /home/tobi/github/rubykon/.jruby+truffle_bundle/ruby/2.2.0/gems/rspec-core-3.3.2/exe/rspec:3:in `<main>'

tobi@tobi-desktop ~/github/rubykon $ rspec bare_spec.rb # this is CRuby 2.2.3
.

Finished in 0.00984 seconds (files took 0.16875 seconds to load)
1 example, 0 failures

I pulled and built JRuby today:

tobi@tobi-desktop ~/github/rubykon $ jruby+truffle --graal-path ../graalvm-jdk1.8.0/bin/java run --graal -J-Xmx1500m -- -e 'puts RUBY_DESCRIPTION'
$ JAVACMD=../graalvm-jdk1.8.0/bin/java ../jruby/bin/jruby -X\+T -J-Xmx1500m -Xtruffle.core.load_path\=../jruby/truffle/src/main/ruby -r ./.jruby\+truffle_bundle/bundler/setup.rb -e puts\ RUBY_DESCRIPTION
jruby 9.0.2.0-SNAPSHOT (2.2.2) 2015-10-03 887e676 OpenJDK 64-Bit Server VM 25.40-b25-internal-graal-0.7 on 1.8.0-internal-b132 +jit [linux-amd64]

So yeah, is this a recent regression or is my setup wrong?

Thanks + cheers,
Tobi

@chrisseaton
Copy link
Contributor

I think this might be a recent bug introduced by some changes @eregon made to declaration scopes - the method in question is declared in a Proc, so the object it's supposed to attach itself to could well be wrong.

https://github.com/rspec/rspec-core/blob/master/lib/rspec/core/shared_example_group.rb#L104

@eregon could you take a look, please?

@chrisseaton chrisseaton added this to the truffle-dev milestone Oct 7, 2015
@eregon eregon closed this as completed in 9febd8c Oct 8, 2015
@eregon
Copy link
Member

eregon commented Oct 8, 2015

Fixed, it was a bug of the alias keyword which by chance worked before my work on the default definee / current module.

@chrisseaton
Copy link
Contributor

Thanks very much!

@PragTob
Copy link
Author

PragTob commented Oct 8, 2015

Thanks for the fix!

Specs run now, but somehow not fully/looks like it silently aborts at some point:

tobi@tobi-desktop ~/github/rubykon $ rspec
........................................................................................................................................................................................................................................................................

Finished in 3.46 seconds (files took 0.22359 seconds to load)
264 examples, 0 failures

tobi@tobi-desktop ~/github/rubykon $ jruby+truffle run -S rspec spec/
$ ../jruby/bin/jruby -X\+T -Xtruffle.core.load_path\=../jruby/truffle/src/main/ruby -r ./.jruby\+truffle_bundle/bundler/setup.rb .jruby\+truffle_bundle/jruby\+truffle/2.2.0/gems/rspec-core-3.3.2/exe/rspec spec/
Coverage may be inaccurate; Try setting JRUBY_OPTS="-Xcli.debug=true --debug"
.....................................................................

The same thing happens with different subsets of specs though, so it doesn't seem to choke on a special spec or something like that.

@eregon
Copy link
Member

eregon commented Oct 9, 2015

It seems due to our Kernel#exit doing a hard exit instead of raising an exception.

@eregon
Copy link
Member

eregon commented Oct 9, 2015

@PragTob I tried some rubykon spec before but apparently I was lucky enough to not try the CLI one which expects Kernel#exit to be rescue-able.
Fixed Kernel#exit and similar with 95c30c2.
The output is the same as MRI's now.

@PragTob
Copy link
Author

PragTob commented Oct 9, 2015

@eregon 👍 thanks! Weird that it still triggered when I ran the mcts subset but great :)

@enebo enebo added this to the Non-Release milestone Dec 7, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants