mirror of
https://github.com/ruby/ruby.git
synced 2025-08-23 21:14:23 +02:00

test/runner.rb and tool/lib/test/unit/parallel.rb must use the same
settings. However, some settings were copied and pasted, while some were
added only to test/runner.rb.
This changeset creates tool/test/init.rb for all settings of test-unit,
which is loaded not only by test/runner.rb but also
tool/lib/test/unit/parallel.rb.
Background: the GEM_HOME environment variable was removed in
test/runner.rb, which prohibit `require "rake"` (note that rake is a
bundled gem). However the parallel mode didn't refrect this setting,
i.e., `require "rake"` was allowed.
This leads to an inconsistency, which actually affected a test test
defines s test class *only when* `require "rake"` is successful.
(test/rubygems/test_gem_package_task.rb)
1851105563 (step)
:8:1714
```
/home/runner/work/ruby/ruby/src/tool/lib/test/unit.rb:729:in `const_get': uninitialized constant TestGemPackageTask (NameError)
suites.map! {|r| ::Object.const_get(r[:testcase])}
^^^^^^^^^^
```
14 lines
235 B
Ruby
14 lines
235 B
Ruby
# frozen_string_literal: true
|
|
require 'rbconfig'
|
|
|
|
require_relative "init"
|
|
|
|
case $0
|
|
when __FILE__
|
|
dir = __dir__
|
|
when "-e"
|
|
# No default directory
|
|
else
|
|
dir = File.realdirpath("..", $0)
|
|
end
|
|
exit Test::Unit::AutoRunner.run(true, dir)
|