Run the test suite on JRuby (JRuby support, step 4)#3008
Open
soutaro wants to merge 5 commits into
Open
Conversation
JRuby runs the parser in WebAssembly rather than the C extension, so: - The `test` task no longer depends on `:compile` there (there is nothing to build; `rake wasm:jruby_setup` assembles the wasm runtime instead). - The gemspec only stamps the `java` platform when actually building the release gem (RBS_PLATFORM=java); on JRuby it otherwise stays a `ruby` platform gem so local development matches a `ruby` lockfile, while still skipping the C extension and shipping the wasm + jars. https://claude.ai/code/session_01LTveMt3NLbYHEboXuzAKpA
`require "pathname" unless defined?(Pathname)` skipped loading pathname when the Pathname *constant* was already defined by another library (e.g. Bundler), leaving `Kernel#Pathname` undefined. RBS::EnvironmentLoader uses `Pathname(...)` at load time, so requiring RBS after Bundler raised NoMethodError on JRuby. `require` is idempotent, so just require it unconditionally. https://claude.ai/code/session_01LTveMt3NLbYHEboXuzAKpA
Mirror the existing `omit_on_truffle_ruby!` skips with `omit_on_jruby!` for the tests that depend on `RubyVM::AbstractSyntaxTree` (prototype/node-usage), the `TracePoint :end` event (`rbs test`), or prism's `start_line_slice`. Also skip `rbs collection install/update`, which runs `bundle install` and builds native gem extensions that do not compile on JRuby. Also fix the pure-Ruby RBS::Location#[]: like the C extension, it now raises on an unknown child name instead of returning nil. https://claude.ai/code/session_01LTveMt3NLbYHEboXuzAKpA
These two cases already differ on TruffleRuby; the same Enumerator behavior differs on JRuby, so omit them there too. https://claude.ai/code/session_01LTveMt3NLbYHEboXuzAKpA
The JRuby job now assembles the WebAssembly runtime and runs `rake test` (the whole non-stdlib suite, with JRuby-incompatible cases omitted) instead of just the two parser test files, and triggers on lib/test/sig changes. https://claude.ai/code/session_01LTveMt3NLbYHEboXuzAKpA
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Stacked on #3000 (step 3). Review/merge that first; this PR's diff is against it.
Makes
rake testrun on JRuby, skipping the cases that can't work there — mirroring how the suite already handles TruffleRuby.Result
The full non-stdlib suite passes on JRuby (JRuby 10.0.6.0, verified locally). The 116 omissions are the genuinely-incompatible tests. No effect on CRuby (the
omit_on_jruby!calls are no-ops there).Two real bugs this surfaced
lib/rbs.rb—require "pathname" unless defined?(Pathname)skipped loading pathname when another library (Bundler) had already defined thePathnameconstant, leavingKernel#Pathnameundefined.RBS::EnvironmentLoaderusesPathname(...)at load time, so requiring RBS after Bundler (astest_helperdoes) raisedNoMethodErroron JRuby. Now requires it unconditionally (requireis idempotent).lib/rbs/wasm/location.rb— the pure-RubyRBS::Location#[]returnednilfor an unknown child name; the C extension raises. Now matches.Making
rake testwork on JRubytesttask no longer depends on:compileon JRuby (there is no C extension to build;rake wasm:jruby_setupassembles the wasm runtime instead).javaplatform when actually building the release gem (RBS_PLATFORM=java); on JRuby it otherwise stays aruby-platform gem so local development matches arubylockfile, while still skipping the C extension and shipping the wasm + jars.Skips (
omit_on_jruby!, alongside the existingomit_on_truffle_ruby!)Rb/Rbi/RuntimePrototypeTest,NodeUsageTest,cli prototypeRubyVM::AbstractSyntaxTreenot on JRubyTest::RuntimeTestTest,cli testrbs testneeds theTracePoint :endeventCommentBlockTest(3)Prism::Location#start_line_slicereturns nil on JRuby's prismTypeCheckTest(2)loopEnumerator type-checks differentlycli collection install/updatebundle install, which builds native gem extensions that don't compile on JRubyCI
The
jrubyjob now assembles the runtime and runsjruby -S rake test(instead of just two parser test files), and triggers on lib/test/sig changes. The test gems it needs are all pure Ruby; the native-extension dev tools in the main Gemfile (irb → io-console, activesupport → bigdecimal, ...) aren't installed, which is why the job usesgem installrather than the full bundle.https://claude.ai/code/session_01LTveMt3NLbYHEboXuzAKpA
Generated by Claude Code