Skip to content

[flutter_tools] make local engine integration testing easier #65802

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
[flutter_tools] add support for FLUTTER_LOCAL_ENGINE config in test d…
…river
  • Loading branch information
jonahwilliams committed Sep 14, 2020
commit 6cce488d80b1d4097cdc281cf60589c015d0b944
22 changes: 18 additions & 4 deletions packages/flutter_tools/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ $ ../../bin/flutter --version

To run Flutter Tools from source, in this directory run:
```shell
$ ../../bin/cache/dart-sdk/bin/dart bin/flutter_tools.dart
$ ../../bin/dart bin/flutter_tools.dart
```
followed by command-line arguments, as usual.

Expand Down Expand Up @@ -56,24 +56,38 @@ that add new code should aim to increase coverage. In particular, the coverage
of the diff should be close to the average coverage, and should ideally be
better.

#### Using local engine builds in integration tests

The integration tests can be configured to use a specific local engine
variant by setting the `FLUTTER_LOCAL_ENGINE` environment variable to the
name of the local engine (e.g. "android_debug_unopt"). If the local engine build
requires a source path, this can be provided by setting the `FLUTTER_LOCAL_ENGINE_SRC_PATH`
environment variable. This second variable is not necessary if the `flutter` and
`engine` checkouts are in adjacent directories.

```shell
export FLUTTER_LOCAL_ENGINE=android_debug_unopt
../../bin/dart test test/integration.shard/some_test_case
```

### Running the tests

To run the tests in the `test/` directory, first ensure that there are no
connected devices. Then, in this directory run:
```shell
$ ../../bin/cache/dart-sdk/bin/pub run test
$ ../../bin/dart pub run test
```

The tests in `test/integration.shard` are slower to run than the tests in
`test/general.shard`. To run only the tests in `test/general.shard`, in this
directory run:
```shell
$ ../../bin/cache/dart-sdk/bin/pub run test test/general.shard
$ ../../bin/dart pub run test test/general.shard
```

To run the tests in a specific file, run:
```shell
$ ../../bin/cache/dart-sdk/bin/pub run test test/general.shard/utils_test.dart
$ ../../bin/dart pub run test test/general.shard/utils_test.dart
```

### Forcing snapshot regeneration
Expand Down
15 changes: 15 additions & 0 deletions packages/flutter_tools/test/integration.shard/test_driver.dart
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@ import 'test_utils.dart';
// taking a long time are printed to the console.
const bool _printDebugOutputToStdOut = false;

const String kLocalEngineEnvironment = 'FLUTTER_LOCAL_ENGINE';
const String kLocalEngineLocation = 'FLUTTER_LOCAL_ENGINE_SRC_PATH';

final DateTime startTime = DateTime.now();

const Duration defaultTimeout = Duration(seconds: 5);
Expand Down Expand Up @@ -452,6 +455,10 @@ class FlutterRunTestDriver extends FlutterTestDriver {
'--disable-service-auth-codes',
if (machine) '--machine',
if (!spawnDdsInstance) '--disable-dds',
if (platform.environment.containsKey(kLocalEngineEnvironment))
'--local-engine=${platform.environment[kLocalEngineEnvironment]}',
if (platform.environment.containsKey(kLocalEngineLocation))
'--local-engine-src-path=${platform.environment[kLocalEngineLocation]}',
'-d',
if (chrome)
...<String>[
Expand Down Expand Up @@ -482,6 +489,10 @@ class FlutterRunTestDriver extends FlutterTestDriver {
await _setupProcess(
<String>[
'attach',
if (platform.environment.containsKey(kLocalEngineEnvironment))
'--local-engine=${platform.environment[kLocalEngineEnvironment]}',
if (platform.environment.containsKey(kLocalEngineLocation))
'--local-engine-src-path=${platform.environment[kLocalEngineLocation]}',
'--machine',
if (!spawnDdsInstance)
'--disable-dds',
Expand Down Expand Up @@ -705,6 +716,10 @@ class FlutterTestTestDriver extends FlutterTestDriver {
}) async {
await _setupProcess(<String>[
'test',
if (platform.environment.containsKey(kLocalEngineEnvironment))
'--local-engine=${platform.environment[kLocalEngineEnvironment]}',
if (platform.environment.containsKey(kLocalEngineLocation))
'--local-engine-src-path=${platform.environment[kLocalEngineLocation]}',
'--disable-service-auth-codes',
'--machine',
if (coverage)
Expand Down
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy