Unverified Commit 21ad09fe authored by Alexander Aprelev's avatar Alexander Aprelev Committed by GitHub

With dart2 being default, move preview_dart_2 tests to dart1. (#15667)

* With dart being default, move preview_dart_2 tests to dart1.

* Swap out defaults for preview-dart-2 option in tests. Make dart1 explicit

* Move suffix around

* Rename files
parent 81070893
...@@ -8,5 +8,5 @@ import 'package:flutter_devicelab/tasks/hot_mode_tests.dart'; ...@@ -8,5 +8,5 @@ import 'package:flutter_devicelab/tasks/hot_mode_tests.dart';
import 'package:flutter_devicelab/framework/framework.dart'; import 'package:flutter_devicelab/framework/framework.dart';
Future<Null> main() async { Future<Null> main() async {
await task(createHotModeTest(isPreviewDart2: true)); await task(createHotModeTest(isPreviewDart2: false));
} }
...@@ -10,5 +10,5 @@ import 'package:flutter_devicelab/framework/adb.dart'; ...@@ -10,5 +10,5 @@ import 'package:flutter_devicelab/framework/adb.dart';
Future<Null> main() async { Future<Null> main() async {
deviceOperatingSystem = DeviceOperatingSystem.ios; deviceOperatingSystem = DeviceOperatingSystem.ios;
await task(createHotModeTest(isPreviewDart2: true)); await task(createHotModeTest(isPreviewDart2: false));
} }
...@@ -16,7 +16,7 @@ import '../framework/utils.dart'; ...@@ -16,7 +16,7 @@ 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({ bool isPreviewDart2: false }) { TaskFunction createHotModeTest({ bool isPreviewDart2: true }) {
return () async { return () async {
final Device device = await devices.workingDevice; final Device device = await devices.workingDevice;
await device.unlock(); await device.unlock();
...@@ -27,6 +27,8 @@ TaskFunction createHotModeTest({ bool isPreviewDart2: false }) { ...@@ -27,6 +27,8 @@ TaskFunction createHotModeTest({ bool isPreviewDart2: false }) {
]; ];
if (isPreviewDart2) if (isPreviewDart2)
options.add('--preview-dart-2'); options.add('--preview-dart-2');
else
options.add('--no-preview-dart-2');
setLocalEngineOptionIfNecessary(options); setLocalEngineOptionIfNecessary(options);
int hotReloadCount = 0; int hotReloadCount = 0;
Map<String, dynamic> twoReloadsData; Map<String, dynamic> twoReloadsData;
......
...@@ -23,7 +23,7 @@ TaskFunction createMicrobenchmarkTask() { ...@@ -23,7 +23,7 @@ TaskFunction createMicrobenchmarkTask() {
final Device device = await devices.workingDevice; final Device device = await devices.workingDevice;
await device.unlock(); await device.unlock();
Future<Map<String, double>> _runMicrobench(String benchmarkPath, {bool previewDart2: false}) async { Future<Map<String, double>> _runMicrobench(String benchmarkPath, {bool previewDart2: true}) async {
Future<Map<String, double>> _run() async { Future<Map<String, double>> _run() async {
print('Running $benchmarkPath'); print('Running $benchmarkPath');
final Directory appDir = dir( final Directory appDir = dir(
...@@ -40,6 +40,8 @@ TaskFunction createMicrobenchmarkTask() { ...@@ -40,6 +40,8 @@ TaskFunction createMicrobenchmarkTask() {
]; ];
if (previewDart2) if (previewDart2)
options.add('--preview-dart-2'); options.add('--preview-dart-2');
else
options.add('--no-preview-dart-2');
setLocalEngineOptionIfNecessary(options); setLocalEngineOptionIfNecessary(options);
options.add(benchmarkPath); options.add(benchmarkPath);
return await _startFlutter( return await _startFlutter(
...@@ -59,33 +61,26 @@ TaskFunction createMicrobenchmarkTask() { ...@@ -59,33 +61,26 @@ TaskFunction createMicrobenchmarkTask() {
allResults.addAll(await _runMicrobench('lib/gestures/velocity_tracker_bench.dart')); allResults.addAll(await _runMicrobench('lib/gestures/velocity_tracker_bench.dart'));
allResults.addAll(await _runMicrobench('lib/stocks/animation_bench.dart')); allResults.addAll(await _runMicrobench('lib/stocks/animation_bench.dart'));
// Run micro-benchmarks once again in --preview-dart-2 mode. // Run micro-benchmarks once again in --no-preview-dart-2 mode.
// Append "_dart2" suffix to the result keys to distinguish them from // Append "_dart1" suffix to the result keys to distinguish them from
// the original results. // the original results.
void addDart2Results(Map<String, double> benchmarkResults) { void addDart1Results(Map<String, double> benchmarkResults) {
benchmarkResults.forEach((String key, double result) { benchmarkResults.forEach((String key, double result) {
allResults[key + '_dart2'] = result; allResults[key + '_dart1'] = result;
}); });
} }
try { addDart1Results(await _runMicrobench(
addDart2Results(await _runMicrobench( 'lib/stocks/layout_bench.dart', previewDart2: false));
'lib/stocks/layout_bench.dart', previewDart2: true)); addDart1Results(await _runMicrobench(
addDart2Results(await _runMicrobench( 'lib/stocks/layout_bench.dart', previewDart2: false));
'lib/stocks/layout_bench.dart', previewDart2: true)); addDart1Results(await _runMicrobench(
addDart2Results(await _runMicrobench( 'lib/stocks/build_bench.dart', previewDart2: false));
'lib/stocks/build_bench.dart', previewDart2: true)); addDart1Results(await _runMicrobench(
addDart2Results(await _runMicrobench( 'lib/gestures/velocity_tracker_bench.dart', previewDart2: false));
'lib/gestures/velocity_tracker_bench.dart', previewDart2: true)); addDart1Results(await _runMicrobench(
addDart2Results(await _runMicrobench( 'lib/stocks/animation_bench.dart', previewDart2: false));
'lib/stocks/animation_bench.dart', previewDart2: true));
} catch (e) {
// Ignore any exceptions from running benchmarks in Dart 2.0 mode,
// as these benchmarks are considered flaky.
stderr.writeln('WARNING: microbenchmarks FAILED in --preview-dart-2 mode.');
}
return new TaskResult.success(allResults, benchmarkScoreKeys: allResults.keys.toList()); return new TaskResult.success(allResults, benchmarkScoreKeys: allResults.keys.toList());
}; };
} }
......
...@@ -199,9 +199,9 @@ class CompileTest { ...@@ -199,9 +199,9 @@ class CompileTest {
..addAll(await _compileAot()) ..addAll(await _compileAot())
..addAll(await _compileApp()) ..addAll(await _compileApp())
..addAll(await _compileDebug()) ..addAll(await _compileDebug())
..addAll(_suffix(await _compileAot(previewDart2: true), '__preview_dart_2')) ..addAll(_suffix(await _compileAot(previewDart2: false), '__dart1'))
..addAll(_suffix(await _compileApp(previewDart2: true), '__preview_dart_2')) ..addAll(_suffix(await _compileApp(previewDart2: false), '__dart1'))
..addAll(_suffix(await _compileDebug(previewDart2: true), '__preview_dart_2')); ..addAll(_suffix(await _compileDebug(previewDart2: false), '__dart1'));
return new TaskResult.success(metrics, benchmarkScoreKeys: metrics.keys.toList()); return new TaskResult.success(metrics, benchmarkScoreKeys: metrics.keys.toList());
}); });
...@@ -214,7 +214,7 @@ class CompileTest { ...@@ -214,7 +214,7 @@ class CompileTest {
); );
} }
static Future<Map<String, dynamic>> _compileAot({ bool previewDart2: false }) async { static Future<Map<String, dynamic>> _compileAot({ bool previewDart2: true }) async {
// Generate blobs instead of assembly. // Generate blobs instead of assembly.
await flutter('clean'); await flutter('clean');
final Stopwatch watch = new Stopwatch()..start(); final Stopwatch watch = new Stopwatch()..start();
...@@ -235,6 +235,8 @@ class CompileTest { ...@@ -235,6 +235,8 @@ class CompileTest {
} }
if (previewDart2) if (previewDart2)
options.add('--preview-dart-2'); options.add('--preview-dart-2');
else
options.add('--no-preview-dart-2');
setLocalEngineOptionIfNecessary(options); setLocalEngineOptionIfNecessary(options);
final String compileLog = await evalFlutter('build', options: options); final String compileLog = await evalFlutter('build', options: options);
watch.stop(); watch.stop();
...@@ -249,7 +251,7 @@ class CompileTest { ...@@ -249,7 +251,7 @@ class CompileTest {
return metrics; return metrics;
} }
static Future<Map<String, dynamic>> _compileApp({ bool previewDart2: false }) async { static Future<Map<String, dynamic>> _compileApp({ bool previewDart2: true }) async {
await flutter('clean'); await flutter('clean');
final Stopwatch watch = new Stopwatch(); final Stopwatch watch = new Stopwatch();
int releaseSizeInBytes; int releaseSizeInBytes;
...@@ -288,7 +290,7 @@ class CompileTest { ...@@ -288,7 +290,7 @@ class CompileTest {
}; };
} }
static Future<Map<String, dynamic>> _compileDebug({ bool previewDart2: false }) async { static Future<Map<String, dynamic>> _compileDebug({ bool previewDart2: true }) async {
await flutter('clean'); await flutter('clean');
final Stopwatch watch = new Stopwatch(); final Stopwatch watch = new Stopwatch();
final List<String> options = <String>['--debug']; final List<String> options = <String>['--debug'];
......
...@@ -148,17 +148,17 @@ tasks: ...@@ -148,17 +148,17 @@ tasks:
stage: devicelab stage: devicelab
required_agent_capabilities: ["mac/android"] required_agent_capabilities: ["mac/android"]
hot_mode_dev_cycle__preview_dart_2_benchmark: hot_mode_dev_cycle__benchmark_dart1:
description: > description: >
Measures the performance of Dart VM hot patching feature under Measures the performance of Dart VM hot patching feature under
--preview-dart-2 option, that enables Dart 2.0 frontend. --no-preview-dart-2 option, that disables Dart 2.0 frontend.
stage: devicelab stage: devicelab
required_agent_capabilities: ["mac/android"] required_agent_capabilities: ["mac/android"]
hot_mode_dev_cycle_ios__preview_dart_2_benchmark: hot_mode_dev_cycle_ios__benchmark_dart1:
description: > description: >
Measures the performance of Dart VM hot patching feature under Measures the performance of Dart VM hot patching feature under
--preview-dart-2 option, that enables Dart 2.0 frontend. --no-preview-dart-2 option, that disables Dart 2.0 frontend.
stage: devicelab_ios stage: devicelab_ios
required_agent_capabilities: ["mac/ios"] required_agent_capabilities: ["mac/ios"]
flaky: true flaky: true
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment