This commit is contained in:
Benoit Daloze 2020-02-28 19:07:14 +01:00
parent a8687f3ef8
commit 5d21050182
4 changed files with 7 additions and 8 deletions

View File

@ -3,11 +3,9 @@
# should clean up any temporary files created so that the temp # should clean up any temporary files created so that the temp
# directory is empty when the process exits. # directory is empty when the process exits.
SPEC_TEMP_DIR = File.expand_path(ENV["SPEC_TEMP_DIR"] || "rubyspec_temp")
SPEC_TEMP_UNIQUIFIER = "0"
SPEC_TEMP_DIR_PID = Process.pid SPEC_TEMP_DIR_PID = Process.pid
SPEC_TEMP_DIR = File.expand_path(ENV["SPEC_TEMP_DIR"] || "rubyspec_temp/#{SPEC_TEMP_DIR_PID}")
SPEC_TEMP_UNIQUIFIER = "0"
at_exit do at_exit do
begin begin
@ -31,7 +29,7 @@ all specs are cleaning up temporary files:
end end
def tmp(name, uniquify = true) def tmp(name, uniquify = true)
Dir.mkdir SPEC_TEMP_DIR unless Dir.exist? SPEC_TEMP_DIR mkdir_p SPEC_TEMP_DIR unless Dir.exist? SPEC_TEMP_DIR
if uniquify and !name.empty? if uniquify and !name.empty?
slash = name.rindex "/" slash = name.rindex "/"

View File

@ -15,7 +15,7 @@ class ParallelRunner
@output_files << name @output_files << name
env = { env = {
"SPEC_TEMP_DIR" => "rubyspec_temp_#{i}", "SPEC_TEMP_DIR" => "#{SPEC_TEMP_DIR}_#{i}",
"MSPEC_MULTI" => i.to_s "MSPEC_MULTI" => i.to_s
} }
command = @argv + ["-fy", "-o", name] command = @argv + ["-fy", "-o", name]

View File

@ -4,7 +4,7 @@ require 'mspec/helpers'
describe Object, "#tmp" do describe Object, "#tmp" do
before :all do before :all do
@dir = "#{File.expand_path(Dir.pwd)}/rubyspec_temp" @dir = SPEC_TEMP_DIR
end end
it "returns a name relative to the current working directory" do it "returns a name relative to the current working directory" do

View File

@ -158,7 +158,8 @@ def test_new_specs
require "yaml" require "yaml"
Dir.chdir(SOURCE_REPO) do Dir.chdir(SOURCE_REPO) do
workflow = YAML.load_file(".github/workflows/ci.yml") workflow = YAML.load_file(".github/workflows/ci.yml")
versions = workflow.dig("jobs", "test", "strategy", "matrix", "ruby") job_name = MSPEC ? "test" : "specs"
versions = workflow.dig("jobs", job_name, "strategy", "matrix", "ruby")
versions = versions.grep(/^\d+\./) # Test on MRI versions = versions.grep(/^\d+\./) # Test on MRI
min_version, max_version = versions.minmax min_version, max_version = versions.minmax