[Linux] Add a 'flutter run' console output test (#118279)
* Add Linux support for the UI integration test project * Add Linux run console test
This commit is contained in:
12
dev/devicelab/bin/tasks/run_debug_test_linux.dart
Normal file
12
dev/devicelab/bin/tasks/run_debug_test_linux.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.linux;
|
||||
await task(createLinuxRunDebugTest());
|
||||
}
|
||||
12
dev/devicelab/bin/tasks/run_release_test_linux.dart
Normal file
12
dev/devicelab/bin/tasks/run_release_test_linux.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.linux;
|
||||
await task(createLinuxRunReleaseTest());
|
||||
}
|
||||
@@ -58,6 +58,7 @@ enum DeviceOperatingSystem {
|
||||
fake,
|
||||
fuchsia,
|
||||
ios,
|
||||
linux,
|
||||
macos,
|
||||
windows,
|
||||
}
|
||||
@@ -79,6 +80,8 @@ abstract class DeviceDiscovery {
|
||||
return IosDeviceDiscovery();
|
||||
case DeviceOperatingSystem.fuchsia:
|
||||
return FuchsiaDeviceDiscovery();
|
||||
case DeviceOperatingSystem.linux:
|
||||
return LinuxDeviceDiscovery();
|
||||
case DeviceOperatingSystem.macos:
|
||||
return MacosDeviceDiscovery();
|
||||
case DeviceOperatingSystem.windows:
|
||||
@@ -356,6 +359,40 @@ class AndroidDeviceDiscovery implements DeviceDiscovery {
|
||||
}
|
||||
}
|
||||
|
||||
class LinuxDeviceDiscovery implements DeviceDiscovery {
|
||||
factory LinuxDeviceDiscovery() {
|
||||
return _instance ??= LinuxDeviceDiscovery._();
|
||||
}
|
||||
|
||||
LinuxDeviceDiscovery._();
|
||||
|
||||
static LinuxDeviceDiscovery? _instance;
|
||||
|
||||
static const LinuxDevice _device = LinuxDevice();
|
||||
|
||||
@override
|
||||
Future<Map<String, HealthCheckResult>> checkDevices() async {
|
||||
return <String, HealthCheckResult>{};
|
||||
}
|
||||
|
||||
@override
|
||||
Future<void> chooseWorkingDevice() async { }
|
||||
|
||||
@override
|
||||
Future<void> chooseWorkingDeviceById(String deviceId) async { }
|
||||
|
||||
@override
|
||||
Future<List<String>> discoverDevices() async {
|
||||
return <String>['linux'];
|
||||
}
|
||||
|
||||
@override
|
||||
Future<void> performPreflightTasks() async { }
|
||||
|
||||
@override
|
||||
Future<Device> get workingDevice async => _device;
|
||||
}
|
||||
|
||||
class MacosDeviceDiscovery implements DeviceDiscovery {
|
||||
factory MacosDeviceDiscovery() {
|
||||
return _instance ??= MacosDeviceDiscovery._();
|
||||
@@ -1046,6 +1083,58 @@ class IosDevice extends Device {
|
||||
}
|
||||
}
|
||||
|
||||
class LinuxDevice extends Device {
|
||||
const LinuxDevice();
|
||||
|
||||
@override
|
||||
String get deviceId => 'linux';
|
||||
|
||||
@override
|
||||
Future<Map<String, dynamic>> getMemoryStats(String packageName) async {
|
||||
return <String, dynamic>{};
|
||||
}
|
||||
|
||||
@override
|
||||
Future<void> home() async { }
|
||||
|
||||
@override
|
||||
Future<bool> isAsleep() async {
|
||||
return false;
|
||||
}
|
||||
|
||||
@override
|
||||
Future<bool> isAwake() async {
|
||||
return true;
|
||||
}
|
||||
|
||||
@override
|
||||
Stream<String> get logcat => const Stream<String>.empty();
|
||||
|
||||
@override
|
||||
Future<void> clearLogs() async {}
|
||||
|
||||
@override
|
||||
Future<void> reboot() async { }
|
||||
|
||||
@override
|
||||
Future<void> sendToSleep() async { }
|
||||
|
||||
@override
|
||||
Future<void> stop(String packageName) async { }
|
||||
|
||||
@override
|
||||
Future<void> tap(int x, int y) async { }
|
||||
|
||||
@override
|
||||
Future<void> togglePower() async { }
|
||||
|
||||
@override
|
||||
Future<void> unlock() async { }
|
||||
|
||||
@override
|
||||
Future<void> wakeUp() async { }
|
||||
}
|
||||
|
||||
class MacosDevice extends Device {
|
||||
const MacosDevice();
|
||||
|
||||
|
||||
@@ -716,6 +716,7 @@ class StartupTest {
|
||||
break;
|
||||
case DeviceOperatingSystem.fake:
|
||||
case DeviceOperatingSystem.fuchsia:
|
||||
case DeviceOperatingSystem.linux:
|
||||
break;
|
||||
case DeviceOperatingSystem.ios:
|
||||
case DeviceOperatingSystem.macos:
|
||||
@@ -860,6 +861,7 @@ class DevtoolsStartupTest {
|
||||
break;
|
||||
case DeviceOperatingSystem.fake:
|
||||
case DeviceOperatingSystem.fuchsia:
|
||||
case DeviceOperatingSystem.linux:
|
||||
case DeviceOperatingSystem.macos:
|
||||
case DeviceOperatingSystem.windows:
|
||||
break;
|
||||
@@ -1571,6 +1573,8 @@ class CompileTest {
|
||||
throw Exception('Unsupported option for fake devices');
|
||||
case DeviceOperatingSystem.fuchsia:
|
||||
throw Exception('Unsupported option for Fuchsia devices');
|
||||
case DeviceOperatingSystem.linux:
|
||||
throw Exception('Unsupported option for Linux devices');
|
||||
case DeviceOperatingSystem.windows:
|
||||
unawaited(stderr.flush());
|
||||
options.insert(0, 'windows');
|
||||
@@ -1634,6 +1638,8 @@ class CompileTest {
|
||||
throw Exception('Unsupported option for fake devices');
|
||||
case DeviceOperatingSystem.fuchsia:
|
||||
throw Exception('Unsupported option for Fuchsia devices');
|
||||
case DeviceOperatingSystem.linux:
|
||||
throw Exception('Unsupported option for Linux devices');
|
||||
case DeviceOperatingSystem.macos:
|
||||
unawaited(stderr.flush());
|
||||
options.insert(0, 'macos');
|
||||
@@ -1687,6 +1693,7 @@ class CompileTest {
|
||||
case DeviceOperatingSystem.androidArm64:
|
||||
case DeviceOperatingSystem.fake:
|
||||
case DeviceOperatingSystem.fuchsia:
|
||||
case DeviceOperatingSystem.linux:
|
||||
case DeviceOperatingSystem.windows:
|
||||
throw Exception('Called ${CompileTest.getSizesFromDarwinApp} with $operatingSystem.');
|
||||
}
|
||||
|
||||
@@ -19,6 +19,22 @@ TaskFunction createAndroidRunReleaseTest() {
|
||||
return AndroidRunOutputTest(release: true).call;
|
||||
}
|
||||
|
||||
TaskFunction createLinuxRunDebugTest() {
|
||||
return DesktopRunOutputTest(
|
||||
'${flutterDirectory.path}/dev/integration_tests/ui',
|
||||
'lib/empty.dart',
|
||||
release: false,
|
||||
).call;
|
||||
}
|
||||
|
||||
TaskFunction createLinuxRunReleaseTest() {
|
||||
return DesktopRunOutputTest(
|
||||
'${flutterDirectory.path}/dev/integration_tests/ui',
|
||||
'lib/empty.dart',
|
||||
release: true,
|
||||
).call;
|
||||
}
|
||||
|
||||
TaskFunction createMacOSRunDebugTest() {
|
||||
return DesktopRunOutputTest(
|
||||
// TODO(cbracken): https://github.com/flutter/flutter/issues/87508#issuecomment-1043753201
|
||||
|
||||
Reference in New Issue
Block a user