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

Aruba doesn't work on JRuby :( #27

Closed
myronmarston opened this issue Nov 10, 2010 · 12 comments
Closed

Aruba doesn't work on JRuby :( #27

myronmarston opened this issue Nov 10, 2010 · 12 comments

Comments

@myronmarston
Copy link

Inspired by RSpec's awesome cukes, I've started working on rewriting the cukes for my VCR gem in a similar style, using aruba. Unfortunately, I discovered that the latest Aruba is not compatible with JRuby. Here's the output when you run aruba's cukes on JRuby:

no library specified (LoadError)
/Users/mmarston/.rvm/rubies/jruby-1.5.2/lib/ruby/site_ruby/shared/ffi/library.rb:46:in `ffi_libraries'
/Users/mmarston/.rvm/rubies/jruby-1.5.2/lib/ruby/site_ruby/shared/ffi/library.rb:96:in `attach_function'
/Users/mmarston/.rvm/rubies/jruby-1.5.2/lib/ruby/site_ruby/shared/pty.rb:11
/Users/mmarston/.rvm/rubies/jruby-1.5.2/lib/ruby/site_ruby/shared/pty.rb:1:in `require'
/Users/mmarston/.rvm/gems/jruby-1.5.2/gems/background_process-1.2/lib/background_process/pty_background_process.rb:1
/Users/mmarston/.rvm/gems/jruby-1.5.2/gems/background_process-1.2/lib/background_process/pty_background_process.rb:2:in `require'
/Users/mmarston/.rvm/gems/jruby-1.5.2/gems/background_process-1.2/lib/background_process.rb:2
/Users/mmarston/.rvm/gems/jruby-1.5.2/gems/background_process-1.2/lib/background_process.rb:3:in `require'
/Users/mmarston/code/aruba/features/support/../../lib/aruba/api.rb:3
/Users/mmarston/code/aruba/features/support/../../lib/aruba/api.rb:1:in `require'
/Users/mmarston/code/aruba/features/support/../../lib/aruba/cucumber.rb:1
/Users/mmarston/code/aruba/features/support/../../lib/aruba/cucumber.rb:1:in `require'
/Users/mmarston/code/aruba/features/support/../../lib/aruba.rb:1
/Users/mmarston/code/aruba/features/support/../../lib/aruba.rb:2:in `require'
/Users/mmarston/code/aruba/features/support/env.rb:2
/Users/mmarston/code/aruba/features/support/env.rb:143:in `load'
/Users/mmarston/.rvm/gems/jruby-1.5.2/gems/cucumber-0.9.4/bin/../lib/cucumber/rb_support/rb_language.rb:143:in `load_code_file'
/Users/mmarston/.rvm/gems/jruby-1.5.2/gems/cucumber-0.9.4/bin/../lib/cucumber/runtime/support_code.rb:176:in `load_file'
/Users/mmarston/.rvm/gems/jruby-1.5.2/gems/cucumber-0.9.4/bin/../lib/cucumber/runtime/support_code.rb:78:in `load_files!'
/Users/mmarston/.rvm/gems/jruby-1.5.2/gems/cucumber-0.9.4/bin/../lib/cucumber/runtime/support_code.rb:77:in `each'
/Users/mmarston/.rvm/gems/jruby-1.5.2/gems/cucumber-0.9.4/bin/../lib/cucumber/runtime/support_code.rb:77:in `load_files!'
/Users/mmarston/.rvm/gems/jruby-1.5.2/gems/cucumber-0.9.4/bin/../lib/cucumber/runtime.rb:137:in `load_step_definitions'
/Users/mmarston/.rvm/gems/jruby-1.5.2/gems/cucumber-0.9.4/bin/../lib/cucumber/runtime.rb:39:in `run!'
/Users/mmarston/.rvm/gems/jruby-1.5.2/gems/cucumber-0.9.4/bin/../lib/cucumber/cli/main.rb:48:in `execute!'
/Users/mmarston/.rvm/gems/jruby-1.5.2/gems/cucumber-0.9.4/bin/../lib/cucumber/cli/main.rb:21:in `execute'
/Users/mmarston/.rvm/gems/jruby-1.5.2/gems/cucumber-0.9.4/bin/cucumber:8
rake aborted!
Command failed with status (1): [bundle exec /Users/mmarston/.rvm/rubies/jr...]

I don't think background_process is compatible with JRuby at all. Is aruba intended to be compatible with JRuby?

@msassak
Copy link
Member

msassak commented Nov 10, 2010

The intent, I think, is for Aruba to work wherever Ruby does. (background_process doesn't work on Windows, either.) mattwynne and I have been trying to find a gem that can handle background processes cross-platform, but it's been slow going. (See issue #16 for some details). So far childprocess (https://github.com/jarib/childprocess) looks like the best bet, but it needs to be modified to handle input streams, too. Shouldn't be too hard, but it's going to take some work to make sure it works on all the platforms.

@myronmarston
Copy link
Author

It seems like there are two competing totally legitimate desires here: the desire to have aruba usable on all ruby interpreters, and the desire to have aruba do cool interaction stuff that's useful for some testing situations. Hopefully you'll be able to get it to that point where aruba can satisfy both of these, but in the mean time, how does this sound as a decent compromise:

Extract all of the non jruby/windows-compatible Aruba::API methods and cucumber steps into separate files that are not automatically required when you require "aruba". This file should be named in a way that makes it clear that it is not fully compatible with JRuby or windows (maybe aruba/mri_posix_api.rb or something like that?).

That way, users (like me) who just want to use the simple non-interactive parts of aruba on all ruby interpreters can do so. Users who want the interactive process stuff can require the extra file and use it. The file name makes it clear to folks that they are using steps that are not compatible everywhere.

What is the most recent old version (if there is one) that is supports JRuby? I checked out an old version (0.2.1, I think) and ran the cukes and got a couple of failures on JRuby.

@msassak
Copy link
Member

msassak commented Nov 10, 2010

I'm unsure what is the best version to use with JRuby, but I did just send a pull request to Aslak to merge in a bunch of improvements I made to the interactive support, including encapsulating process control in a Process class. If that gets in it should be pretty easy to get the basics working on JRuby and Windows while we sort out what is the best cross-platform process control library.

@aslakhellesoy
Copy link
Contributor

Is there any particular reason you want to run Aruba on JRuby? You can use Aruba on MRI to test a command line application that runs on JRuby (or Ada for that matter).

Apart from that I like your suggestions.

@myronmarston
Copy link
Author

Is there any particular reason you want to run Aruba on JRuby? You can use Aruba on MRI to test a command line application that runs on JRuby (or Ada for that matter).

I've got a gem that I'm testing against MRI 1.8.6, 1.8.7, 1.9.1, 1.9.2, REE, rubinius and JRuby. The cukes use aruba. I've just been running the cukes on each ruby interpreter. I hadn't considered running the cukes using a single ruby interpreter and having them run the generated files using each interpreter...I may investigate that to see if I can get it to work.

Still, it'd be nice if Aruba worked on JRuby...that'd be simplest here, I think.

@msassak
Copy link
Member

msassak commented Dec 22, 2010

jarib added support for stdin to childprocess, and I've integrated childprocess into Aruba in my chidprocess branch: https://www.github.com/msassak/aruba/tree/childprocess

Aruba will still require a bit of tweaking to get running under JRuby (patches welcome!) but its process control library is no longer preventing it from working.

@kaiwren
Copy link

kaiwren commented Mar 27, 2011

@myronmarston Have you had any luck with either approach?

@myronmarston
Copy link
Author

It looks like recent versions of aruba might work with JRuby now:

https://github.com/aslakhellesoy/aruba/blob/master/History.txt#L42

I'm using a monkey patched old version of aruba w/ JRuby for VCR. See my env.rb file and the aruba_workaround directory.

Upgrading aruba to a more recent version has been on my TODO list for a while, but since adding these monkey patches I haven't had any issues...so I've had little incentive to upgrade.

Myron

@kaiwren
Copy link

kaiwren commented Mar 28, 2011

I'm still seeing issues - I've been looking at rspec-core's cukes (which use aruba 0.3.5) and it looks like
Given a file named "ok_spec.rb" with
from exit_status.feature fails to create a file on Jruby 1.6.0. I'll take a look at what you've got working in VCR.

Sidu.

@hedgehog
Copy link

No description provided.

@mattwynne
Copy link
Member

I am closing this, I think several people are using Aruba with JRuby now, right?

@myronmarston
Copy link
Author

Yeah, it works fine for me now. I didn't realize this was still open. Thanks!

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

6 participants