Merge pull request #19067 from Homebrew/single-process-test-coverage

Disable parallel for small test coverage runs
This commit is contained in:
Sam Ford 2025-01-11 00:53:11 +00:00 committed by GitHub
commit e4fd34c13b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -3,6 +3,7 @@
require "abstract_command"
require "fileutils"
require "hardware"
require "system_command"
module Homebrew
@ -75,7 +76,13 @@ module Homebrew
end
end
parallel = false if args.profile
# We use `ParallelTests.last_process?` in `test/spec_helper.rb` to
# handle SimpleCov output but, due to how the method is implemented,
# it doesn't work as expected if the number of processes is greater
# than one but lower than the number of CPU cores in the execution
# environment. Coverage information isn't saved in that scenario,
# so we disable parallel testing as a workaround in this case.
parallel = false if args.profile || (args.coverage? && files.length < Hardware::CPU.cores)
parallel_rspec_log_name = "parallel_runtime_rspec"
parallel_rspec_log_name = "#{parallel_rspec_log_name}.generic" if args.generic?