mirror of
https://github.com/Homebrew/brew.git
synced 2025-07-14 16:09:03 +08:00
tests: don't output seed multiple times.
This clutters up the output. Instead, hide it with a RSpec formatter and generate and output it ourselves.
This commit is contained in:
parent
71ebfa76c5
commit
8ed1425ed7
@ -82,17 +82,20 @@ module Homebrew
|
||||
]
|
||||
end
|
||||
|
||||
# Generate seed ourselves and output later to avoid multiple different
|
||||
# seeds being output when running parallel tests.
|
||||
seed = ARGV.include?("--seed") ? ARGV.next : rand(0xFFFF).to_i
|
||||
|
||||
args = ["-I", HOMEBREW_LIBRARY_PATH/"test"]
|
||||
args += %W[
|
||||
--seed #{seed}
|
||||
--color
|
||||
--require spec_helper
|
||||
--format progress
|
||||
--format NoSeedProgressFormatter
|
||||
--format ParallelTests::RSpec::RuntimeLogger
|
||||
--out #{HOMEBREW_CACHE}/tests/parallel_runtime_rspec.log
|
||||
]
|
||||
|
||||
args << "--seed" << ARGV.next if ARGV.include? "--seed"
|
||||
|
||||
unless OS.mac?
|
||||
args << "--tag" << "~needs_macos"
|
||||
files = files.reject { |p| p =~ %r{^test/(os/mac|cask)(/.*|_spec\.rb)$} }
|
||||
@ -102,6 +105,8 @@ module Homebrew
|
||||
files = files.reject { |p| p =~ %r{^test/os/linux(/.*|_spec\.rb)$} }
|
||||
end
|
||||
|
||||
puts "Randomized with seed #{seed}"
|
||||
|
||||
if parallel
|
||||
system "bundle", "exec", "parallel_rspec", *opts, "--", *args, "--", *files
|
||||
else
|
||||
|
@ -5,6 +5,7 @@ require "rspec/wait"
|
||||
require "rubocop"
|
||||
require "rubocop/rspec/support"
|
||||
require "set"
|
||||
require "support/no_seed_progress_formatter"
|
||||
|
||||
if ENV["HOMEBREW_TESTS_COVERAGE"]
|
||||
require "simplecov"
|
||||
|
@ -0,0 +1,7 @@
|
||||
require "rspec/core/formatters/progress_formatter"
|
||||
|
||||
class NoSeedProgressFormatter < RSpec::Core::Formatters::ProgressFormatter
|
||||
RSpec::Core::Formatters.register self, :seed
|
||||
|
||||
def seed(notification); end
|
||||
end
|
Loading…
x
Reference in New Issue
Block a user