-
Notifications
You must be signed in to change notification settings - Fork 29.2k
[macOS] Refactor the flutter run
macOS console output test
#114645
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
Conversation
if ( | ||
!line.startsWith('Building flutter tool...') && | ||
!line.startsWith('Running "flutter pub get" in ui...') && | ||
!line.startsWith('Resolving dependencies...') && | ||
// Catch engine piped output from unrelated concurrent Flutter apps | ||
!line.contains(RegExp(r'[A-Z]\/flutter \([0-9]+\):')) && | ||
// Empty lines could be due to the progress spinner breaking up. | ||
line.length > 1 | ||
) { | ||
stdout.add(line); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FYI I removed this logic to ignore standard output as it had no effect on the test. The _findNextMatcherInList
helper used to verify console output can skip lines.
final String nextLine = list.first; | ||
list.removeAt(0); | ||
|
||
if (matcher(nextLine)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This may cause out-of-band failures when Xcode is updated, since Xcode loves to add debugging spew, and the macOS build output filtering is very manual:
flutter/packages/flutter_tools/lib/src/macos/build_macos.dart
Lines 22 to 28 in 850f3b3
/// When run in -quiet mode, Xcode should only print from the underlying tasks to stdout. | |
/// Passing this regexp to trace moves the stdout output to stderr. | |
/// | |
/// Filter out xcodebuild logging unrelated to macOS builds: | |
/// xcodebuild[2096:1927385] Requested but did not find extension point with identifier Xcode.IDEKit.ExtensionPointIdentifierToBundleIdentifier for extension Xcode.DebuggerFoundation.AppExtensionToBundleIdentifierMap.watchOS of plug-in com.apple.dt.IDEWatchSupportCore | |
/// note: Using new build system | |
final RegExp _filteredOutput = RegExp(r'^((?!Requested but did not find extension point with identifier|note\:).)*$'); |
(as opposed to iOS where the tool output comes from parsing the Xcode build result, not from Xcode build stdout, would really really love macOS to adopt this)
flutter/packages/flutter_tools/lib/src/ios/mac.dart
Lines 406 to 409 in 8aad119
final XCResultIssueDiscarder warningDiscarder = XCResultIssueDiscarder(typeMatcher: XCResultIssueType.warning); | |
final XCResultIssueDiscarder dartBuildErrorDiscarder = XCResultIssueDiscarder(messageMatcher: RegExp(r'Command PhaseScriptExecution failed with a nonzero exit code')); | |
final XCResultGenerator xcResultGenerator = XCResultGenerator(resultPath: resultBundle.absolute.path, xcode: globals.xcode!, processUtils: globals.processUtils); | |
xcResult = await xcResultGenerator.generate(issueDiscarders: <XCResultIssueDiscarder>[warningDiscarder, dartBuildErrorDiscarder]); |
Either we can make this more flexible and accept any upcoming line, or we can accept that additional filters may need to be applied as part of updating Xcode.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think this is a problem as this test ignores unmatched lines. It only checks that the expected lines are in standard output in the correct order. Any Xcode log spew on standard output would be ignored by this test.
Please let me know if I misunderstood your concern!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please let me know if I misunderstood your concern!
Nah I just have Friday brain, your logic LGTM.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
7fd41c3
to
b77f6f0
Compare
* a84e369 Revert "Allow Flutter golden file tests to be flaky (#114450)" (flutter/flutter#114902) * 1725a26 Switch the way we retrieve the vm_service_port from /hub to iquery, on device. (flutter/flutter#114834) * 7020f59 [tool] Support `--flavor` option for `flutter install`. (flutter/flutter#114048) * 9797d5f [macOS] Refactor the `flutter run` macOS console output test (flutter/flutter#114645) * 530324d Build command dependency injection (flutter/flutter#114383) * 69a542d Apply multidex config in kotlin dsl gradle file (flutter/flutter#114660) * 92f10ed match error statements without relying on volatile human-readable descriptions (flutter/flutter#114922) * d3dcd7d Update `CircleAvatar` to support Material 3 (flutter/flutter#114812)
* a84e369 Revert "Allow Flutter golden file tests to be flaky (#114450)" (flutter/flutter#114902) * 1725a26 Switch the way we retrieve the vm_service_port from /hub to iquery, on device. (flutter/flutter#114834) * 7020f59 [tool] Support `--flavor` option for `flutter install`. (flutter/flutter#114048) * 9797d5f [macOS] Refactor the `flutter run` macOS console output test (flutter/flutter#114645) * 530324d Build command dependency injection (flutter/flutter#114383) * 69a542d Apply multidex config in kotlin dsl gradle file (flutter/flutter#114660) * 92f10ed match error statements without relying on volatile human-readable descriptions (flutter/flutter#114922) * d3dcd7d Update `CircleAvatar` to support Material 3 (flutter/flutter#114812)
* a84e369 Revert "Allow Flutter golden file tests to be flaky (#114450)" (flutter/flutter#114902) * 1725a26 Switch the way we retrieve the vm_service_port from /hub to iquery, on device. (flutter/flutter#114834) * 7020f59 [tool] Support `--flavor` option for `flutter install`. (flutter/flutter#114048) * 9797d5f [macOS] Refactor the `flutter run` macOS console output test (flutter/flutter#114645) * 530324d Build command dependency injection (flutter/flutter#114383) * 69a542d Apply multidex config in kotlin dsl gradle file (flutter/flutter#114660) * 92f10ed match error statements without relying on volatile human-readable descriptions (flutter/flutter#114922) * d3dcd7d Update `CircleAvatar` to support Material 3 (flutter/flutter#114812)
* a84e369 Revert "Allow Flutter golden file tests to be flaky (#114450)" (flutter/flutter#114902) * 1725a26 Switch the way we retrieve the vm_service_port from /hub to iquery, on device. (flutter/flutter#114834) * 7020f59 [tool] Support `--flavor` option for `flutter install`. (flutter/flutter#114048) * 9797d5f [macOS] Refactor the `flutter run` macOS console output test (flutter/flutter#114645) * 530324d Build command dependency injection (flutter/flutter#114383) * 69a542d Apply multidex config in kotlin dsl gradle file (flutter/flutter#114660) * 92f10ed match error statements without relying on volatile human-readable descriptions (flutter/flutter#114922) * d3dcd7d Update `CircleAvatar` to support Material 3 (flutter/flutter#114812)
* a84e369 Revert "Allow Flutter golden file tests to be flaky (#114450)" (flutter/flutter#114902) * 1725a26 Switch the way we retrieve the vm_service_port from /hub to iquery, on device. (flutter/flutter#114834) * 7020f59 [tool] Support `--flavor` option for `flutter install`. (flutter/flutter#114048) * 9797d5f [macOS] Refactor the `flutter run` macOS console output test (flutter/flutter#114645) * 530324d Build command dependency injection (flutter/flutter#114383) * 69a542d Apply multidex config in kotlin dsl gradle file (flutter/flutter#114660) * 92f10ed match error statements without relying on volatile human-readable descriptions (flutter/flutter#114922) * d3dcd7d Update `CircleAvatar` to support Material 3 (flutter/flutter#114812)
The
run_release_test_macos
integration test verifies that that the console output offlutter run -d macos --release
is expected. This change introduces aRunOutputTask
abstraction so that the test's logic can be reused by other platforms like Android and Windows. This newRunOutputTask
mirrors other existing device lab tasks likeBuildTestTask
andPerfTest
.In the future, we will:
run_release_test
Android integration test toRunOutputTask
flutter run
console output integration test for Windows (see Test thatflutter run
doesn't introduce new debug spew #111577)flutter run
console output tests for other platforms like iOS, Linux, webPart of #111577
Pre-launch Checklist
///
).If you need help, consider asking for advice on the #hackers-new channel on Discord.