Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.
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
11 changes: 8 additions & 3 deletions testing/scenario_app/bin/android_integration_tests.dart
Original file line number Diff line number Diff line change
Expand Up @@ -170,15 +170,20 @@ void main(List<String> args) async {
});

await step('Running instrumented tests...', () async {
final int exitCode = await pm.runAndForward(<String>[
final (int exitCode, StringBuffer out) = await pm.runAndCapture(<String>[
adb.path,
'shell',
'am',
'instrument',
'-w', 'dev.flutter.scenarios.test/dev.flutter.TestRunner',
'-w',
'dev.flutter.scenarios.test/dev.flutter.TestRunner',
]);
if (exitCode != 0) {
panic(<String>['could not install test apk']);
panic(<String>['instrumented tests failed to run']);
}
if (out.toString().contains('FAILURES!!!')) {
stdout.write(out);
panic(<String>['1 or more tests failed']);
}
});
} finally {
Expand Down
7 changes: 7 additions & 0 deletions testing/scenario_app/bin/utils/process_manager_extension.dart
Original file line number Diff line number Diff line change
Expand Up @@ -45,4 +45,11 @@ extension RunAndForward on ProcessManager {
Future<int> runAndForward(List<String> cmd) async {
return pipeProcessStreams(await start(cmd), out: stdout);
}

/// Runs [cmd], and captures the stdout and stderr pipes.
Future<(int, StringBuffer)> runAndCapture(List<String> cmd) async {
final StringBuffer buffer = StringBuffer();
final int exitCode = await pipeProcessStreams(await start(cmd), out: buffer);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you need a try block here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No I don't believe so, it's OK for any errors to bubble up.

return (exitCode, buffer);
}
}