-
Notifications
You must be signed in to change notification settings - Fork 28.6k
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
Terminate simulator app on "q" #114114
Conversation
@@ -533,11 +552,13 @@ class IOSSimulator extends Device { | |||
|
|||
@override | |||
Future<bool> stopApp( | |||
ApplicationPackage app, { | |||
ApplicationPackage? app, { |
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 is new.
String? userIdentifier, | ||
}) async { | ||
// Currently we don't have a way to stop an app running on iOS. | ||
return false; | ||
if (app == null) { |
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 null check is new.
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.
when app
is null, does it mean it's running on simulator? (maybe add a comment?)
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 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
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.
or you wrote a tap test that passes null...
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.
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.
flutter/packages/flutter_tools/lib/src/device.dart
Lines 585 to 588 in 80d4e5a
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>
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.
may i ask what's TAP?
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.
Actually, can you add a TODO comment here that we should probably be throwing an UnimplementedError
here and the TAP test updated?
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.
may i ask what's TAP?
Google's internal test runner. So this passed LUCI tests, and then broke internal tests the first time.
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.
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?
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.
Yep
expect(fakeProcessManager, hasNoRemainingExpectations); | ||
}); | ||
|
||
testWithoutContext('simulator stopApp handles null app package', () async { |
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 test is new.
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
This reverts commit 15e6944.
#113581 caused a TAP failure as a null
ApplicationPackage
was being passed intostopApp
. It was partially reverted with #114083.Re-land, handling the null case, plus a test.
Fixes #113580
Fixes #52232
Pre-launch Checklist
///
).If you need help, consider asking for advice on the #hackers-new channel on Discord.