-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
fix(forge): Don't ignore config.toml when running invariant tests for coverage #6566
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey! thanks for this!
So, I don't see an issue with the code itself—however, invariants right now don't contribute to coverage at all, so this would only really make coverage slower for users in the meanwhile :s. I don't think we wanna get this in before having a proper plan on how to revamp coverage and make invariant testing work with it.
That's weird, I'm running an invariant test and getting some coverage info following this Twitter thread by using
and then checking the output html. The coverage does seem to increase on my test when I increase the number of runs. Maybe I'm getting "fooled by randomness" and it's just a question of seed or something? |
Interesting thread—thanks for sharing. However we do not officially support coverage for invariant tests 😅 so while this might actually be working I'm really wary about this affecting CI to people. Wdyt @mds1 ? |
Not sure if this is a common opinion, but:
As a result, my preference is two coverage modes:
I think people's expectation is that (2) is the default, and perhaps (1) becomes something like I'm not sure where this PR fits into that potential design/UX |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let's go with this for now—we'll respect the invariant settings, and we can add the --strict
mode later.
forge coverage
ignores theconfig.toml
file for invariant tests.Invariant testing in coverage mode thus uses the default 256 runs which is small, making coverage for big invariant tests noisy/useless. This is not the case for regular (non-invariant) tests.
Motivation
This would bring us closer to having invariant tests as contributing fully to coverage (#4007).
Fixes #6565.
Solution
The coverage runner now takes the correct
config
given when running tests.This is my first time writing Rust ever, so do feel free to ignore/rewrite completely.