3 if (opt = ENV["RUBYOPT"]) and (opt = opt.dup).sub!(/(?:\A|\s)-w(?=\z|\s)/, '')
7 # Enable constant leak checks by ruby/mspec
8 ENV["CHECK_CONSTANT_LEAKS"] ||= "true"
10 require "./rbconfig" unless defined?(RbConfig)
11 require_relative "../tool/test-coverage" if ENV.key?("COVERAGE")
12 load File.dirname(__FILE__) + '/ruby/default.mspec'
13 OBJDIR = File.expand_path("spec/ruby/optional/capi/ext") unless defined?(OBJDIR)
18 srcdir = ENV['SRCDIR']
19 srcdir ||= File.read("Makefile", encoding: "US-ASCII")[/^\s*srcdir\s*=\s*(.+)/i, 1] rescue nil
20 config = RbConfig::CONFIG
22 # The default implementation to run the specs.
23 set :target, File.join(builddir, "miniruby#{config['exeext']}")
24 set :prefix, File.expand_path('ruby', File.dirname(__FILE__))
26 srcdir = File.expand_path(srcdir)
29 #{srcdir}/tool/runruby.rb --archdir=#{builddir} --extout=#{config['EXTOUT']}
34 # Disable to run for bundled gems in test-spec
35 set :bundled_gems, (File.readlines("#{srcdir}/gems/bundled_gems").map do |line|
36 next if /^\s*(?:#|$)/ =~ line
37 "#{srcdir}/spec/ruby/library/" + line.split.first
39 set :stdlibs, Dir.glob("#{srcdir}/spec/ruby/library/*")
40 set :library, get(:stdlibs).to_a - get(:bundled_gems).to_a
42 set :files, get(:command_line) + get(:language) + get(:core) + get(:library) + get(:security) + get(:optional)
44 if ENV.key?("COVERAGE")
45 set :excludes, ["Coverage"]
49 module MSpecScript::JobServer
51 if max > 1 and /(?:\A|\s)--jobserver-(?:auth|fds)=(\d+),(\d+)/ =~ ENV["MAKEFLAGS"]
54 r = IO.for_fd($1.to_i(10), "rb", autoclose: false)
55 w = IO.for_fd($2.to_i(10), "wb", autoclose: false)
56 jobtokens = r.read_nonblock(max - 1)
57 cores = jobtokens.size
63 jobserver.print(jobtokens)
66 MSpecScript::JobServer.module_eval do
68 define_method(:cores) do
88 require 'mspec/runner/formatters/dotted'
92 BASE = __dir__ + "/ruby/" unless defined?(BASE)
94 def initialize(out = nil)
99 columns = ENV["COLUMNS"]&.to_i
100 @columns = columns&.nonzero? || 80
109 MSpec.register :load, self
110 MSpec.register :unload, self
116 s = sprintf("%6d ", @count)
123 if @columns and (@dotted += 1) >= @columns
130 file = MSpec.file || MSpec.files_array.first
132 s = "#{file.delete_prefix(BASE)}:"
135 if (@dotted += s.size) >= @columns
149 print "\n" if @dotted > 0