How do I run nokogiri tests in JRuby?

33 views
Skip to first unread message

Dmitry Ratnikov

unread,
Apr 30, 2012, 1:43:57 PM4/30/12
to nokogiri-talk
I ran into a minor issue with nokogori (https://github.com/tenderlove/
nokogiri/blob/master/lib/nokogiri/html/document.rb#L183
throwing :encoding_found.to_s but catching a symbol) and wanted to run
the tests to see if they passed. However, I ran into:

bash-3.2$ rake test
install -c tmp/java/nokogiri/nokogiri.jar lib/nokogiri/nokogiri.jar
/Users/ratnikov/.rvm/gems/jruby-1.6.7/bin/racc -l -o lib/nokogiri/css/
parser.rb lib/nokogiri/css/parser.y
ArgumentError: rb_iterate only supported with rb_each and an Array
send at org/jruby/RubyKernel.java:2088
yyparse at /Users/ratnikov/.rvm/gems/jruby-1.6.7/gems/racc-1.4.8/lib/
racc/parser.rb:152
parse at /Users/ratnikov/.rvm/gems/jruby-1.6.7/gems/racc-1.4.8/lib/
racc/grammarfileparser.rb:184
main at /Users/ratnikov/.rvm/gems/jruby-1.6.7/gems/racc-1.4.8/bin/racc:
143
section at /Users/ratnikov/.rvm/gems/jruby-1.6.7/gems/racc-1.4.8/bin/
racc:277
main at /Users/ratnikov/.rvm/gems/jruby-1.6.7/gems/racc-1.4.8/bin/racc:
141
(root) at /Users/ratnikov/.rvm/gems/jruby-1.6.7/gems/racc-1.4.8/bin/
racc:308
load at org/jruby/RubyKernel.java:1058
(root) at /Users/ratnikov/.rvm/gems/jruby-1.6.7/bin/racc:19
rake aborted!
Command failed with status (1): [/Users/ratnikov/.rvm/gems/jruby-1.6.7/
bin/...]

I dug a little bit further and it seems like the issue is within racc.
But the latest repo I found has been updated 6 months ago and it also
seems like although it does mention java in the Makefile, it still
installs C bindings when doing gem install. Perhaps I am doing
something very wrong?

PS Another fellow #jruby-er ran into the same problem when trying to
run nokogiri tests, so it seems like the issue is not limited to my
setup.

Mike Dalessio

unread,
Apr 30, 2012, 2:03:14 PM4/30/12
to nokogi...@googlegroups.com
Hello,

racc and rexical should be built under an MRI version of ruby. Try something like this (assuming presence of RVM):

rvm_use jruby-1.6.5
bundle exec rake clean clobber
rvm_use 1.8.7
bundle exec rake generate # uses racc and rexical to build lexer/parser code
rvm_use jruby-1.6.5
bundle exec rake


 

PS Another fellow #jruby-er ran into the same problem when trying to
run nokogiri tests, so it seems like the issue is not limited to my
setup.

--
You received this message because you are subscribed to the Google Groups "nokogiri-talk" group.
To post to this group, send email to nokogi...@googlegroups.com.
To unsubscribe from this group, send email to nokogiri-tal...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/nokogiri-talk?hl=en.


Dmitry Ratnikov

unread,
Apr 30, 2012, 2:08:25 PM4/30/12
to nokogi...@googlegroups.com
Thanks, I'll try that!

So is racc is not jruby compatible? I've poked into its source a
little bit (github.com/tenderlove/racc version) and seems like the
extensions Makefile does mention java...

-- D

Yoko Harada

unread,
Apr 30, 2012, 8:03:33 PM4/30/12
to nokogi...@googlegroups.com
Hello,

On Tue, May 1, 2012 at 3:08 AM, Dmitry Ratnikov <ratn...@gmail.com> wrote:
> Thanks, I'll try that!

Try that and make sure you are using JRuby when you run rake.

You need to run rake on MRI just once. After you get racc generated
files, you don't need MRI anymore.

> So is racc is not jruby compatible? I've poked into its source a
> little bit (github.com/tenderlove/racc version) and seems like the
> extensions Makefile does mention java...

As far as I know, racc doesn't work on JRuby. Is it changed?

-Yoko
Reply all
Reply to author
Forward
0 new messages