From 72496e2fd10b8dd2170c1d977da6a9383872c48e Mon Sep 17 00:00:00 2001 From: Yegor Jbanov Date: Tue, 10 Sep 2019 13:58:43 -0700 Subject: [PATCH] add a convenience CLI tool for building and testing web engine --- .cirrus.yml | 2 +- lib/web_ui/dev/felt | 47 +++++++++++++++++++++++++ lib/web_ui/dev/{test.dart => felt.dart} | 0 lib/web_ui/dev/test_runner.dart | 7 ++-- 4 files changed, 52 insertions(+), 4 deletions(-) create mode 100755 lib/web_ui/dev/felt rename lib/web_ui/dev/{test.dart => felt.dart} (100%) diff --git a/.cirrus.yml b/.cirrus.yml index ca23f867db2a4..69494519558fb 100644 --- a/.cirrus.yml +++ b/.cirrus.yml @@ -41,7 +41,7 @@ task: $ENGINE_PATH/src/out/host_debug_unopt/dart-sdk/bin/pub get cd $ENGINE_PATH/src/flutter/lib/web_ui $ENGINE_PATH/src/out/host_debug_unopt/dart-sdk/bin/pub get - CHROME_NO_SANDBOX=true $ENGINE_PATH/src/out/host_debug_unopt/dart-sdk/bin/dart dev/test.dart + CHROME_NO_SANDBOX=true $ENGINE_PATH/src/out/host_debug_unopt/dart-sdk/bin/dart dev/felt.dart fetch_framework_script: | mkdir -p $FRAMEWORK_PATH cd $FRAMEWORK_PATH diff --git a/lib/web_ui/dev/felt b/lib/web_ui/dev/felt new file mode 100755 index 0000000000000..f93a32a169a98 --- /dev/null +++ b/lib/web_ui/dev/felt @@ -0,0 +1,47 @@ +#!/bin/bash + +# felt: a command-line utility for building and testing Flutter web engine. +# It stands for Flutter Engine Local Tester. + +FELT_PATH=`which felt` +if [ -z "$FELT_PATH" ] +then + echo "ERROR: felt is not in your PATH" + echo "Fix: add lib/web_ui/dev to your PATH" + exit 1 +fi + +GCLIENT_PATH=`which gclient` +if [ -z "$GCLIENT_PATH" ] +then + echo "ERROR: gclient is not in your PATH" + echo "Fix: add the path to your installation of depot_tools to your PATH" + exit 1 +fi + +NINJA_PATH=`which ninja` +if [ -z "$NINJA_PATH" ] +then + echo "ERROR: ninja is not in your PATH" + echo "Fix: add the path to your installation of depot_tools to your PATH" + exit 1 +fi + +ENGINE_SRC_DIR="$(dirname $(dirname $(dirname $(dirname $(dirname ${FELT_PATH})))))" +FLUTTER_DIR="${ENGINE_SRC_DIR}/flutter" +WEB_UI_DIR="${FLUTTER_DIR}/lib/web_ui" +DEV_DIR="${WEB_UI_DIR}/dev" +OUT_DIR="${ENGINE_SRC_DIR}/out" +HOST_DEBUG_UNOPT_DIR="${ENGINE_SRC_DIR}/out/host_debug_unopt" +DART_SDK_DIR="${ENGINE_SRC_DIR}/out/host_debug_unopt/dart-sdk" +GN="${FLUTTER_DIR}/tools/gn" + +if [ ! -d "${OUT_DIR}" ] || [ ! -d "${HOST_DEBUG_UNOPT_DIR}" ] +then + echo "Compiling the Dart SDK." + gclient sync + $GN --unoptimized --full-dart-sdk + ninja -C $HOST_DEBUG_UNOPT_DIR +fi + +(cd $WEB_UI_DIR && $DART_SDK_DIR/bin/dart dev/felt.dart $@) diff --git a/lib/web_ui/dev/test.dart b/lib/web_ui/dev/felt.dart similarity index 100% rename from lib/web_ui/dev/test.dart rename to lib/web_ui/dev/felt.dart diff --git a/lib/web_ui/dev/test_runner.dart b/lib/web_ui/dev/test_runner.dart index 8e8657bfcc56a..64363cd8b04cc 100644 --- a/lib/web_ui/dev/test_runner.dart +++ b/lib/web_ui/dev/test_runner.dart @@ -138,7 +138,10 @@ Future _buildTests() async { } } -Future _runTestBatch( +/// Runs a batch of tests. +/// +/// Unless [expectFailure] is set to false, sets [io.exitCode] to a non-zero value if any tests fail. +Future _runTestBatch( List testFiles, { @required int concurrency, @required bool expectFailure, @@ -174,6 +177,4 @@ Future _runTestBatch( io.exitCode = 1; } } - - return io.exitCode; }