From 1a3097025dbc13969c6ada32cc559023984fdda1 Mon Sep 17 00:00:00 2001 From: Alexander Aprelev Date: Thu, 28 Sep 2017 12:45:54 -0700 Subject: [PATCH] Clone hot reload benchmark for --preview-dart-2 option. (#12251) * Clone hot reload benchmark for --preview-dart-2 option. * Get rid of linux and win preview_dart_2 (only android would be sufficient for now). Refactor code into lib/tasks * Revert 2016 to 2017 * Mark new test as flaky --- .../tasks/hot_mode_dev_cycle__benchmark.dart | 31 ++------------- ...e_dev_cycle__preview_dart_2_benchmark.dart | 12 ++++++ .../hot_mode_dev_cycle_linux__benchmark.dart | 9 +++-- .../hot_mode_dev_cycle_win__benchmark.dart | 9 +++-- dev/devicelab/lib/tasks/hot_mode_tests.dart | 38 +++++++++++++++++++ dev/devicelab/manifest.yaml | 8 ++++ 6 files changed, 74 insertions(+), 33 deletions(-) create mode 100644 dev/devicelab/bin/tasks/hot_mode_dev_cycle__preview_dart_2_benchmark.dart create mode 100644 dev/devicelab/lib/tasks/hot_mode_tests.dart diff --git a/dev/devicelab/bin/tasks/hot_mode_dev_cycle__benchmark.dart b/dev/devicelab/bin/tasks/hot_mode_dev_cycle__benchmark.dart index ffc5e66f4d..3a4a3bc48b 100644 --- a/dev/devicelab/bin/tasks/hot_mode_dev_cycle__benchmark.dart +++ b/dev/devicelab/bin/tasks/hot_mode_dev_cycle__benchmark.dart @@ -2,34 +2,11 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -import 'dart:io'; +import 'dart:async'; -import 'package:path/path.dart' as path; - -import 'package:flutter_devicelab/framework/adb.dart'; +import 'package:flutter_devicelab/tasks/hot_mode_tests.dart'; import 'package:flutter_devicelab/framework/framework.dart'; -import 'package:flutter_devicelab/framework/utils.dart'; -void main() { - task(() async { - final Device device = await devices.workingDevice; - await device.unlock(); - final Directory appDir = - dir(path.join(flutterDirectory.path, 'examples/flutter_gallery')); - final File benchmarkFile = file(path.join(appDir.path, 'hot_benchmark.json')); - rm(benchmarkFile); - await inDirectory(appDir, () async { - return await flutter('run', - options: ['--hot', '-d', device.deviceId, '--benchmark', '--verbose'], - canFail: false); - }); - return new TaskResult.successFromFile(benchmarkFile, - benchmarkScoreKeys: [ - 'hotReloadMillisecondsToFrame', - 'hotRestartMillisecondsToFrame', - 'hotReloadDevFSSyncMilliseconds', - 'hotReloadFlutterReassembleMilliseconds', - 'hotReloadVMReloadMilliseconds', - ]); - }); +Future main() async { + await task(createHotModeTest()); } diff --git a/dev/devicelab/bin/tasks/hot_mode_dev_cycle__preview_dart_2_benchmark.dart b/dev/devicelab/bin/tasks/hot_mode_dev_cycle__preview_dart_2_benchmark.dart new file mode 100644 index 0000000000..e50d8f1df9 --- /dev/null +++ b/dev/devicelab/bin/tasks/hot_mode_dev_cycle__preview_dart_2_benchmark.dart @@ -0,0 +1,12 @@ +// Copyright (c) 2017 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 main() async { + await task(createHotModeTest(isPreviewDart2: true)); +} diff --git a/dev/devicelab/bin/tasks/hot_mode_dev_cycle_linux__benchmark.dart b/dev/devicelab/bin/tasks/hot_mode_dev_cycle_linux__benchmark.dart index 04b76edd27..68bef9d6f6 100644 --- a/dev/devicelab/bin/tasks/hot_mode_dev_cycle_linux__benchmark.dart +++ b/dev/devicelab/bin/tasks/hot_mode_dev_cycle_linux__benchmark.dart @@ -2,8 +2,11 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -import 'hot_mode_dev_cycle__benchmark.dart' as hot_mode_dev_cycle_benchmark; +import 'dart:async'; -void main() { - hot_mode_dev_cycle_benchmark.main(); +import 'package:flutter_devicelab/tasks/hot_mode_tests.dart'; +import 'package:flutter_devicelab/framework/framework.dart'; + +Future main() async { + await task(createHotModeTest()); } diff --git a/dev/devicelab/bin/tasks/hot_mode_dev_cycle_win__benchmark.dart b/dev/devicelab/bin/tasks/hot_mode_dev_cycle_win__benchmark.dart index 04b76edd27..68bef9d6f6 100644 --- a/dev/devicelab/bin/tasks/hot_mode_dev_cycle_win__benchmark.dart +++ b/dev/devicelab/bin/tasks/hot_mode_dev_cycle_win__benchmark.dart @@ -2,8 +2,11 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -import 'hot_mode_dev_cycle__benchmark.dart' as hot_mode_dev_cycle_benchmark; +import 'dart:async'; -void main() { - hot_mode_dev_cycle_benchmark.main(); +import 'package:flutter_devicelab/tasks/hot_mode_tests.dart'; +import 'package:flutter_devicelab/framework/framework.dart'; + +Future main() async { + await task(createHotModeTest()); } diff --git a/dev/devicelab/lib/tasks/hot_mode_tests.dart b/dev/devicelab/lib/tasks/hot_mode_tests.dart new file mode 100644 index 0000000000..249837a674 --- /dev/null +++ b/dev/devicelab/lib/tasks/hot_mode_tests.dart @@ -0,0 +1,38 @@ +// Copyright 2017 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:io'; + +import 'package:path/path.dart' as path; + +import '../framework/adb.dart'; +import '../framework/framework.dart'; +import '../framework/utils.dart'; + +TaskFunction createHotModeTest({ bool isPreviewDart2: false }) { + return () async { + final Device device = await devices.workingDevice; + await device.unlock(); + final Directory appDir = + dir(path.join(flutterDirectory.path, 'examples/flutter_gallery')); + final File benchmarkFile = file(path.join(appDir.path, 'hot_benchmark.json')); + rm(benchmarkFile); + final List options = [ + '--hot', '-d', device.deviceId, '--benchmark', '--verbose' + ]; + if (isPreviewDart2) + options.add('--preview-dart-2'); + await inDirectory(appDir, () async { + return await flutter('run', options: options, canFail: false); + }); + return new TaskResult.successFromFile(benchmarkFile, + benchmarkScoreKeys: [ + 'hotReloadMillisecondsToFrame', + 'hotRestartMillisecondsToFrame', + 'hotReloadDevFSSyncMilliseconds', + 'hotReloadFlutterReassembleMilliseconds', + 'hotReloadVMReloadMilliseconds', + ]); + }; +} diff --git a/dev/devicelab/manifest.yaml b/dev/devicelab/manifest.yaml index a11b58a552..16e93af47f 100644 --- a/dev/devicelab/manifest.yaml +++ b/dev/devicelab/manifest.yaml @@ -96,6 +96,14 @@ tasks: stage: devicelab required_agent_capabilities: ["has-android-device"] + hot_mode_dev_cycle__preview_dart_2_benchmark: + description: > + Measures the performance of Dart VM hot patching feature under + --preview-dart-2 option, that enables Dart 2.0 frontend. + stage: devicelab + required_agent_capabilities: ["has-android-device"] + flaky: true + complex_layout_scroll_perf__memory: description: > Measures memory usage of the scroll performance test.