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

Separated tool/test/runner.rb and test/runner.rb

As `make test-tool` does not use gems, and no Rubygems stuffs is
needed, so moved such things to test/runner.rb.  Also no longer
nees `--test-target-dir` option.
This commit is contained in:
Nobuyoshi Nakada 2019-07-24 11:07:15 +09:00
parent 46771abfe5
commit 8e53d18e67
No known key found for this signature in database
GPG key ID: 4BC7D6DF58D8DF60
4 changed files with 32 additions and 37 deletions

View file

@ -753,12 +753,12 @@ yes-test-knownbug: prog PHONY
test-testframework: $(TEST_RUNNABLE)-test-testframework
yes-test-testframework: prog PHONY
$(gnumake_recursive)$(Q)$(exec) $(RUNRUBY) "$(TOOL_TESTSDIR)/runner.rb" --test-target-dir="$(TOOL_TESTSDIR)" --ruby="$(RUNRUBY)" $(TESTOPTS) testunit minitest
$(gnumake_recursive)$(Q)$(exec) $(RUNRUBY) "$(TOOL_TESTSDIR)/runner.rb" --ruby="$(RUNRUBY)" $(TESTOPTS) testunit minitest
no-test-testframework: PHONY
test-tool: $(TEST_RUNNABLE)-test-tool
yes-test-tool: prog PHONY
$(gnumake_recursive)$(Q)$(exec) $(RUNRUBY) "$(TOOL_TESTSDIR)/runner.rb" --test-target-dir="$(TOOL_TESTSDIR)" --ruby="$(RUNRUBY)" $(TESTOPTS)
$(gnumake_recursive)$(Q)$(exec) $(RUNRUBY) "$(TOOL_TESTSDIR)/runner.rb" --ruby="$(RUNRUBY)" $(TESTOPTS)
no-test-tool: PHONY
test-sample: test-basic # backward compatibility for mswin-build
@ -769,10 +769,10 @@ test: test-short
# for example, make test-all TESTOPTS="-j2 -v -n test-name -- test-file-name"
test-all: $(TEST_RUNNABLE)-test-all
yes-test-all: programs PHONY
$(gnumake_recursive)$(Q)$(exec) $(RUNRUBY) "$(TOOL_TESTSDIR)/runner.rb" --test-target-dir="$(TESTSDIR)" --ruby="$(RUNRUBY)" $(TEST_EXCLUDES) $(TESTOPTS) $(TESTS)
$(gnumake_recursive)$(Q)$(exec) $(RUNRUBY) "$(TESTSDIR)/runner.rb" --ruby="$(RUNRUBY)" $(TEST_EXCLUDES) $(TESTOPTS) $(TESTS)
TESTS_BUILD = mkmf
no-test-all: PHONY
$(gnumake_recursive)$(MINIRUBY) -I"$(srcdir)/lib" "$(TOOL_TESTSDIR)/runner.rb" --test-target-dir="$(TESTSDIR)" $(TESTOPTS) $(TESTS_BUILD)
$(gnumake_recursive)$(MINIRUBY) -I"$(srcdir)/lib" "$(TESTSDIR)/runner.rb" $(TESTOPTS) $(TESTS_BUILD)
test-almost: test-all
yes-test-almost: yes-test-all
@ -781,7 +781,7 @@ no-test-almost: no-test-all
test-ruby: $(TEST_RUNNABLE)-test-ruby
no-test-ruby: PHONY
yes-test-ruby: prog encs PHONY
$(gnumake_recursive)$(RUNRUBY) "$(TOOL_TESTSDIR)/runner.rb" --test-target-dir="$(TESTSDIR)" $(TEST_EXCLUDES) $(TESTOPTS) -- ruby -ext-
$(gnumake_recursive)$(RUNRUBY) "$(TESTSDIR)/runner.rb" $(TEST_EXCLUDES) $(TESTOPTS) -- ruby -ext-
extconf: $(PREP)
$(Q) $(MAKEDIRS) "$(EXTCONFDIR)"

View file

@ -290,7 +290,7 @@ rdoc\:%: PHONY
$(Q)$(RUNRUBY) $(srcdir)/libexec/ri --no-standard-docs --doc-dir=$(RDOCOUT) $(patsubst rdoc:%,%,$@)
test_%.rb test/%: programs PHONY
+$(Q)$(exec) $(RUNRUBY) "$(TOOL_TESTSDIR)/runner.rb" --test-target-dir="$(TESTSDIR)" --ruby="$(RUNRUBY)" $(TEST_EXCLUDES) $(TESTOPTS) -- $(patsubst test/%,%,$@)
+$(Q)$(exec) $(RUNRUBY) "$(TESTSDIR)/runner.rb" --ruby="$(RUNRUBY)" $(TEST_EXCLUDES) $(TESTOPTS) -- $(patsubst test/%,%,$@)
clean-srcs-ext::
$(Q)$(RM) $(patsubst $(srcdir)/%,%,$(EXT_SRCS))

11
test/runner.rb Normal file
View file

@ -0,0 +1,11 @@
# frozen_string_literal: true
# Should be done in rubygems test files?
ENV["GEM_SKIP"] = ENV["GEM_HOME"] = ENV["GEM_PATH"] = "".freeze
# Get bundled gems on load path
Dir.glob("#{__dir__}/../gems/*/*.gemspec")
.reject {|f| f =~ /minitest|test-unit|power_assert/ }
.map {|f| $LOAD_PATH.unshift File.join(File.dirname(f), "lib") }
require_relative '../tool/test/runner'

View file

@ -1,38 +1,22 @@
# frozen_string_literal: false
# frozen_string_literal: true
require 'rbconfig'
tool_dir = File.dirname(File.dirname(File.realpath(__FILE__)))
src_testdir = nil
case ARGV.first
when /\A--test-target-dir=(.*?)\z/
ARGV.shift
src_testdir = File.realpath($1)
else
raise "unknown runner option: #{ ARGV.first }"
end
raise "#$0: specify --test-target-dir" if !src_testdir
$LOAD_PATH << src_testdir
$LOAD_PATH.unshift "#{tool_dir}/lib"
# Get bundled gems on load path
Dir.glob("#{src_testdir}/../gems/*/*.gemspec")
.reject {|f| f =~ /minitest|test-unit|power_assert/ }
.map {|f| $LOAD_PATH.unshift File.join(File.dirname(f), "lib") }
$LOAD_PATH.unshift File.expand_path("../lib", __dir__)
require 'test/unit'
ENV["GEM_SKIP"] = ENV["GEM_HOME"] = ENV["GEM_PATH"] = "".freeze
require_relative "../lib/profile_test_all" if ENV.key?('RUBY_TEST_ALL_PROFILE')
require_relative "../lib/tracepointchecker"
require_relative "../lib/zombie_hunter"
require_relative "../lib/iseq_loader_checker"
require_relative "../test-coverage.rb" if ENV.key?('COVERAGE')
require_relative "#{tool_dir}/lib/profile_test_all" if ENV.has_key?('RUBY_TEST_ALL_PROFILE')
require_relative "#{tool_dir}/lib/tracepointchecker"
require_relative "#{tool_dir}/lib/zombie_hunter"
require_relative "#{tool_dir}/lib/iseq_loader_checker"
if ENV['COVERAGE']
require_relative "#{tool_dir}/test-coverage.rb"
case $0
when __FILE__
dir = __dir__
when "-e"
# No default directory
else
dir = File.expand_path("..", $0)
end
exit Test::Unit::AutoRunner.run(true, src_testdir)
Test::Unit::AutoRunner.new(true, dir)