Allow to run 'make test-bundled-gems BUNDLED_GEMS=csv,rexml' for only testing csv and rexml

This commit is contained in:
Hiroshi SHIBATA 2024-11-27 12:40:10 +09:00
parent 24889e44f7
commit 9349e98be2
Notes: git 2024-11-27 07:45:43 +00:00
2 changed files with 7 additions and 2 deletions

View File

@ -6,7 +6,9 @@ BEGIN {
color = Colorize.new
if ARGV.first.start_with?("BUNDLED_GEMS=")
bundled_gems = ARGV.shift[13..-1].split(" ")
bundled_gems = ARGV.shift[13..-1]
sep = bundled_gems.include?(",") ? "," : " "
bundled_gems = bundled_gems.split(sep)
bundled_gems = nil if bundled_gems.empty?
end

View File

@ -11,6 +11,9 @@ github_actions = ENV["GITHUB_ACTIONS"] == "true"
allowed_failures = ENV['TEST_BUNDLED_GEMS_ALLOW_FAILURES'] || ''
allowed_failures = allowed_failures.split(',').reject(&:empty?)
# make test-bundled-gems BUNDLED_GEMS=gem1,gem2,gem3
bundled_gems = ARGV.first || ''
colorize = Colorize.new
rake = File.realpath("../../.bundle/bin/rake", __FILE__)
gem_dir = File.realpath('../../gems', __FILE__)
@ -21,7 +24,7 @@ failed = []
File.foreach("#{gem_dir}/bundled_gems") do |line|
next if /^\s*(?:#|$)/ =~ line
gem = line.split.first
next unless ARGV.empty? or ARGV.any? {|pat| File.fnmatch?(pat, gem)}
next unless bundled_gems.delete_prefix("BUNDLED_GEMS=").split(",").include?(gem)
next unless File.directory?("#{gem_dir}/src/#{gem}/test")
test_command = "#{ruby} -C #{gem_dir}/src/#{gem} #{rake} test"