From 186a558a4588cca9d86952d2f4e5a85ae69ec35e Mon Sep 17 00:00:00 2001 From: David Iglesias Teixeira Date: Wed, 16 Feb 2022 17:22:08 -0800 Subject: [PATCH 1/2] Reenable benchmarks wip --- pubspec.lock | 16 +++++++-------- pubspec.yaml | 4 ++++ .../benchmarks/gallery_automator.dart | 20 +++++++++---------- test_benchmarks/benchmarks_test.dart | 2 +- 4 files changed, 23 insertions(+), 19 deletions(-) diff --git a/pubspec.lock b/pubspec.lock index faacb4b5ae..db8854fa17 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -35,7 +35,7 @@ packages: name: archive url: "https://pub.dartlang.org" source: hosted - version: "3.1.8" + version: "3.1.11" args: dependency: "direct dev" description: @@ -296,7 +296,7 @@ packages: name: material_color_utilities url: "https://pub.dartlang.org" source: hosted - version: "0.1.3" + version: "0.1.4" meta: dependency: "direct main" description: @@ -602,7 +602,7 @@ packages: name: source_span url: "https://pub.dartlang.org" source: hosted - version: "1.8.1" + version: "1.8.2" stack_trace: dependency: transitive description: @@ -728,7 +728,7 @@ packages: name: vector_math url: "https://pub.dartlang.org" source: hosted - version: "2.1.1" + version: "2.1.2" vm_service: dependency: transitive description: @@ -746,10 +746,10 @@ packages: web_benchmarks: dependency: "direct dev" description: - name: web_benchmarks - url: "https://pub.dartlang.org" - source: hosted - version: "0.0.5" + path: "../packages/packages/web_benchmarks" + relative: true + source: path + version: "0.0.7" web_socket_channel: dependency: transitive description: diff --git a/pubspec.yaml b/pubspec.yaml index 329c2db47b..d17ed25a5b 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -44,6 +44,10 @@ dev_dependencies: test: ^1.16.8 web_benchmarks: ^0.0.5 +dependency_overrides: + web_benchmarks: + path: ../packages/packages/web_benchmarks + flutter: deferred-components: - name: crane diff --git a/test_benchmarks/benchmarks/gallery_automator.dart b/test_benchmarks/benchmarks/gallery_automator.dart index 6f7a4acc54..cc7fcbf7f8 100644 --- a/test_benchmarks/benchmarks/gallery_automator.dart +++ b/test_benchmarks/benchmarks/gallery_automator.dart @@ -4,7 +4,7 @@ // @dart=2.9 -import 'dart:io'; +// import 'dart:io'; import 'package:flutter/material.dart'; import 'package:flutter_test/flutter_test.dart'; @@ -87,13 +87,13 @@ class GalleryAutomator { Future automateDemoGestures() async { await warmUp(); - stdout.writeln('==== List of demos to be run ===='); + print('==== List of demos to be run ===='); for (final demo in demoNames) { if (shouldRunPredicate(demo)) { - stdout.writeln(demo); + print(demo); } } - stdout.writeln('==== End of list of demos to be run ===='); + print('==== End of list of demos to be run ===='); var finishedStudyDemos = false; @@ -121,7 +121,7 @@ class GalleryAutomator { // satisfying `runCriterion`, because we need to scroll // through every `Scrollable` to find the `demoButton`. if (shouldRunPredicate(demo)) { - stdout.writeln('Running demo "$demo"'); + print('Running demo "$demo"'); for (var i = 0; i < 2; ++i) { await controller.tap(find.byKey(ValueKey(demo))); @@ -139,7 +139,7 @@ class GalleryAutomator { } } - stdout.writeln('All demos finished.'); + print('All demos finished.'); // At the end of the test, mark as finished. finished = true; @@ -149,7 +149,7 @@ class GalleryAutomator { Future automateScrolls() async { await warmUp(); - stdout.writeln('Running scrolling test.'); + print('Running scrolling test.'); final selectedDemos = firstDemosOfCategories(demoNames); @@ -182,13 +182,13 @@ class GalleryAutomator { } } - stdout.writeln('Scrolling test finished.'); + print('Scrolling test finished.'); finished = true; } /// Warm up the animation. Future warmUp() async { - stdout.writeln('Warming up.'); + print('Warming up.'); await pumpDeferredLibraries(); @@ -231,7 +231,7 @@ class GalleryAutomator { // When warm-up finishes, inform the recorder. stopWarmingUpCallback(); - stdout.writeln('Warm-up finished.'); + print('Warm-up finished.'); } /// A function to find the category of a demo. diff --git a/test_benchmarks/benchmarks_test.dart b/test_benchmarks/benchmarks_test.dart index 5aa2fa3f49..fdaa41b896 100644 --- a/test_benchmarks/benchmarks_test.dart +++ b/test_benchmarks/benchmarks_test.dart @@ -28,7 +28,7 @@ Future main() async { stdout.writeln('Starting web benchmark tests ...'); // TODO(pennzht): Re-enable this test, https://github.com/flutter/gallery/issues/463. - return; + // return; // ignore: dead_code final taskResult = await serveWebBenchmark( benchmarkAppDirectory: projectRootDirectory(), From d5d4fb4d98a2cf979193d5a78c74d873c0c0764f Mon Sep 17 00:00:00 2001 From: David Iglesias Teixeira Date: Wed, 16 Feb 2022 17:48:45 -0800 Subject: [PATCH 2/2] Run benchmarks WIP --- pubspec.yaml | 6 +----- test_benchmarks/benchmarks/gallery_automator.dart | 2 +- test_benchmarks/benchmarks_test.dart | 3 --- 3 files changed, 2 insertions(+), 9 deletions(-) diff --git a/pubspec.yaml b/pubspec.yaml index d17ed25a5b..3384081d77 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -42,11 +42,7 @@ dev_dependencies: path: ^1.8.0 string_scanner: ^1.1.0 test: ^1.16.8 - web_benchmarks: ^0.0.5 - -dependency_overrides: - web_benchmarks: - path: ../packages/packages/web_benchmarks + web_benchmarks: ^0.0.7 flutter: deferred-components: diff --git a/test_benchmarks/benchmarks/gallery_automator.dart b/test_benchmarks/benchmarks/gallery_automator.dart index cc7fcbf7f8..4b03e87951 100644 --- a/test_benchmarks/benchmarks/gallery_automator.dart +++ b/test_benchmarks/benchmarks/gallery_automator.dart @@ -4,7 +4,7 @@ // @dart=2.9 -// import 'dart:io'; +// ignore_for_file:avoid_print import 'package:flutter/material.dart'; import 'package:flutter_test/flutter_test.dart'; diff --git a/test_benchmarks/benchmarks_test.dart b/test_benchmarks/benchmarks_test.dart index fdaa41b896..8aa7f0d523 100644 --- a/test_benchmarks/benchmarks_test.dart +++ b/test_benchmarks/benchmarks_test.dart @@ -27,9 +27,6 @@ Future main() async { test('Can run a web benchmark', () async { stdout.writeln('Starting web benchmark tests ...'); - // TODO(pennzht): Re-enable this test, https://github.com/flutter/gallery/issues/463. - // return; - // ignore: dead_code final taskResult = await serveWebBenchmark( benchmarkAppDirectory: projectRootDirectory(), entryPoint: 'test_benchmarks/benchmarks/client.dart',