Files
sdk/pkg/front_end/tool/smoke_test_quick.dart
T
Jens Johansen 30ae8e3d14 [CFE] Rename tests that require git; split unit_test_suites; filter tests better
This CL is a warm-up to a follow-up change that will make running the
CFE trybot faster.
This CL:
* Rename tests that require git (because when working with filesets
  and shards in the test system, the "checkout" is not a git checkout
  and git commands thus doesn't work properly.
* Filters the front-end unit test setup on the front-end bot the way
  it was probably intended, i.e. run tests in pkg/kernel, pkg/front_end
  and pkg/fasta (actually, the last one doesn't exist, but still)
  instead of just in folders inside the "suite" 'pkg' that somewhere in
  the path has something called 'kernel', 'front_end' or 'fasta'.
* Split unit_test_suites.dart into a "forwarding shell" and a impl.
  In a follow-up CL the impl will be converted to nnbd to allow for
  using 'required' on named parameters, but if the entry point was
  nnbd it would run in sound nnbd mode and nothing would compile
  because all imports are not nnbd.

Overall this CL should change very little, mostly just run a few less
tests, i.e. for instance skip tests that live inside a folder called
'fasta' somewhere inside the analyzer directory path.

Change-Id: I3226c7261cff8b68cc287cff07dc1715dfd85159
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/181381
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>
2021-01-28 07:46:10 +00:00

82 lines
2.7 KiB
Dart

// Copyright (c) 2019, 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.
// @dart=2.9
import 'dart:io' show Platform, Process, ProcessResult, exitCode;
import '../test/utils/io_utils.dart' show computeRepoDir;
final String repoDir = computeRepoDir();
String get dartVm => Platform.executable;
main(List<String> args) async {
Stopwatch stopwatch = new Stopwatch()..start();
List<Future> futures = <Future>[];
futures.add(run("pkg/front_end/test/explicit_creation_git_test.dart",
["--front-end-only"],
filter: false));
futures.add(run(
"pkg/front_end/test/fasta/messages_suite.dart",
["-DfastOnly=true"],
));
futures.add(run("pkg/front_end/test/spelling_test_not_src_suite.dart", []));
futures.add(run("pkg/front_end/test/spelling_test_src_suite.dart",
["--", "spelling_test_src/front_end/..."]));
futures.add(
run("pkg/front_end/test/lint_suite.dart", ["--", "lint/front_end/..."]));
futures.add(run("pkg/front_end/test/deps_git_test.dart", [], filter: false));
futures.add(run(
"pkg/front_end/tool/_fasta/generate_experimental_flags_test.dart", [],
filter: false));
await Future.wait(futures);
print("\n-----------------------\n");
print("Done with exitcode $exitCode in ${stopwatch.elapsedMilliseconds} ms");
}
Future<void> run(String script, List<String> scriptArguments,
{bool filter: true}) async {
List<String> arguments = [];
arguments.add("$script");
arguments.addAll(scriptArguments);
Stopwatch stopwatch = new Stopwatch()..start();
ProcessResult result =
await Process.run(dartVm, arguments, workingDirectory: repoDir);
String runWhat = "${dartVm} ${arguments.join(' ')}";
if (result.exitCode != 0) {
exitCode = result.exitCode;
print("-----");
print("Running: $runWhat: "
"Failed with exit code ${result.exitCode} "
"in ${stopwatch.elapsedMilliseconds} ms.");
String stdout = result.stdout.toString();
if (filter) {
List<String> lines = stdout.split("\n");
int lastIgnored = -1;
for (int i = 0; i < lines.length; i++) {
if (lines[i].startsWith("[ ")) lastIgnored = i;
}
lines.removeRange(0, lastIgnored + 1);
stdout = lines.join("\n");
}
stdout = stdout.trim();
if (stdout.isNotEmpty) {
print("--- stdout start ---");
print(stdout);
print("--- stdout end ---");
}
String stderr = result.stderr.toString().trim();
if (stderr.isNotEmpty) {
print("--- stderr start ---");
print(stderr);
print("--- stderr end ---");
}
} else {
print("Running: $runWhat: Done in ${stopwatch.elapsedMilliseconds} ms.");
}
}