-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Wrong coverage in mixins #49887
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
Comments
cc @liamappelbe |
Something weird is going on here. I've confirmed that this bug is new in 2.18, but it only happens if I run the test via |
Looks like the wrongCoverage method is missing its source positions, but only when run through @jakemac53 How exactly does |
https://github.com/dart-lang/test/blob/b0a39cc64807152e95075a8a2b7d216c4bf0b05b/pkgs/test_core/lib/src/runner/vm/platform.dart#L154 is the default strategy for spawning isolates, it ends up using frontend server which is spawned with this configuration https://github.com/dart-lang/test/blob/b0a39cc64807152e95075a8a2b7d216c4bf0b05b/pkgs/test_core/lib/src/runner/vm/test_compiler.dart#L161. There hasn't been any change to how it works in a while that I am aware of. @tsinis Another thing you could try out of curiosity is passing |
I've managed to reproduce the bug without going through Bug free dill produced by
Buggy dill produced by
These are identical, except that the order of the 2 library chunks is swapped. In both cases, @alexmarkov Is it possible that the different ordering could cause |
We have some logic for creating and caching Note that |
When library_filters were given, we used to prefill the script_table_, then just assume that any scripts not in the script_table_ must have been filtered out. We wrote it this way to avoid checking the filters in every GetScriptIndex call. But in some cases (eg mixins), lib.LoadedScripts() can miss some scripts, so they'd be incorrectly omitted from the table. The new implementation lazy loads the scripts, the same way it works when there are no library_filters. Skipped scripts are still placed in the script_table_, but given an index of -1, and omitted from script_table_entries_. Bug: #49887 Change-Id: Ide938ddfa9a3750c72c615e296b1a23875e46ab8 TEST=CI (also manually tested that the bug is fixed, but it's a really fiddly setup and I'm not sure how to put it in a unit test. See bug for details) Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/260076 Reviewed-by: Ben Konyi <[email protected]> Commit-Queue: Liam Appelbe <[email protected]>
This issue is blocking us from updating to latest flutter. Thanks for fixing it quick! |
When library_filters were given, we used to prefill the script_table_, then just assume that any scripts not in the script_table_ must have been filtered out. We wrote it this way to avoid checking the filters in every GetScriptIndex call. But in some cases (eg mixins), lib.LoadedScripts() can miss some scripts, so they'd be incorrectly omitted from the table. The new implementation lazy loads the scripts, the same way it works when there are no library_filters. Skipped scripts are still placed in the script_table_, but given an index of -1, and omitted from script_table_entries_. Bug: #49887 Change-Id: Ide938ddfa9a3750c72c615e296b1a23875e46ab8 TEST=CI (also manually tested that the bug is fixed, but it's a really fiddly setup and I'm not sure how to put it in a unit test. See bug for details) Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/260076 Reviewed-by: Ben Konyi <[email protected]> Commit-Queue: Liam Appelbe <[email protected]>
A cherry pick for this was created and released in a stable hot fix, closing this issue. |
Hey Dart Team!
Coverage calculation has changed since 2.18 and is no longer calculating coverage on mixins. Please check by yourself at https://github.com/tsinis/mixins_tests_bug
Just run tests with the coverage flag and you will find out that the
CoverageBug
mixin is not covered even though it's the same as CoverageOk class. It was introduced in Dart 2.18. Thanks!The text was updated successfully, but these errors were encountered: