Clean up startProgress logic. (#19695) (#20009)

Disallow calling stop() or cancel() multiple times. This means that
when you use startProgress you have to more carefully think about what
exactly is going on.

Properly cancel startProgress in non-ANSI situations, so that
back-to-back startProgress calls all render to the console.
This commit is contained in:
Ian Hickson
2018-07-30 16:58:07 -07:00
committed by GitHub
parent ee396272d3
commit acf4b6c1aa
15 changed files with 261 additions and 243 deletions

View File

@@ -106,6 +106,18 @@ You must set the `ANDROID_HOME` environment variable to run tests on Android. If
you have a local build of the Flutter engine, then you have a copy of the
Android SDK at `.../engine/src/third_party/android_tools/sdk`.
You can find where your Android SDK is using `flutter doctor`.
## Running all tests
To run all tests defined in `manifest.yaml`, use option `-a` (`--all`):
```sh
dart bin/run.dart -a
```
## Running specific tests
To run a test, use option `-t` (`--task`):
```sh
@@ -127,20 +139,15 @@ To run multiple tests, repeat option `-t` (`--task`) multiple times:
dart bin/run.dart -t test1 -t test2 -t test3
```
To run all tests defined in `manifest.yaml`, use option `-a` (`--all`):
To run tests from a specific stage, use option `-s` (`--stage`).
Currently there are only three stages defined, `devicelab`,
`devicelab_ios` and `devicelab_win`.
```sh
dart bin/run.dart -a
```
To run tests from a specific stage, use option `-s` (`--stage`):
```sh
dart bin/run.dart -s {NAME_OF_STAGE}
```
Currently there are only three stages defined, `devicelab`, `devicelab_ios` and `devicelab_win`.
# Reproducing broken builds locally
To reproduce the breakage locally `git checkout` the corresponding Flutter

View File

@@ -31,14 +31,13 @@ Future<void> testReload(Process process, { Future<void> Function() onListening }
.listen((String line) {
print('attach:stdout: $line');
stdout.add(line);
if (line.contains('Waiting') && onListening != null) {
if (line.contains('Waiting') && onListening != null)
listening.complete(onListening());
}
if (line.contains('To quit, press "q".'))
ready.complete();
if (line.contains('Reloaded '))
reloaded.complete();
if (line.contains('Restarted app in '))
if (line.contains('Restarted application in '))
restarted.complete();
if (line.contains('Application finished'))
finished.complete();
@@ -91,7 +90,7 @@ void main() {
await device.unlock();
final Directory appDir = dir(path.join(flutterDirectory.path, 'dev/integration_tests/ui'));
await inDirectory(appDir, () async {
section('Build: starting...');
section('Building');
final String buildStdout = await eval(
path.join(flutterDirectory.path, 'bin', 'flutter'),
<String>['--suppress-analytics', 'build', 'apk', '--debug', 'lib/main.dart'],
@@ -105,7 +104,7 @@ void main() {
await device.adb(<String>['install', '-r', apkPath]);
try {
section('Launching attach.');
section('Launching `flutter attach`');
Process attachProcess = await startProcess(
path.join(flutterDirectory.path, 'bin', 'flutter'),
<String>['--suppress-analytics', 'attach', '-d', device.deviceId],
@@ -113,7 +112,6 @@ void main() {
);
await testReload(attachProcess, onListening: () async {
section('Launching app.');
await device.shellExec('am', <String>['start', '-n', kActivityId]);
});
@@ -124,15 +122,16 @@ void main() {
final String currentTime = (await device.shellEval('date', <String>['"+%F %R:%S.000"'])).trim();
print('Start time on device: $currentTime');
section('Launching app');
section('Relaunching application');
await device.shellExec('am', <String>['start', '-n', kActivityId]);
// If the next line fails, your device may not support regexp search.
final String observatoryLine = await device.adb(<String>['logcat', '-e', 'Observatory listening on http:', '-m', '1', '-T', currentTime]);
print('Found observatory line: $observatoryLine');
final String observatoryPort = new RegExp(r'Observatory listening on http://.*:([0-9]+)').firstMatch(observatoryLine)[1];
print('Extracted observatory port: $observatoryPort');
section('Launching attach with given port.');
section('Launching attach with given port');
attachProcess = await startProcess(
path.join(flutterDirectory.path, 'bin', 'flutter'),
<String>['--suppress-analytics', 'attach', '--debug-port', observatoryPort, '-d', device.deviceId],

View File

@@ -58,6 +58,8 @@ void main() {
stdout.removeAt(0);
if (stdout.first == 'Initializing gradle...')
stdout.removeAt(0);
if (stdout.first == 'Resolving dependencies...')
stdout.removeAt(0);
if (!(stdout.first.startsWith('Launching lib/main.dart on ') && stdout.first.endsWith(' in release mode...')))
throw 'flutter run --release had unexpected first line: ${stdout.first}';
stdout.removeAt(0);