2011-07-28 67 views
2

我是JRuby的新手,我试图让我的测试套件正确运行。我正在使用minitest,它看起来像minitest需要启用ObjectSpace。我已经试过每个以下命令:JRuby + minitest由于ObjectSpace而失败

bundle exec jruby -X+O -S rake 
jruby -X+O -S bundle exec rake 
JRUBY_OPTS="-X+O" bundle exec rake 
export JRUBY_OPTS="-X+O" && bundle exec rake 

,他们都导致以下堆栈跟踪:

RuntimeError: ObjectSpace is disabled; each_object will only work with Class, pass -X+O to enable 
each_object at org/jruby/RubyObjectSpace.java:167 
    each at org/jruby/RubyEnumerator.java:189 
    to_a at org/jruby/RubyEnumerable.java:375 
     AWS at /Users/kshipley/.rvm/gems/[email protected]/bundler/gems/papi-38fc7d34a33d/lib/papi/aws.rb:1476 
    Papi at /Users/kshipley/.rvm/gems/[email protected]/bundler/gems/papi-38fc7d34a33d/lib/papi/aws.rb:6 
    (root) at /Users/kshipley/.rvm/gems/[email protected]/bundler/gems/papi-38fc7d34a33d/lib/papi/aws.rb:5 
    require at org/jruby/RubyKernel.java:1038 
    (root) at /Users/kshipley/.rvm/gems/[email protected]/bundler/gems/papi-38fc7d34a33d/lib/papi/aws.rb:157 
    require at org/jruby/RubyKernel.java:1038 
    require at /Users/kshipley/.rvm/gems/[email protected]/bundler/gems/papi-38fc7d34a33d/lib/papi.rb:68 
    each at org/jruby/RubyArray.java:1602 
    require at /Users/kshipley/.rvm/gems/[email protected]/gems/bundler-1.0.15/lib/bundler/runtime.rb:66 
    each at org/jruby/RubyArray.java:1602 
    require at /Users/kshipley/.rvm/gems/[email protected]/gems/bundler-1.0.15/lib/bundler/runtime.rb:55 
    require at /Users/kshipley/.rvm/gems/[email protected]/gems/bundler-1.0.15/lib/bundler.rb:120 
    (root) at /Users/kshipley/work/src/split/config/environment.rb:5 
    require at org/jruby/RubyKernel.java:1038 
    (root) at /Users/kshipley/work/src/split/config/environment.rb:3 
    require at org/jruby/RubyKernel.java:1038 
    (root) at /Users/kshipley/work/src/split/test/test_helper.rb:1 
    load at org/jruby/RubyKernel.java:1063 
__file__ at /Users/kshipley/.rvm/gems/[email protected]/gems/rake-0.8.7/lib/rake/rake_test_loader.rb:5 
    each at org/jruby/RubyArray.java:1602 
    (root) at /Users/kshipley/.rvm/gems/[email protected]/gems/rake-0.8.7/lib/rake/rake_test_loader.rb:5 
rake aborted! 

任何想法正确的命令是重新启用的对象空间中运行时耙?我有运行命令,如

bundle exec jruby -X+O test/functional/my_test.rb 
bundle exec jruby -X+O -S irb 

没有问题,所以它似乎有点特别与耙具有关。

+0

'bundle exec jruby -X + O -S rake'怎么样? –

+0

对不起,我编辑并发您的评论 - 这是我实际运行的命令。 – Kyle

回答

4

你的耙子任务是否产生子过程?如果是这样,JRuby可能会重新使用当前的JVM进程。尝试导出JRUBY_OPTS='-X+O -J-Djruby.launch.inproc=false'

+0

这确实解决了我的问题,但我的测试执行时间从 真正\t 0m14.867s 用户去\t 0m6.484s SYS \t 0m1.269s 下REE到 真正\t 0m56.332s 用户\t 1m11。 491s sys \t 0m5.107s 根据jruby-1.6.2。你有什么调整建议,或者我应该考虑隔离目前需要运行jruby的一段代码吗? – Kyle

相关问题