[CFE] Fix leak testing after kernels ast.dart was split into parts

The weekly bot this week finished in half the time, but was green.
Turns out the splitting of ast.dart into parts made the actual leak
testing not work because `Library` no longer existed in `ast.dart` (but
rather in `src/ast/libraries.dart`).

This CL:
1) Fixes the issue by also looking up the libraries uri (which is still
   `ast.dart`.
2) Adds an option for requiring to find instances of some things it
   looks for (e.g. `Library` in kernel) and throw if it doesn't. This
   would have made the weekly bot turn red (fail) instead of being green
  (saying that everything was fine) when really it wasn't.
3) Adds a test that is run on the try bots that will exercise the leak
   finding - and throw if it doesn't find `Library` in kernel.

Change-Id: Ie69bfbd188eb870fdc1e340a341c1271187ef110
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/389162
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>
This commit is contained in:
Jens Johansen
2024-10-10 12:41:16 +00:00
committed by Commit Queue
parent 5333f30e1e
commit de8aa39ff6
9 changed files with 232 additions and 61 deletions
+4
View File
@@ -118,6 +118,7 @@ abstract class ChainContext {
Future<void> run(Chain suite, Set<String> selectors,
{int shards = 1,
int shard = 0,
int? limitTo,
Logger logger = const StdoutLogger()}) async {
assert(shards >= 1, "Invalid shards count: $shards");
assert(0 <= shard && shard < shards,
@@ -147,6 +148,9 @@ abstract class ChainContext {
}
descriptions = shardDescriptions;
}
if (limitTo != null && limitTo > 0 && limitTo < descriptions.length) {
descriptions = descriptions.sublist(0, limitTo);
}
Map<TestDescription, Result> unexpectedResults =
<TestDescription, Result>{};
Map<TestDescription, Set<Expectation>> unexpectedOutcomes =
+2 -1
View File
@@ -51,6 +51,7 @@ Future<void> runMe(List<String> arguments, CreateContext f,
Uri? me,
int shards = 1,
int shard = 0,
int? limitTo,
Logger logger = const StdoutLogger()}) {
me ??= Platform.script;
return withErrorHandling(() async {
@@ -61,7 +62,7 @@ Future<void> runMe(List<String> arguments, CreateContext f,
if (me == suite.source) {
ChainContext context = await f(suite, cl.environment);
await context.run(suite, Set<String>.from(cl.selectors),
shards: shards, shard: shard, logger: logger);
shards: shards, shard: shard, limitTo: limitTo, logger: logger);
}
}
}, logger: logger);