Skip to content

Commit

Permalink
[CFE] add --updateExpectations to coverage suite
Browse files Browse the repository at this point in the history
So running `pkg/front_end/test/coverage_suite.dart --updateExpectations`
will update `pkg/front_end/test/coverage_suite_expected.dart` and a `git
diff` will give an overview of what changed.

Also save both number of hits and number of misses in the
"expect-file". If nothing else it will give some context
about what has changed.

Also cleanup json coverage output to be sorted and not
include "misses" that are also "hits" (the VM can give
this information).

Change-Id: I426681dde3d4d2ad0a9a7dfa474292c699223d68
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/370520
Reviewed-by: Johnni Winther <[email protected]>
Commit-Queue: Jens Johansen <[email protected]>
  • Loading branch information
jensjoha authored and Commit Queue committed Jun 11, 2024
1 parent 4be693a commit 5a49a95
Show file tree
Hide file tree
Showing 3 changed files with 1,053 additions and 313 deletions.
8 changes: 5 additions & 3 deletions pkg/front_end/test/coverage_helper.dart
Original file line number Diff line number Diff line change
Expand Up @@ -203,14 +203,16 @@ class FileCoverage {

Map<String, Object?> toJson() {
List<int> notCompiledRanges = [];
for (var pair in notCompiled) {
for (var pair in notCompiled.toList()
..sort((a, b) => a.startPos.compareTo(b.startPos))) {
notCompiledRanges.add(pair.startPos);
notCompiledRanges.add(pair.endPos);
}
misses.removeAll(hits);
return {
"uri": uri.toString(),
"hits": hits.toList(),
"misses": misses.toList(),
"hits": hits.toList()..sort(),
"misses": misses.toList()..sort(),
"notCompiledRanges": notCompiledRanges,
};
}
Expand Down
Loading

0 comments on commit 5a49a95

Please sign in to comment.