-
Notifications
You must be signed in to change notification settings - Fork 553
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
simplecov inaccurate number of relevant lines when using parallel_tests #542
Comments
Hi there, thanks for your issue report. I'm not quite sure and it's difficult to say from a distance. In general it seems weird that more lines would be skipped with parallel_tests - the behaviour there should be consistent. Personally I've only seen cases where single process rspec reported more coverage than multiprocess (with command_name not set etc.) From your setup, what I can say looks odd to me is setting the Also you shouldn't need the Pid of the rspec process as that should always be the same for one Are you sure that simplecov is started BEFORE everything else? |
Likely related to #559 , because if a semaphore is not used correctly, any result is possible. |
I'd have to review the code but I don't think there's a semaphore/mutex whatever in there since we run in separate processes not in different threads. Might still be a race condition though. |
As I explained in #559 , it looks like in archeology of SimpleCov, a Multi-threading (or -processing) Lock pattern existed in a previous PR #185 commit 4f3b4c7 that got lost to entropy. It probably needs to be brought back. You can't have multiple processes merging results into the same result-set and not have some kind of a lock to protect them from corrupting the shared state. |
I've tried every lock-variation of SimpleCov: |
That lock was brought back in a recent PR and will be released soon --> should be good once we release a enw version/can try from master |
I am still getting very inaccurate rspec coverage when using parallel_tests vs single process rspec.
89% coverage with parallel_tests vs 67% with single process rspec.
Looking at the simplecov-html output many lines are dismissed as irrelevant and skipped.
For example with single process rspec a file has 150 lines 130 being relevant and 50 being missed whereas with parallel_tests the file has only 8 lines being relevant and 0 being missed for 100% coverage which is wrong.
Is there some trick to getting the results merged properly? I am using
in my spec/spec_helper.rb
Here's the gems and version info
Thanks,
Matt
edit: edited for code readability! @PragTob
The text was updated successfully, but these errors were encountered: