diff --git a/dev/devicelab/lib/tasks/run_tests.dart b/dev/devicelab/lib/tasks/run_tests.dart index 21e97771b85..9dc6b3df616 100644 --- a/dev/devicelab/lib/tasks/run_tests.dart +++ b/dev/devicelab/lib/tasks/run_tests.dart @@ -58,7 +58,7 @@ TaskFunction createMacOSRunReleaseTest() { } TaskFunction createWindowsRunDebugTest() { - return DesktopRunOutputTest( + return WindowsRunOutputTest( '${flutterDirectory.path}/dev/integration_tests/ui', 'lib/empty.dart', release: false, @@ -66,7 +66,7 @@ TaskFunction createWindowsRunDebugTest() { } TaskFunction createWindowsRunReleaseTest() { - return DesktopRunOutputTest( + return WindowsRunOutputTest( '${flutterDirectory.path}/dev/integration_tests/ui', 'lib/empty.dart', release: true, @@ -164,6 +164,30 @@ class AndroidRunOutputTest extends RunOutputTask { } } +class WindowsRunOutputTest extends DesktopRunOutputTest { + WindowsRunOutputTest( + super.testDirectory, + super.testTarget, { + required super.release, + super.allowStderr = false, + } + ); + + static final RegExp _buildOutput = RegExp( + r'Building Windows application\.\.\.\s*\d+(\.\d+)?(ms|s)', + multiLine: true, + ); + + @override + void verifyBuildOutput(List stdout) { + _findNextMatcherInList( + stdout, + _buildOutput.hasMatch, + 'Building Windows application...', + ); + } +} + class DesktopRunOutputTest extends RunOutputTask { DesktopRunOutputTest( super.testDirectory, @@ -188,6 +212,8 @@ class DesktopRunOutputTest extends RunOutputTask { 'Launching $testTarget on', ); + verifyBuildOutput(stdout); + _findNextMatcherInList( stdout, (String line) => line.contains('Quit (terminate the application on the device).'), @@ -202,6 +228,9 @@ class DesktopRunOutputTest extends RunOutputTask { return TaskResult.success(null); } + + /// Verify the output from `flutter run`'s build step. + void verifyBuildOutput(List stdout) {} } /// Test that the output of `flutter run` is expected. diff --git a/packages/flutter_tools/lib/src/windows/build_windows.dart b/packages/flutter_tools/lib/src/windows/build_windows.dart index 9de6b499374..e2ebb70ddaf 100644 --- a/packages/flutter_tools/lib/src/windows/build_windows.dart +++ b/packages/flutter_tools/lib/src/windows/build_windows.dart @@ -90,7 +90,7 @@ Future buildWindows(WindowsProject windowsProject, BuildInfo buildInfo, { } await _runBuild(cmakePath, buildDirectory, buildModeName); } finally { - status.cancel(); + status.stop(); } if (buildInfo.codeSizeDirectory != null && sizeAnalyzer != null) { final String arch = getNameForTargetPlatform(TargetPlatform.windows_x64);