[CFE/testing] Faster listing of testcases, especially for spelling_test_not_src_suite
pkg/front_end/test/spelling_test_not_src_suite.dart: Before: Returning 5503 results after 0:00:30.424831 Now: Returning 5503 results after 0:00:00.642866 pkg/front_end/test/textual_outline_suite.dart: Before: Returning 3335 results after 0:00:01.340791 Now: Returning 3335 results after 0:00:00.950186 pkg/front_end/test/outline_suite.dart: Before: Returning 3328 results after 0:00:01.698578 Now: Returning 3328 results after 0:00:00.908465 pkg/front_end/test/strong_suite.dart: Before: Returning 3335 results after 0:00:01.719944 Now: Returning 3335 results after 0:00:00.819222 pkg/front_end/test/modular_suite.dart: Before: Returning 3328 results after 0:00:01.777826 Now: Returning 3328 results after 0:00:00.887345 pkg/front_end/test/lint_suite.dart: Before: Returning 600 results after 0:00:00.035862 Now: Returning 600 results after 0:00:00.016070 pkg/front_end/test/spelling_test_src_suite.dart: Before: Returning 605 results after 0:00:00.027379 Now: Got list of size 605 in 0:00:00.019704 Change-Id: I422b6bd0a4aac6da3d94d500349c3d84bf88cffe Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/498880 Reviewed-by: Johnni Winther <johnniwinther@google.com> Commit-Queue: Jens Johansen <jensj@google.com>
This commit is contained in:
committed by
dart-scoped@luci-project-accounts.iam.gserviceaccount.com
parent
37de43c52f
commit
d93e62b550
@@ -28,16 +28,13 @@ typedef CreateContext =
|
||||
/// A test suite for tool chains, for example, a compiler.
|
||||
class Chain extends Suite {
|
||||
final Uri source;
|
||||
|
||||
final Uri root;
|
||||
|
||||
final List<Uri> subRoots;
|
||||
|
||||
final List<String> includeEndsWith;
|
||||
|
||||
final List<RegExp> pattern;
|
||||
|
||||
final List<RegExp> exclude;
|
||||
final List<String> excludeContains;
|
||||
final List<String> excludeEndsWith;
|
||||
|
||||
Chain(
|
||||
String name,
|
||||
@@ -49,6 +46,8 @@ class Chain extends Suite {
|
||||
this.includeEndsWith,
|
||||
this.pattern,
|
||||
this.exclude,
|
||||
this.excludeContains,
|
||||
this.excludeEndsWith,
|
||||
) : super(name, kind, statusFile);
|
||||
|
||||
factory Chain.fromJsonMap(Uri base, Map json, String name, String kind) {
|
||||
@@ -80,6 +79,12 @@ class Chain extends Suite {
|
||||
List<RegExp> exclude = [
|
||||
for (final e in json['exclude'] ?? const []) RegExp(e),
|
||||
];
|
||||
List<String> excludeContains = List<String>.from(
|
||||
json['excludeContains'] ?? const [],
|
||||
);
|
||||
List<String> excludeEndsWith = List<String>.from(
|
||||
json['excludeEndsWith'] ?? const [],
|
||||
);
|
||||
return Chain(
|
||||
name,
|
||||
kind,
|
||||
@@ -90,6 +95,8 @@ class Chain extends Suite {
|
||||
includeEndsWith,
|
||||
pattern,
|
||||
exclude,
|
||||
excludeContains,
|
||||
excludeEndsWith,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -124,6 +131,8 @@ class Chain extends Suite {
|
||||
"pattern": [for (final r in pattern) r.pattern],
|
||||
"includeEndsWith": includeEndsWith,
|
||||
"exclude": [for (final r in exclude) r.pattern],
|
||||
"excludeContains": excludeContains,
|
||||
"excludeEndsWith": excludeEndsWith,
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -351,7 +360,17 @@ abstract class ChainContext {
|
||||
// Use `.uri.path` instead of just `.path` to ensure forward slashes.
|
||||
String path = entity.uri.path;
|
||||
|
||||
if (suite.exclude.any((RegExp r) => path.contains(r))) continue;
|
||||
if (suite.excludeContains.any((String s) => path.contains(s))) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (suite.excludeEndsWith.any((String s) => path.endsWith(s))) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (suite.exclude.any((RegExp r) => path.contains(r))) {
|
||||
continue;
|
||||
}
|
||||
|
||||
bool include = false;
|
||||
if (suite.includeEndsWith.any((String end) => path.endsWith(end))) {
|
||||
|
||||
Reference in New Issue
Block a user