ruby-changes:56540
From: Hiroshi <ko1@a...>
Date: Mon, 15 Jul 2019 11:16:47 +0900 (JST)
Subject: [ruby-changes:56540] Hiroshi SHIBATA: ac6d137157 (master): Added test-tool target for the test suite of tool/test files.
https://git.ruby-lang.org/ruby.git/commit/?id=ac6d137157 From ac6d137157121381fb57e3febd34c84cb7ca47b2 Mon Sep 17 00:00:00 2001 From: Hiroshi SHIBATA <hsbt@r...> Date: Mon, 15 Jul 2019 11:16:05 +0900 Subject: Added test-tool target for the test suite of tool/test files. diff --git a/common.mk b/common.mk index ee8f929..8f45b1e 100644 --- a/common.mk +++ b/common.mk @@ -187,6 +187,7 @@ INSTALL_DATA_MODE = 0644 https://github.com/ruby/ruby/blob/trunk/common.mk#L187 TESTSDIR = $(srcdir)/test TOOL_TESTSDIR = $(srcdir)/tool/test TEST_EXCLUDES = --excludes-dir=$(TESTSDIR)/excludes --name=!/memory_leak/ +EXCLUDE_TESTFRAMEWORK = --exclude=/testunit/ --exclude=/minitest/ TESTWORKDIR = testwork TESTOPTS = $(RUBY_TESTOPTS) @@ -753,9 +754,14 @@ yes-test-knownbug: prog PHONY https://github.com/ruby/ruby/blob/trunk/common.mk#L754 test-testframework: $(TEST_RUNNABLE)-test-testframework yes-test-testframework: prog PHONY - $(gnumake_recursive)$(Q)$(exec) $(RUNRUBY) "$(srcdir)/test/runner.rb" --ruby="$(RUNRUBY)" --basedir=$(TOOL_TESTSDIR) $(TESTOPTS) testunit minitest + $(gnumake_recursive)$(Q)$(exec) $(RUNRUBY) "$(TOOL_TESTSDIR)/runner.rb" --ruby="$(RUNRUBY)" --basedir=$(TOOL_TESTSDIR) $(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" --ruby="$(RUNRUBY)" --basedir=$(TOOL_TESTSDIR) $(TESTOPTS) $(EXCLUDE_TESTFRAMEWORK) +no-test-tool: PHONY + test-sample: test-basic # backward compatibility for mswin-build test-short: btest-ruby test-knownbug test-basic test: test-short diff --git a/tool/test/runner.rb b/tool/test/runner.rb new file mode 100644 index 0000000..64f6df1 --- /dev/null +++ b/tool/test/runner.rb @@ -0,0 +1,39 @@ https://github.com/ruby/ruby/blob/trunk/tool/test/runner.rb#L1 +# frozen_string_literal: false +require 'rbconfig' + +src_testdir = File.dirname(File.realpath(__FILE__)) +$LOAD_PATH << src_testdir +tool_dir = File.join 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") } + +require 'test/unit' + +module Gem +end +class Gem::TestCase < MiniTest::Unit::TestCase + @@project_dir = File.dirname($LOAD_PATH.last) +end + +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" +end + +begin + exit Test::Unit::AutoRunner.run(true, src_testdir) +rescue NoMemoryError + system("cat /proc/meminfo") if File.exist?("/proc/meminfo") + system("ps x -opid,args,%cpu,%mem,nlwp,rss,vsz,wchan,stat,start,time,etime,blocked,caught,ignored,pending,f") if File.exist?("/bin/ps") + raise +end -- cgit v0.10.2 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/