ruby-changes:56659
From: Nobuyoshi <ko1@a...>
Date: Thu, 25 Jul 2019 17:07:23 +0900 (JST)
Subject: [ruby-changes:56659] Nobuyoshi Nakada: 8e53d18e67 (master): Separated tool/test/runner.rb and test/runner.rb
https://git.ruby-lang.org/ruby.git/commit/?id=8e53d18e67 From 8e53d18e6724211bd0597ec5852869e6bf9679f1 Mon Sep 17 00:00:00 2001 From: Nobuyoshi Nakada <nobu@r...> Date: Wed, 24 Jul 2019 11:07:15 +0900 Subject: 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. diff --git a/common.mk b/common.mk index 0d6da60..817dc3f 100644 --- a/common.mk +++ b/common.mk @@ -753,12 +753,12 @@ yes-test-knownbug: prog PHONY https://github.com/ruby/ruby/blob/trunk/common.mk#L753 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 https://github.com/ruby/ruby/blob/trunk/common.mk#L769 # 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 https://github.com/ruby/ruby/blob/trunk/common.mk#L781 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)" diff --git a/defs/gmake.mk b/defs/gmake.mk index 88d90e1..f2808b5 100644 --- a/defs/gmake.mk +++ b/defs/gmake.mk @@ -290,7 +290,7 @@ rdoc\:%: PHONY https://github.com/ruby/ruby/blob/trunk/defs/gmake.mk#L290 $(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)) diff --git a/test/runner.rb b/test/runner.rb new file mode 100644 index 0000000..3e2e131 --- /dev/null +++ b/test/runner.rb @@ -0,0 +1,11 @@ https://github.com/ruby/ruby/blob/trunk/test/runner.rb#L1 +# 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' diff --git a/tool/test/runner.rb b/tool/test/runner.rb index 38e7c04..15b2cdd 100644 --- a/tool/test/runner.rb +++ b/tool/test/runner.rb @@ -1,38 +1,22 @@ https://github.com/ruby/ruby/blob/trunk/tool/test/runner.rb#L1 -# 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 "#{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" +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') + +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) -- cgit v0.10.2 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/