blob: b6d94f897802ee6e08e76a5a63b40d4e022eddf3 [file] [log] [blame]
// 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.
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;
void 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/test/generated_files_up_to_date_git_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.");
}
}