Skip to content

Commit cea55d9

Browse files
authored
[Linux] Add a 'flutter run' console output test (#118279)
* Add Linux support for the UI integration test project * Add Linux run console test
1 parent a523f79 commit cea55d9

14 files changed

+560
-0
lines changed

.ci.yaml

+40
Original file line numberDiff line numberDiff line change
@@ -687,6 +687,46 @@ targets:
687687
- bin/**
688688
- .ci.yaml
689689

690+
- name: Linux run_debug_test_linux
691+
recipe: devicelab/devicelab_drone
692+
bringup: true
693+
timeout: 60
694+
properties:
695+
dependencies: >-
696+
[
697+
{"dependency": "clang", "version": "git_revision:5d5aba78dbbee75508f01bcaa69aedb2ab79065a"},
698+
{"dependency": "cmake", "version": "version:3.16.1"},
699+
{"dependency": "ninja", "version": "version:1.9.0"}
700+
]
701+
tags: >
702+
["devicelab", "hostonly", "linux"]
703+
task_name: run_debug_test_linux
704+
runIf:
705+
- dev/**
706+
- packages/flutter_tools/**
707+
- bin/**
708+
- .ci.yaml
709+
710+
- name: Linux run_release_test_linux
711+
recipe: devicelab/devicelab_drone
712+
bringup: true
713+
timeout: 60
714+
properties:
715+
dependencies: >-
716+
[
717+
{"dependency": "clang", "version": "git_revision:5d5aba78dbbee75508f01bcaa69aedb2ab79065a"},
718+
{"dependency": "cmake", "version": "version:3.16.1"},
719+
{"dependency": "ninja", "version": "version:1.9.0"}
720+
]
721+
tags: >
722+
["devicelab", "hostonly", "linux"]
723+
task_name: run_release_test_linux
724+
runIf:
725+
- dev/**
726+
- packages/flutter_tools/**
727+
- bin/**
728+
- .ci.yaml
729+
690730
- name: Linux skp_generator
691731
enabled_branches:
692732
- main

TESTOWNERS

+2
Original file line numberDiff line numberDiff line change
@@ -251,8 +251,10 @@
251251
/dev/devicelab/bin/tasks/plugin_test_macos.dart @jmagman @flutter/desktop
252252
/dev/devicelab/bin/tasks/plugin_test.dart @stuartmorgan @flutter/plugin
253253
/dev/devicelab/bin/tasks/run_debug_test_android.dart @zanderso @flutter/tool
254+
/dev/devicelab/bin/tasks/run_debug_test_linux.dart @loic-sharma @flutter/tool
254255
/dev/devicelab/bin/tasks/run_debug_test_macos.dart @cbracken @flutter/tool
255256
/dev/devicelab/bin/tasks/run_debug_test_windows.dart @loic-sharma @flutter/tool
257+
/dev/devicelab/bin/tasks/run_release_test_linux.dart @loic-sharma @flutter/tool
256258
/dev/devicelab/bin/tasks/run_release_test_macos.dart @cbracken @flutter/tool
257259
/dev/devicelab/bin/tasks/run_release_test_windows.dart @loic-sharma @flutter/tool
258260
/dev/devicelab/bin/tasks/technical_debt__cost.dart @HansMuller @flutter/framework
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
// Copyright 2014 The Flutter Authors. All rights reserved.
2+
// Use of this source code is governed by a BSD-style license that can be
3+
// found in the LICENSE file.
4+
5+
import 'package:flutter_devicelab/framework/devices.dart';
6+
import 'package:flutter_devicelab/framework/framework.dart';
7+
import 'package:flutter_devicelab/tasks/run_tests.dart';
8+
9+
Future<void> main() async {
10+
deviceOperatingSystem = DeviceOperatingSystem.linux;
11+
await task(createLinuxRunDebugTest());
12+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
// Copyright 2014 The Flutter Authors. All rights reserved.
2+
// Use of this source code is governed by a BSD-style license that can be
3+
// found in the LICENSE file.
4+
5+
import 'package:flutter_devicelab/framework/devices.dart';
6+
import 'package:flutter_devicelab/framework/framework.dart';
7+
import 'package:flutter_devicelab/tasks/run_tests.dart';
8+
9+
Future<void> main() async {
10+
deviceOperatingSystem = DeviceOperatingSystem.linux;
11+
await task(createLinuxRunReleaseTest());
12+
}

dev/devicelab/lib/framework/devices.dart

+89
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ enum DeviceOperatingSystem {
5858
fake,
5959
fuchsia,
6060
ios,
61+
linux,
6162
macos,
6263
windows,
6364
}
@@ -79,6 +80,8 @@ abstract class DeviceDiscovery {
7980
return IosDeviceDiscovery();
8081
case DeviceOperatingSystem.fuchsia:
8182
return FuchsiaDeviceDiscovery();
83+
case DeviceOperatingSystem.linux:
84+
return LinuxDeviceDiscovery();
8285
case DeviceOperatingSystem.macos:
8386
return MacosDeviceDiscovery();
8487
case DeviceOperatingSystem.windows:
@@ -356,6 +359,40 @@ class AndroidDeviceDiscovery implements DeviceDiscovery {
356359
}
357360
}
358361

362+
class LinuxDeviceDiscovery implements DeviceDiscovery {
363+
factory LinuxDeviceDiscovery() {
364+
return _instance ??= LinuxDeviceDiscovery._();
365+
}
366+
367+
LinuxDeviceDiscovery._();
368+
369+
static LinuxDeviceDiscovery? _instance;
370+
371+
static const LinuxDevice _device = LinuxDevice();
372+
373+
@override
374+
Future<Map<String, HealthCheckResult>> checkDevices() async {
375+
return <String, HealthCheckResult>{};
376+
}
377+
378+
@override
379+
Future<void> chooseWorkingDevice() async { }
380+
381+
@override
382+
Future<void> chooseWorkingDeviceById(String deviceId) async { }
383+
384+
@override
385+
Future<List<String>> discoverDevices() async {
386+
return <String>['linux'];
387+
}
388+
389+
@override
390+
Future<void> performPreflightTasks() async { }
391+
392+
@override
393+
Future<Device> get workingDevice async => _device;
394+
}
395+
359396
class MacosDeviceDiscovery implements DeviceDiscovery {
360397
factory MacosDeviceDiscovery() {
361398
return _instance ??= MacosDeviceDiscovery._();
@@ -1046,6 +1083,58 @@ class IosDevice extends Device {
10461083
}
10471084
}
10481085

1086+
class LinuxDevice extends Device {
1087+
const LinuxDevice();
1088+
1089+
@override
1090+
String get deviceId => 'linux';
1091+
1092+
@override
1093+
Future<Map<String, dynamic>> getMemoryStats(String packageName) async {
1094+
return <String, dynamic>{};
1095+
}
1096+
1097+
@override
1098+
Future<void> home() async { }
1099+
1100+
@override
1101+
Future<bool> isAsleep() async {
1102+
return false;
1103+
}
1104+
1105+
@override
1106+
Future<bool> isAwake() async {
1107+
return true;
1108+
}
1109+
1110+
@override
1111+
Stream<String> get logcat => const Stream<String>.empty();
1112+
1113+
@override
1114+
Future<void> clearLogs() async {}
1115+
1116+
@override
1117+
Future<void> reboot() async { }
1118+
1119+
@override
1120+
Future<void> sendToSleep() async { }
1121+
1122+
@override
1123+
Future<void> stop(String packageName) async { }
1124+
1125+
@override
1126+
Future<void> tap(int x, int y) async { }
1127+
1128+
@override
1129+
Future<void> togglePower() async { }
1130+
1131+
@override
1132+
Future<void> unlock() async { }
1133+
1134+
@override
1135+
Future<void> wakeUp() async { }
1136+
}
1137+
10491138
class MacosDevice extends Device {
10501139
const MacosDevice();
10511140

dev/devicelab/lib/tasks/perf_tests.dart

+7
Original file line numberDiff line numberDiff line change
@@ -716,6 +716,7 @@ class StartupTest {
716716
break;
717717
case DeviceOperatingSystem.fake:
718718
case DeviceOperatingSystem.fuchsia:
719+
case DeviceOperatingSystem.linux:
719720
break;
720721
case DeviceOperatingSystem.ios:
721722
case DeviceOperatingSystem.macos:
@@ -860,6 +861,7 @@ class DevtoolsStartupTest {
860861
break;
861862
case DeviceOperatingSystem.fake:
862863
case DeviceOperatingSystem.fuchsia:
864+
case DeviceOperatingSystem.linux:
863865
case DeviceOperatingSystem.macos:
864866
case DeviceOperatingSystem.windows:
865867
break;
@@ -1571,6 +1573,8 @@ class CompileTest {
15711573
throw Exception('Unsupported option for fake devices');
15721574
case DeviceOperatingSystem.fuchsia:
15731575
throw Exception('Unsupported option for Fuchsia devices');
1576+
case DeviceOperatingSystem.linux:
1577+
throw Exception('Unsupported option for Linux devices');
15741578
case DeviceOperatingSystem.windows:
15751579
unawaited(stderr.flush());
15761580
options.insert(0, 'windows');
@@ -1634,6 +1638,8 @@ class CompileTest {
16341638
throw Exception('Unsupported option for fake devices');
16351639
case DeviceOperatingSystem.fuchsia:
16361640
throw Exception('Unsupported option for Fuchsia devices');
1641+
case DeviceOperatingSystem.linux:
1642+
throw Exception('Unsupported option for Linux devices');
16371643
case DeviceOperatingSystem.macos:
16381644
unawaited(stderr.flush());
16391645
options.insert(0, 'macos');
@@ -1687,6 +1693,7 @@ class CompileTest {
16871693
case DeviceOperatingSystem.androidArm64:
16881694
case DeviceOperatingSystem.fake:
16891695
case DeviceOperatingSystem.fuchsia:
1696+
case DeviceOperatingSystem.linux:
16901697
case DeviceOperatingSystem.windows:
16911698
throw Exception('Called ${CompileTest.getSizesFromDarwinApp} with $operatingSystem.');
16921699
}

dev/devicelab/lib/tasks/run_tests.dart

+16
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,22 @@ TaskFunction createAndroidRunReleaseTest() {
1919
return AndroidRunOutputTest(release: true).call;
2020
}
2121

22+
TaskFunction createLinuxRunDebugTest() {
23+
return DesktopRunOutputTest(
24+
'${flutterDirectory.path}/dev/integration_tests/ui',
25+
'lib/empty.dart',
26+
release: false,
27+
).call;
28+
}
29+
30+
TaskFunction createLinuxRunReleaseTest() {
31+
return DesktopRunOutputTest(
32+
'${flutterDirectory.path}/dev/integration_tests/ui',
33+
'lib/empty.dart',
34+
release: true,
35+
).call;
36+
}
37+
2238
TaskFunction createMacOSRunDebugTest() {
2339
return DesktopRunOutputTest(
2440
// TODO(cbracken): https://github.com/flutter/flutter/issues/87508#issuecomment-1043753201
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
flutter/ephemeral

0 commit comments

Comments
 (0)