aboutsummaryrefslogtreecommitdiffstats
path: root/tool
diff options
context:
space:
mode:
authorYusuke Endoh <mame@ruby-lang.org>2019-07-21 19:19:08 +0900
committerYusuke Endoh <mame@ruby-lang.org>2019-07-21 19:19:08 +0900
commit24712eeec39f5e9a11cfc2b940358403cda4f2b6 (patch)
tree1c73137b5a00c1ae13ee6d72256df4d23c2fd593 /tool
parent523fec8a4baec1e2a9c1adc0095646b12aa6c76c (diff)
downloadruby-24712eeec39f5e9a11cfc2b940358403cda4f2b6.tar.gz
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.
Diffstat (limited to 'tool')
-rw-r--r--tool/lib/test/unit.rb3
-rw-r--r--tool/test/runner.rb17
2 files changed, 15 insertions, 5 deletions
diff --git a/tool/lib/test/unit.rb b/tool/lib/test/unit.rb
index d237a9a0e9..1034a993b0 100644
--- a/tool/lib/test/unit.rb
+++ b/tool/lib/test/unit.rb
@@ -856,9 +856,6 @@ module Test
def setup_options(parser, options)
super
parser.separator "globbing options:"
- parser.on '-b', '--basedir=DIR', 'Base directory of test suites.' do |dir|
- options[:base_directory] = dir
- end
parser.on '-x', '--exclude REGEXP', 'Exclude test files on pattern.' do |pattern|
(options[:reject] ||= []) << pattern
end
diff --git a/tool/test/runner.rb b/tool/test/runner.rb
index 64f6df167e..db23ae2d33 100644
--- a/tool/test/runner.rb
+++ b/tool/test/runner.rb
@@ -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