d810c7d0c0
This commit was generated by the following steps: - Manually change the SDK constraint in `pkg/front_end/pubspec.yaml` - Run `gclient sync` - Run `find pkg/front_end/benchmarks pkg/front_end/lib pkg/front_end/presubmit_helper.dart pkg/front_end/presubmit_helper_spawn.dart pkg/front_end/test pkg/front_end/tool -iname '*.dart' | xargs tools/sdks/dart-sdk/bin/dart format` - Manually fix remaining long lines and add dead code ignore comments. - Fix coverage by running `dart --enable-asserts pkg/front_end/test/coverage_suite.dart --tasks=5 --add-and-remove-comments` - Fix `pkg/front_end/test/coverage_merger/assert_message_auto_ignored` by running `dart pkg/front_end/test/unit_test_suites.dart -p pkg/front_end/test/coverage_merger/assert_message_auto_ignored -DupdateExpectations=true` The diff is large because the version bump causes the formatter to switch into "tall mode". Change-Id: I6a6a696410da8b168060acfe0e4d6e91e294c4f0 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/447628 Auto-Submit: Paul Berry <paulberry@google.com> Reviewed-by: Johnni Winther <johnniwinther@google.com> Commit-Queue: Johnni Winther <johnniwinther@google.com>
103 lines
3.1 KiB
Dart
103 lines
3.1 KiB
Dart
// Copyright (c) 2020, the Dart project authors. Please see the AUTHORS file
|
|
// for details. All rights reserved. Use of this source code is governed by a
|
|
// BSD-style license that can be found in the LICENSE file.
|
|
|
|
import 'dart:io' show Directory, File, FileSystemEntity, Process, ProcessResult;
|
|
|
|
import 'package:testing/testing.dart' show Chain, TestDescription;
|
|
|
|
Future<List<TestDescription>> filterList(
|
|
Chain suite,
|
|
bool onlyInGit,
|
|
List<TestDescription> base,
|
|
) async {
|
|
Set<Uri> gitFiles = {};
|
|
if (onlyInGit) {
|
|
for (Uri subRoot in suite.subRoots) {
|
|
gitFiles.addAll(await getGitFiles(subRoot));
|
|
}
|
|
}
|
|
List<TestDescription> result = [];
|
|
for (TestDescription description in base) {
|
|
if (onlyInGit && !gitFiles.contains(description.uri)) {
|
|
continue;
|
|
}
|
|
result.add(description);
|
|
}
|
|
return result;
|
|
}
|
|
|
|
Future<Set<Uri>> getGitFiles(Uri uri) async {
|
|
ProcessResult result = await Process.run(
|
|
"git",
|
|
["ls-files", "."],
|
|
workingDirectory: new Directory.fromUri(uri).absolute.path,
|
|
runInShell: true,
|
|
);
|
|
if (result.exitCode != 0) {
|
|
throw "Git returned non-zero error code (${result.exitCode}):\n\n"
|
|
"stdout: ${result.stdout}\n\n"
|
|
"stderr: ${result.stderr}";
|
|
}
|
|
String stdout = result.stdout;
|
|
return stdout
|
|
.split(new RegExp('^', multiLine: true))
|
|
.map((line) => uri.resolve(line.trimRight()))
|
|
.toSet();
|
|
}
|
|
|
|
void checkEnvironment(
|
|
Map<String, String> environment,
|
|
Set<String> knownEnvironmentKeys,
|
|
) {
|
|
Set<String> environmentKeys = environment.keys.toSet();
|
|
environmentKeys.removeAll(knownEnvironmentKeys);
|
|
if (environmentKeys.isNotEmpty) {
|
|
throw "Unknown environment(s) given:"
|
|
"\n - ${environmentKeys.join("\n- ")}\n"
|
|
"Knows about these environment(s):"
|
|
"\n - ${knownEnvironmentKeys.join("\n - ")}";
|
|
}
|
|
}
|
|
|
|
Future<List<Uri>> computeSourceFiles(Uri repoDir) async {
|
|
Set<Uri> libUris = {};
|
|
libUris.add(repoDir.resolve("pkg/front_end/lib/"));
|
|
libUris.add(repoDir.resolve("pkg/front_end/test/"));
|
|
libUris.add(repoDir.resolve("pkg/front_end/tool/"));
|
|
|
|
List<String> dataDirectories = [
|
|
'pkg/front_end/test/class_hierarchy/data/',
|
|
'pkg/front_end/test/extensions/data/',
|
|
'pkg/front_end/test/id_testing/data/',
|
|
'pkg/front_end/test/language_versioning/data/',
|
|
'pkg/front_end/test/macros/application/data/',
|
|
'pkg/front_end/test/macros/declaration/data/',
|
|
'pkg/front_end/test/macros/incremental/data/',
|
|
'pkg/front_end/test/patching/data/',
|
|
'pkg/front_end/test/scopes/data/',
|
|
'pkg/front_end/test/static_types/data/',
|
|
];
|
|
|
|
List<Uri> inputs = [];
|
|
for (Uri uri in libUris) {
|
|
Set<Uri> gitFiles = await getGitFiles(uri);
|
|
List<FileSystemEntity> entities = new Directory.fromUri(
|
|
uri,
|
|
).listSync(recursive: true);
|
|
for (FileSystemEntity entity in entities) {
|
|
if (entity is File &&
|
|
entity.path.endsWith(".dart") &&
|
|
gitFiles.contains(entity.uri)) {
|
|
if (dataDirectories.any(
|
|
(exclude) => entity.uri.path.contains(exclude),
|
|
)) {
|
|
continue;
|
|
}
|
|
inputs.add(entity.uri);
|
|
}
|
|
}
|
|
}
|
|
return inputs;
|
|
}
|