diff --git a/Library/Homebrew/dev-cmd/tests.rb b/Library/Homebrew/dev-cmd/tests.rb index ec512f72cb..e19945baac 100644 --- a/Library/Homebrew/dev-cmd/tests.rb +++ b/Library/Homebrew/dev-cmd/tests.rb @@ -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?