1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

tool/test/runner.rb: support --test-target-dir option

tool/test/runner.rb had been copied from test/runner.rb.
test/runner.rb was for `make test-all`, and tool/test/runner.rb was for
`make test-testframework` and `make test-tool`.
But I want to avoid the code clones.

This change makes tool/test/runner.rb support --test-target-dir option
which allows tool/test/runner.rb to run `make test-all`.
Now we can remove test/runner.rb.
This commit is contained in:
Yusuke Endoh 2019-07-21 19:19:08 +09:00
parent 523fec8a4b
commit 24712eeec3
4 changed files with 20 additions and 49 deletions

View file

@ -1,9 +1,22 @@
# frozen_string_literal: false
require 'rbconfig'
src_testdir = File.dirname(File.realpath(__FILE__))
tool_dir = File.dirname(File.dirname(File.realpath(__FILE__)))
src_testdir = nil
while opt = ARGV.shift
break if opt == "--"
case opt
when /\A--test-target-dir=(.*?)\z/
src_testdir = File.realpath($1)
else
raise "unknown runner option: #{ opt }"
end
end
raise "#$0: specify --test-target-dir" if !src_testdir
$LOAD_PATH << src_testdir
tool_dir = File.join src_testdir, ".."
$LOAD_PATH.unshift "#{tool_dir}/lib"
# Get bundled gems on load path