Test flutter run does not have unexpected engine logs (#116798)
This commit is contained in:
@@ -44,7 +44,7 @@ You must set the `ANDROID_SDK_ROOT` environment variable to run
|
||||
tests on Android. If you have a local build of the Flutter engine, then you have
|
||||
a copy of the Android SDK at `.../engine/src/third_party/android_tools/sdk`.
|
||||
|
||||
You can find where your Android SDK is using `flutter doctor`.
|
||||
You can find where your Android SDK is using `flutter doctor -v`.
|
||||
|
||||
### Warnings
|
||||
|
||||
|
||||
10
dev/devicelab/bin/tasks/run_debug_test_android.dart
Normal file
10
dev/devicelab/bin/tasks/run_debug_test_android.dart
Normal file
@@ -0,0 +1,10 @@
|
||||
// Copyright 2014 The Flutter Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
import 'package:flutter_devicelab/framework/framework.dart';
|
||||
import 'package:flutter_devicelab/tasks/run_tests.dart';
|
||||
|
||||
void main() {
|
||||
task(createAndroidRunDebugTest());
|
||||
}
|
||||
12
dev/devicelab/bin/tasks/run_debug_test_macos.dart
Normal file
12
dev/devicelab/bin/tasks/run_debug_test_macos.dart
Normal file
@@ -0,0 +1,12 @@
|
||||
// Copyright 2014 The Flutter Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
import 'package:flutter_devicelab/framework/devices.dart';
|
||||
import 'package:flutter_devicelab/framework/framework.dart';
|
||||
import 'package:flutter_devicelab/tasks/run_tests.dart';
|
||||
|
||||
void main() {
|
||||
deviceOperatingSystem = DeviceOperatingSystem.macos;
|
||||
task(createMacOSRunDebugTest());
|
||||
}
|
||||
12
dev/devicelab/bin/tasks/run_debug_test_windows.dart
Normal file
12
dev/devicelab/bin/tasks/run_debug_test_windows.dart
Normal file
@@ -0,0 +1,12 @@
|
||||
// Copyright 2014 The Flutter Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
import 'package:flutter_devicelab/framework/devices.dart';
|
||||
import 'package:flutter_devicelab/framework/framework.dart';
|
||||
import 'package:flutter_devicelab/tasks/run_tests.dart';
|
||||
|
||||
Future<void> main() async {
|
||||
deviceOperatingSystem = DeviceOperatingSystem.windows;
|
||||
await task(createWindowsRunDebugTest());
|
||||
}
|
||||
@@ -11,10 +11,25 @@ import '../framework/framework.dart';
|
||||
import '../framework/task_result.dart';
|
||||
import '../framework/utils.dart';
|
||||
|
||||
TaskFunction createAndroidRunDebugTest() {
|
||||
return AndroidRunOutputTest(release: false);
|
||||
}
|
||||
|
||||
TaskFunction createAndroidRunReleaseTest() {
|
||||
return AndroidRunOutputTest(release: true);
|
||||
}
|
||||
|
||||
TaskFunction createMacOSRunDebugTest() {
|
||||
return DesktopRunOutputTest(
|
||||
// TODO(cbracken): https://github.com/flutter/flutter/issues/87508#issuecomment-1043753201
|
||||
// Switch to dev/integration_tests/ui once we have CocoaPods working on M1 Macs.
|
||||
'${flutterDirectory.path}/examples/hello_world',
|
||||
'lib/main.dart',
|
||||
release: false,
|
||||
allowStderr: true,
|
||||
);
|
||||
}
|
||||
|
||||
TaskFunction createMacOSRunReleaseTest() {
|
||||
return DesktopRunOutputTest(
|
||||
// TODO(cbracken): https://github.com/flutter/flutter/issues/87508#issuecomment-1043753201
|
||||
@@ -26,6 +41,14 @@ TaskFunction createMacOSRunReleaseTest() {
|
||||
);
|
||||
}
|
||||
|
||||
TaskFunction createWindowsRunDebugTest() {
|
||||
return DesktopRunOutputTest(
|
||||
'${flutterDirectory.path}/dev/integration_tests/ui',
|
||||
'lib/empty.dart',
|
||||
release: false,
|
||||
);
|
||||
}
|
||||
|
||||
TaskFunction createWindowsRunReleaseTest() {
|
||||
return DesktopRunOutputTest(
|
||||
'${flutterDirectory.path}/dev/integration_tests/ui',
|
||||
@@ -168,6 +191,10 @@ abstract class RunOutputTask {
|
||||
}
|
||||
);
|
||||
|
||||
static final RegExp _engineLogRegex = RegExp(
|
||||
r'\[(VERBOSE|INFO|WARNING|ERROR|FATAL):.+\(\d+\)\]',
|
||||
);
|
||||
|
||||
/// The directory where the app under test is defined.
|
||||
final String testDirectory;
|
||||
/// The main entry-point file of the application, as run on the device.
|
||||
@@ -232,6 +259,13 @@ abstract class RunOutputTask {
|
||||
throw 'flutter run ${release ? '--release' : ''} had unexpected output on standard error.';
|
||||
}
|
||||
|
||||
final List<String> engineLogs = List<String>.from(
|
||||
stdout.where(_engineLogRegex.hasMatch),
|
||||
);
|
||||
if (engineLogs.isNotEmpty) {
|
||||
throw 'flutter run had unexpected Flutter engine logs $engineLogs';
|
||||
}
|
||||
|
||||
return verify(stdout, stderr);
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user