Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Terminate simulator app on "q" #114114

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 2 commits into from
Oct 27, 2022
Merged

Terminate simulator app on "q" #114114

merged 2 commits into from
Oct 27, 2022

Conversation

jmagman
Copy link
Member

@jmagman jmagman commented Oct 26, 2022

#113581 caused a TAP failure as a null ApplicationPackage was being passed into stopApp. It was partially reverted with #114083.

Re-land, handling the null case, plus a test.

Fixes #113580
Fixes #52232

Pre-launch Checklist

  • I read the Contributor Guide and followed the process outlined there for submitting PRs.
  • I read the Tree Hygiene wiki page, which explains my responsibilities.
  • I read and followed the Flutter Style Guide, including Features we expect every widget to implement.
  • I signed the CLA.
  • I listed at least one issue that this PR fixes in the description above.
  • I updated/added relevant documentation (doc comments with ///).
  • I added new tests to check the change I am making, or this PR is test-exempt.
  • All existing and new tests are passing.

If you need help, consider asking for advice on the #hackers-new channel on Discord.

@jmagman jmagman added platform-ios iOS applications specifically tool Affects the "flutter" command-line tool. See also t: labels. labels Oct 26, 2022
@jmagman jmagman self-assigned this Oct 26, 2022
@flutter-dashboard flutter-dashboard bot added the c: contributor-productivity Team-specific productivity, code health, technical debt. label Oct 26, 2022
@@ -533,11 +552,13 @@ class IOSSimulator extends Device {

@override
Future<bool> stopApp(
ApplicationPackage app, {
ApplicationPackage? app, {
Copy link
Member Author

Choose a reason for hiding this comment

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

This is new.

String? userIdentifier,
}) async {
// Currently we don't have a way to stop an app running on iOS.
return false;
if (app == null) {
Copy link
Member Author

Choose a reason for hiding this comment

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

This null check is new.

Copy link
Contributor

Choose a reason for hiding this comment

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

when app is null, does it mean it's running on simulator? (maybe add a comment?)

Copy link
Contributor

Choose a reason for hiding this comment

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

I believe the only situation the app could be null is if we're in a web context where we allow running an app even if you don't have a platform directory

Copy link
Contributor

Choose a reason for hiding this comment

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

or you wrote a tap test that passes null...

Copy link
Member Author

Choose a reason for hiding this comment

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

when app is null, does it mean it's running on simulator? (maybe add a comment?)

This is the stopApp on IOSSimulator, it would only be called if the device is a simulator.

or you wrote a tap test that passes null...

It's essentially this 🙂
There's some subtle null safety issues going on here #114090, and I tried to resolve some of it in #114112

The base class Device can take a null app package because it's not needed for web devices.

Future<bool> stopApp(
covariant ApplicationPackage? app, {
String? userIdentifier,
});

That means the subclasses need to be able to handle a null app bundle being passed in, even if it's pretty meaningless to that device (everything but web). When this PR first landed, it caused a TAP test failure that blocked the g3 roll
https://fusion2.corp.google.com/invocations/68e930bd-fdd0-486f-9b8d-dec7798677c9/targets/%2F%2Fmobile%2Fflutter%2Ftests%2Fapp:app_basic_runner_attach_ios_test_IPHONE_11_13_0/log

[   +1 ms] An Observatory debugger and profiler on iOS Simulator 1666796923577 is available at: http://127.0.0.1:55892/
stderr: [   +7 ms] NoSuchMethodError: The getter 'id' was called on null.
stderr:            Receiver: null
stderr:            Tried calling: id
stderr:            #0      Object.noSuchMethod (dart:core-patch/object_patch.dart:38:5)
stderr:            #1      IOSSimulator.stopApp (package:flutter_tools/src/ios/simulators.dart:558:47)
stderr:            #2      FlutterDevice.exitApps (package:flutter_tools/src/resident_runner.dart:358:19)
stderr:            #3      ResidentRunner.exitApp (package:flutter_tools/src/resident_runner.dart:1431:67)
stderr:            #4      ResidentRunner.exit (package:flutter_tools/src/resident_runner.dart:1276:11)
stderr:            <asynchronous suspension>
stderr:            #5      TerminalHandler._commonTerminalInputHandler (package:[flutter_tools/src/resident_runner.dart:1701](https://cs.corp.google.com/piper///depot/google3/flutter_tools/src/resident_runner.dart?l=1701&ws=tap-presubmit-rerun-server/2126220&snapshot=2):9)
stderr:            <asynchronous suspension>
stderr:            #6      TerminalHandler.processTerminalInput (package:[flutter_tools/src/resident_runner.dart:1760](https://cs.corp.google.com/piper///depot/google3/flutter_tools/src/resident_runner.dart?l=1760&ws=tap-presubmit-rerun-server/2126220&snapshot=2):7)
stderr:            <asynchronous suspension>

Copy link
Contributor

Choose a reason for hiding this comment

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

may i ask what's TAP?

Copy link
Contributor

Choose a reason for hiding this comment

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

Actually, can you add a TODO comment here that we should probably be throwing an UnimplementedError here and the TAP test updated?

Copy link
Contributor

@christopherfujino christopherfujino Oct 27, 2022

Choose a reason for hiding this comment

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

may i ask what's TAP?

Google's internal test runner. So this passed LUCI tests, and then broke internal tests the first time.

Copy link
Contributor

Choose a reason for hiding this comment

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

am i correct to say LUCI is running on our github CI for public flutter, and TAP is running on google's internal CI for internal flutter deployment?

Copy link
Contributor

Choose a reason for hiding this comment

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

Yep

expect(fakeProcessManager, hasNoRemainingExpectations);
});

testWithoutContext('simulator stopApp handles null app package', () async {
Copy link
Member Author

Choose a reason for hiding this comment

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

This test is new.

Copy link
Contributor

@christopherfujino christopherfujino left a comment

Choose a reason for hiding this comment

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

LGTM

@jmagman jmagman added the autosubmit Merge PR when tree becomes green via auto submit App label Oct 27, 2022
@auto-submit auto-submit bot merged commit 15e6944 into flutter:master Oct 27, 2022
@jmagman jmagman deleted the simulator-q branch October 27, 2022 22:06
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Oct 28, 2022
engine-flutter-autoroll added a commit to engine-flutter-autoroll/plugins that referenced this pull request Oct 28, 2022
engine-flutter-autoroll added a commit to engine-flutter-autoroll/plugins that referenced this pull request Oct 28, 2022
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Oct 28, 2022
engine-flutter-autoroll added a commit to engine-flutter-autoroll/plugins that referenced this pull request Oct 28, 2022
CaseyHillers added a commit that referenced this pull request Nov 2, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
autosubmit Merge PR when tree becomes green via auto submit App c: contributor-productivity Team-specific productivity, code health, technical debt. platform-ios iOS applications specifically tool Affects the "flutter" command-line tool. See also t: labels.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Stopping iOS simulator app with q during run does not stop the app Stopping a debug session does not terminate the app on iOS
3 participants