Disable parallel for small test coverage runs #19067
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
brew style
with your changes locally?brew typecheck
with your changes locally?brew tests
with your changes locally?brew tests --coverage
can fail to produce coverage information when run on a small number of tests (e.g.,--only utils/curl
). We useParallelTests::last_process?
intests/spec_helper.rb
to handle the SimpleCov output but due to the way 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 cores.For example, this is the current output for a small run (no coverage generated):
This is the output with this change (coverage generated as expected):
I tried to address this through changes to
spec_helper.rb
and/or changes toParallelTests
but didn't meet with any success.This works around the issue by disabling parallel test execution when the
--coverage
option is used and the number of files to be tested is lower than the number of CPU cores. I've been using this workaround for months and it works as expected on my machine (M1 Pro and now M4 Pro).