Skip to content

Make the RubyGems test suite green under RUBY_BOX=1 - #9826

Open
hsbt wants to merge 7 commits into
masterfrom
ruby-box-green-round1
Open

Make the RubyGems test suite green under RUBY_BOX=1#9826
hsbt wants to merge 7 commits into
masterfrom
ruby-box-green-round1

Conversation

@hsbt

@hsbt hsbt commented Aug 28, 2026

Copy link
Copy Markdown
Member

Running the test suite with RUBY_BOX=1 failed 38 tests and errored 18 on ruby master. This makes it green in both modes as the first step of Ruby::Box support in the test suite.

The harness now prepends -W:no-experimental to RUBYOPT for spawned processes, since every child ruby prints the Ruby::Box experimental warning to stderr and breaks assertions on subprocess output. Checks reading $? move to Process.last_status because Ruby::Box leaves $? uninitialized, which also fixes Gem::Source::Git#rev_parse swallowing git rev-parse failures at runtime. Tests that capture stdio or round-trip Gem:: constants through Marshal are pended under Ruby::Box with references to https://bugs.ruby-lang.org/issues/21867 and https://bugs.ruby-lang.org/issues/22090, and are unaffected in normal runs. TestGemRDoc now preloads rdoc/rdoc before the tests fake Gem.paths, which was broken on rdoc 8 environments regardless of Ruby::Box.

hsbt added 7 commits August 28, 2026 10:13
Under RUBY_BOX=1 every spawned ruby prints an experimental warning to
stderr, which breaks tests asserting on subprocess output. Prepend
-W:no-experimental to RUBYOPT for child processes and add a
ruby_box_enabled? helper for box-specific guards.
Ruby::Box leaves $? uninitialized, so exit status checks read exit 0
regardless of the real status. Under RUBY_BOX=1 this made
Gem::Source::Git#rev_parse swallow git rev-parse failures, and made the
cargo availability pend in the test suite misjudge a broken toolchain as
usable. Process.last_status reports the real status in both modes.
Ruby::Box gives each box detached copies of the stdio globals, so
reassigning or reopening $stdout/$stderr cannot capture output written
by Kernel#warn, Kernel#puts or subprocesses, and $VERBOSE = nil cannot
silence category warnings in assert_ractor children. Pend the affected
tests until https://bugs.ruby-lang.org/issues/21867 is resolved.
Marshal in the main box cannot resolve Gem:: and other boxed constants,
so loading dumps of Gem::Specification, Gem::Version or Date raises
ArgumentError under RUBY_BOX=1. Pend the affected tests until
https://bugs.ruby-lang.org/issues/22090 is resolved.
Requiring rdoc/rdoc makes rdoc's own box resolve its rbs dependency
against the faked Gem.paths of the test, so the rbs already activated by
the rake process is not reused and the require fails with LoadError.
rdoc 8 requires rbs at runtime, and the first require of rdoc/rdoc from
inside a test cannot activate rbs against the faked Gem.paths. That broke
TestGemRDoc on rdoc 8 environments with and without RUBY_BOX=1, so replace
the Ruby::Box pends with an eager load while the real paths are active.
The suite is green under RUBY_BOX=1 now, so run it on ruby-head as a
canary to catch regressions on either side early.
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

Successfully merging this pull request may close these issues.

1 participant