modify test_runner.dart for windows to fix test build errors (flutter/engine#15326)
This commit is contained in:
committed by
Flutter GitHub Bot
parent
6d0f0f9cf0
commit
0e59dd9f6d
@@ -60,6 +60,12 @@ class TestCommand extends Command<bool> {
|
||||
|
||||
_copyTestFontsIntoWebUi();
|
||||
await _buildHostPage();
|
||||
if (io.Platform.isWindows) {
|
||||
// On Dart 2.7 or greater, it gives an error for not
|
||||
// recognized "pub" version and asks for "pub" get.
|
||||
// See: https://github.com/dart-lang/sdk/issues/39738
|
||||
await _runPubGet();
|
||||
}
|
||||
|
||||
final List<FilePath> targets =
|
||||
this.targets.map((t) => FilePath.fromCwd(t)).toList();
|
||||
@@ -162,7 +168,9 @@ class TestCommand extends Command<bool> {
|
||||
// Not a test file at all. Skip.
|
||||
continue;
|
||||
}
|
||||
if(!path.split(testFilePath.relativeToWebUi).contains('golden_tests')) {
|
||||
if (!path
|
||||
.split(testFilePath.relativeToWebUi)
|
||||
.contains('golden_tests')) {
|
||||
unitTestFiles.add(testFilePath);
|
||||
}
|
||||
}
|
||||
@@ -179,6 +187,22 @@ class TestCommand extends Command<bool> {
|
||||
}
|
||||
}
|
||||
|
||||
Future<void> _runPubGet() async {
|
||||
final int exitCode = await runProcess(
|
||||
environment.pubExecutable,
|
||||
<String>[
|
||||
'get',
|
||||
],
|
||||
workingDirectory: environment.webUiRootDir.path,
|
||||
);
|
||||
|
||||
if (exitCode != 0) {
|
||||
io.stderr
|
||||
.writeln('Failed to run pub get. Exited with exit code $exitCode');
|
||||
io.exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
Future<void> _buildHostPage() async {
|
||||
final String hostDartPath = path.join('lib', 'static', 'host.dart');
|
||||
final io.File hostDartFile = io.File(path.join(
|
||||
|
||||
@@ -43,6 +43,9 @@ Future<int> runProcess(
|
||||
executable,
|
||||
arguments,
|
||||
workingDirectory: workingDirectory,
|
||||
// Running the process in a system shell for Windows. Otherwise
|
||||
// the process is not able to get Dart from path.
|
||||
runInShell: io.Platform.isWindows,
|
||||
mode: io.ProcessStartMode.inheritStdio,
|
||||
);
|
||||
final int exitCode = await process.exitCode;
|
||||
|
||||
Reference in New Issue
Block a user