mirror of
https://github.com/flutter/flutter.git
synced 2025-06-03 00:51:18 +00:00
Add macOS hot reload test (#45264)
This commit is contained in:
parent
2c7af1e24e
commit
0e36a91d18
@ -0,0 +1,14 @@
|
|||||||
|
// Copyright 2019 The Chromium 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 'dart:async';
|
||||||
|
|
||||||
|
import 'package:flutter_devicelab/tasks/hot_mode_tests.dart';
|
||||||
|
import 'package:flutter_devicelab/framework/framework.dart';
|
||||||
|
|
||||||
|
Future<void> main() async {
|
||||||
|
await task(createHotModeTest(deviceIdOverride: 'macos', environment: <String, String>{
|
||||||
|
'FLUTTER_MACOS': 'true',
|
||||||
|
}));
|
||||||
|
}
|
@ -121,7 +121,7 @@ void recursiveCopy(Directory source, Directory target) {
|
|||||||
|
|
||||||
for (FileSystemEntity entity in source.listSync(followLinks: false)) {
|
for (FileSystemEntity entity in source.listSync(followLinks: false)) {
|
||||||
final String name = path.basename(entity.path);
|
final String name = path.basename(entity.path);
|
||||||
if (entity is Directory)
|
if (entity is Directory && !entity.path.contains('.dart_tool'))
|
||||||
recursiveCopy(entity, Directory(path.join(target.path, name)));
|
recursiveCopy(entity, Directory(path.join(target.path, name)));
|
||||||
else if (entity is File) {
|
else if (entity is File) {
|
||||||
final File dest = File(path.join(target.path, name));
|
final File dest = File(path.join(target.path, name));
|
||||||
|
@ -15,14 +15,17 @@ import '../framework/utils.dart';
|
|||||||
final Directory _editedFlutterGalleryDir = dir(path.join(Directory.systemTemp.path, 'edited_flutter_gallery'));
|
final Directory _editedFlutterGalleryDir = dir(path.join(Directory.systemTemp.path, 'edited_flutter_gallery'));
|
||||||
final Directory flutterGalleryDir = dir(path.join(flutterDirectory.path, 'examples/flutter_gallery'));
|
final Directory flutterGalleryDir = dir(path.join(flutterDirectory.path, 'examples/flutter_gallery'));
|
||||||
|
|
||||||
TaskFunction createHotModeTest() {
|
TaskFunction createHotModeTest({String deviceIdOverride, Map<String, String> environment}) {
|
||||||
return () async {
|
return () async {
|
||||||
|
if (deviceIdOverride == null) {
|
||||||
final Device device = await devices.workingDevice;
|
final Device device = await devices.workingDevice;
|
||||||
await device.unlock();
|
await device.unlock();
|
||||||
|
deviceIdOverride = device.deviceId;
|
||||||
|
}
|
||||||
final File benchmarkFile = file(path.join(_editedFlutterGalleryDir.path, 'hot_benchmark.json'));
|
final File benchmarkFile = file(path.join(_editedFlutterGalleryDir.path, 'hot_benchmark.json'));
|
||||||
rm(benchmarkFile);
|
rm(benchmarkFile);
|
||||||
final List<String> options = <String>[
|
final List<String> options = <String>[
|
||||||
'--hot', '-d', device.deviceId, '--benchmark', '--verbose', '--resident', '--output-dill', path.join('build', 'app.dill')
|
'--hot', '-d', deviceIdOverride, '--benchmark', '--verbose', '--resident', '--output-dill', path.join('build', 'app.dill')
|
||||||
];
|
];
|
||||||
int hotReloadCount = 0;
|
int hotReloadCount = 0;
|
||||||
Map<String, dynamic> twoReloadsData;
|
Map<String, dynamic> twoReloadsData;
|
||||||
@ -33,10 +36,17 @@ TaskFunction createHotModeTest() {
|
|||||||
recursiveCopy(flutterGalleryDir, _editedFlutterGalleryDir);
|
recursiveCopy(flutterGalleryDir, _editedFlutterGalleryDir);
|
||||||
await inDirectory<void>(_editedFlutterGalleryDir, () async {
|
await inDirectory<void>(_editedFlutterGalleryDir, () async {
|
||||||
{
|
{
|
||||||
|
final Process clearProcess = await startProcess(
|
||||||
|
path.join(flutterDirectory.path, 'bin', 'flutter'),
|
||||||
|
flutterCommandArgs('clean', <String>[]),
|
||||||
|
environment: environment,
|
||||||
|
);
|
||||||
|
await clearProcess.exitCode;
|
||||||
|
|
||||||
final Process process = await startProcess(
|
final Process process = await startProcess(
|
||||||
path.join(flutterDirectory.path, 'bin', 'flutter'),
|
path.join(flutterDirectory.path, 'bin', 'flutter'),
|
||||||
flutterCommandArgs('run', options),
|
flutterCommandArgs('run', options),
|
||||||
environment: null,
|
environment: environment,
|
||||||
);
|
);
|
||||||
|
|
||||||
final Completer<void> stdoutDone = Completer<void>();
|
final Completer<void> stdoutDone = Completer<void>();
|
||||||
@ -90,7 +100,7 @@ TaskFunction createHotModeTest() {
|
|||||||
final Process process = await startProcess(
|
final Process process = await startProcess(
|
||||||
path.join(flutterDirectory.path, 'bin', 'flutter'),
|
path.join(flutterDirectory.path, 'bin', 'flutter'),
|
||||||
flutterCommandArgs('run', options),
|
flutterCommandArgs('run', options),
|
||||||
environment: null,
|
environment: environment,
|
||||||
);
|
);
|
||||||
final Completer<void> stdoutDone = Completer<void>();
|
final Completer<void> stdoutDone = Completer<void>();
|
||||||
final Completer<void> stderrDone = Completer<void>();
|
final Completer<void> stderrDone = Completer<void>();
|
||||||
|
@ -566,6 +566,14 @@ tasks:
|
|||||||
stage: devicelab
|
stage: devicelab
|
||||||
required_agent_capabilities: ["mac-catalina/android"]
|
required_agent_capabilities: ["mac-catalina/android"]
|
||||||
|
|
||||||
|
# macOS target platform tests
|
||||||
|
hot_mode_dev_cycle_macos_target__benchmark:
|
||||||
|
description: >
|
||||||
|
Checks the functionality and performance of hot reload on a macOS target platform
|
||||||
|
stage: devicelab
|
||||||
|
required_agent_capabilities: ["mac/ios"]
|
||||||
|
flaky: true
|
||||||
|
|
||||||
# Tests running on Windows host
|
# Tests running on Windows host
|
||||||
|
|
||||||
flavors_test_win:
|
flavors_test_win:
|
||||||
|
Loading…
Reference in New Issue
Block a user