Added --env option to mspec for test-bundled-gems

This commit is contained in:
Hiroshi SHIBATA 2024-11-27 14:22:40 +09:00
parent 671e6eb644
commit 26aebdb6d6
Notes: git 2024-11-27 07:45:41 +00:00
4 changed files with 13 additions and 3 deletions

View File

@ -1646,8 +1646,9 @@ test-bundled-gems-spec: $(TEST_RUNNABLE)-test-bundled-gems-spec
yes-test-bundled-gems-spec: yes-test-spec-precheck $(PREPARE_BUNDLED_GEMS)
$(ACTIONS_GROUP)
$(gnumake_recursive)$(Q) \
BUNDLED_GEMS=$(BUNDLED_GEMS) $(RUNRUBY) -r./$(arch)-fake -r$(tooldir)/lib/_tmpdir \
$(srcdir)/spec/mspec/bin/mspec run -B $(srcdir)/spec/bundled_gems.mspec $(MSPECOPT) $(SPECOPTS)
$(RUNRUBY) -r./$(arch)-fake -r$(tooldir)/lib/_tmpdir \
$(srcdir)/spec/mspec/bin/mspec run --env BUNDLED_GEMS=$(BUNDLED_GEMS) -B $(srcdir)/spec/bundled_gems.mspec \
$(MSPECOPT) $(SPECOPTS)
$(ACTIONS_ENDGROUP)
no-test-bundled-gems-spec:

View File

@ -2,7 +2,7 @@ load File.dirname(__FILE__) + '/default.mspec'
class MSpecScript
test_bundled_gems = get(:stdlibs).to_a & get(:bundled_gems).to_a
unless ENV["BUNDLED_GEMS"].empty?
unless ENV["BUNDLED_GEMS"].nil?
test_bundled_gems = ENV["BUNDLED_GEMS"].split(",").map do |gem|
test_bundled_gems.find{|test_gem| test_gem.include?(gem) }
end.compact

View File

@ -32,6 +32,7 @@ class MSpecRun < MSpecScript
options.chdir
options.prefix
options.configure { |f| load f }
options.env
options.randomize
options.repeat
options.pretend

View File

@ -204,6 +204,13 @@ class MSpecOptions
"Load FILE containing configuration options", &block)
end
def env
on("--env", "KEY=VALUE", "Set environment variable") do |env|
key, value = env.split('=', 2)
ENV[key] = value
end
end
def targets
on("-t", "--target", "TARGET",
"Implementation to run the specs, where TARGET is:") do |t|
@ -484,6 +491,7 @@ class MSpecOptions
def all
configure {}
env
targets
formatters
filters