From 5bc725bea831b9e1e4be0aa380463853b0f5e596 Mon Sep 17 00:00:00 2001 From: jensjoha Date: Fri, 8 Jan 2021 08:12:36 +0100 Subject: [PATCH] [dev] Don't use await for on stdout and stdin; pass local engine argument (#72136) * [dev] Don't use await for on stdout and stdin; pass local engine argument 1) Don't use await for on stdout followd by await for on stderr. This can cause nothing to happen. E.g. if one didn't do something like `flutter pub upgrade` dev/automated_tests and the version in the old one was pre-nnbd (but flutter itself use lots of nnbd stuff) lots of errors would be emitted, but because we basically only listen to stdout nothing will happen (deadlock once stderr buffer runs out). Note that it still awaits the exit-code below. 2) Pass --local-engine (if given) so there won't be any crashes because of that. --- dev/devicelab/bin/tasks/flutter_test_performance.dart | 9 +++++---- dev/devicelab/lib/framework/framework.dart | 3 ++- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/dev/devicelab/bin/tasks/flutter_test_performance.dart b/dev/devicelab/bin/tasks/flutter_test_performance.dart index 6e33833e38..b3f8c072d3 100644 --- a/dev/devicelab/bin/tasks/flutter_test_performance.dart +++ b/dev/devicelab/bin/tasks/flutter_test_performance.dart @@ -51,7 +51,8 @@ Future runTest({bool coverage = false, bool noPub = false}) async { ); int badLines = 0; TestStep step = TestStep.starting; - await for (final String entry in analysis.stdout.transform(utf8.decoder).transform(const LineSplitter())) { + + analysis.stdout.transform(utf8.decoder).transform(const LineSplitter()).listen((String entry) { print('test stdout ($step): $entry'); if (step == TestStep.starting && entry == 'Building flutter tool...') { // ignore this line @@ -83,11 +84,11 @@ Future runTest({bool coverage = false, bool noPub = false}) async { } } } - } - await for (final String entry in analysis.stderr.transform(utf8.decoder).transform(const LineSplitter())) { + }); + analysis.stderr.transform(utf8.decoder).transform(const LineSplitter()).listen((String entry) { print('test stderr: $entry'); badLines += 1; - } + }); final int result = await analysis.exitCode; clock.stop(); if (result != 0) diff --git a/dev/devicelab/lib/framework/framework.dart b/dev/devicelab/lib/framework/framework.dart index af4f79efec..bea6ed427e 100644 --- a/dev/devicelab/lib/framework/framework.dart +++ b/dev/devicelab/lib/framework/framework.dart @@ -110,7 +110,8 @@ class _TaskRunner { '--enable-macos-desktop', '--enable-windows-desktop', '--enable-linux-desktop', - '--enable-web' + '--enable-web', + if (localEngine != null) ...['--local-engine', localEngine], ], canFail: true); if (configResult != 0) { print('Failed to enable configuration, tasks may not run.');