-
Notifications
You must be signed in to change notification settings - Fork 29.7k
Terminate the test device if the flutter tool is signal-killed.
#159115
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
matanlurey
merged 3 commits into
flutter:master
from
matanlurey:shutdown-hooks-test-device
Nov 19, 2024
Merged
Terminate the test device if the flutter tool is signal-killed.
#159115
matanlurey
merged 3 commits into
flutter:master
from
matanlurey:shutdown-hooks-test-device
Nov 19, 2024
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
DanTup
approved these changes
Nov 19, 2024
Contributor
DanTup
left 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.
Testing with this script on Windows:
import 'dart:async';
import 'dart:convert';
import 'package:process/process.dart';
import 'package:path/path.dart' as path;
const String flutterPath = r"D:\Dev\Google\Flutter\Flutter main";
main() async {
List<String> cmd = <String>[
path.join(flutterPath, 'bin', 'flutter.bat'),
"test",
"--machine",
];
final processManager = LocalProcessManager();
final proc = await processManager.start(
cmd,
environment: <String, String>{'FLUTTER_TEST': 'true'},
workingDirectory: "$flutterPath/examples/hello_world",
);
final pidCompleter = Completer<int>();
proc.stdout.transform(utf8.decoder).listen((line) {
if (RegExp(r'"pid":(\d+)').firstMatch(line) case var match?) {
pidCompleter.complete(int.parse(match.group(1)!));
}
print(line);
});
proc.stderr.transform(utf8.decoder).listen(print);
final pid = await pidCompleter.future;
await Future.delayed(const Duration(seconds: 1));
print('KILLING PROCESS $pid');
processManager.killPid(pid);
}Without this PR, a flutter_tester process is left around, but with this change, it is not.
andrewkolos
approved these changes
Nov 19, 2024
Contributor
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.
thank you 🙏
github-merge-queue bot
pushed a commit
that referenced
this pull request
Nov 19, 2024
…159117) Towards #51421. ```sh flutter_tools % dart test test/integration.shard/break_on_framework_exceptions_test.dart 02:38 +29: All tests passed! 54692 ttys003 0:00.02 /opt/homebrew/bin/zsh -il ``` Requires #159115 for the process cleanup to work properly, but this is safe to land as-is, otherwise we still accumulate `flutter` processes over and over as each test case runs which is not WAI.
engine-flutter-autoroll
added a commit
to engine-flutter-autoroll/packages
that referenced
this pull request
Nov 19, 2024
auto-submit bot
pushed a commit
to flutter/packages
that referenced
this pull request
Nov 19, 2024
flutter/flutter@b3818f6...8536b96 2024-11-19 [email protected] Terminate `flutter test` when no longer needed in integration test. (flutter/flutter#159117) 2024-11-19 [email protected] Terminate the test device if the `flutter` tool is signal-killed. (flutter/flutter#159115) 2024-11-19 [email protected] Roll Packages from c1eabf5 to fc4adc7 (10 revisions) (flutter/flutter#159143) 2024-11-19 [email protected] Deflake api 35 emulator tests by updating emulator definitions version to latest available from chrome infra (flutter/flutter#158017) 2024-11-19 [email protected] Roll Flutter Engine from b6723e33b858 to cff1e751f853 (1 revision) (flutter/flutter#159141) 2024-11-19 [email protected] Fix InkWell overlayColor resolution ignores selected state (flutter/flutter#159072) 2024-11-19 [email protected] Roll Flutter Engine from 983b7b85d122 to b6723e33b858 (3 revisions) (flutter/flutter#159134) 2024-11-19 [email protected] Roll Flutter Engine from c1b0e18a70b3 to 983b7b85d122 (2 revisions) (flutter/flutter#159124) 2024-11-19 [email protected] Roll Flutter Engine from 878f593802e1 to c1b0e18a70b3 (13 revisions) (flutter/flutter#159118) 2024-11-19 [email protected] [SwiftPM] Move where the migration checks feature flags (flutter/flutter#159110) 2024-11-18 [email protected] Plumbs `scrollBehavior` into `SelectableText` so that the scrollbar may be hidden (flutter/flutter#158887) 2024-11-18 [email protected] Add a tag and assert some state in FlutterTestDriver tests. (flutter/flutter#159099) 2024-11-18 49699333+dependabot[bot]@users.noreply.github.com Bump codecov/codecov-action from 4.6.0 to 5.0.2 in the all-github-actions group (flutter/flutter#159104) 2024-11-18 [email protected] Add `@protected` to public `State` method overrides (flutter/flutter#157313) 2024-11-18 [email protected] Roll Flutter Engine from 9686de154114 to 878f593802e1 (5 revisions) (flutter/flutter#159097) 2024-11-18 [email protected] Fix flaky failure related to core_device_list.json not being found (flutter/flutter#158946) 2024-11-18 [email protected] Prettier merge_queue.md (flutter/flutter#158969) 2024-11-18 [email protected] Define and use `flutterBin` consistently across `integration.shard`. (flutter/flutter#159007) 2024-11-18 [email protected] No longer download `android-x86-jit-release`. (flutter/flutter#159011) 2024-11-18 [email protected] Roll Flutter Engine from e1f4e7d9bfc4 to 9686de154114 (1 revision) (flutter/flutter#159082) 2024-11-18 [email protected] Roll Flutter Engine from f365c9f5dce3 to e1f4e7d9bfc4 (4 revisions) (flutter/flutter#159078) 2024-11-18 [email protected] Roll Packages from b164be3 to c1eabf5 (6 revisions) (flutter/flutter#159077) If this roll has caused a breakage, revert this CL and stop the roller using the controls here: https://autoroll.skia.org/r/flutter-packages Please CC [email protected],[email protected] on the revert to ensure that a human is aware of the problem. To file a bug in Packages: https://github.com/flutter/flutter/issues/new/choose To report a problem with the AutoRoller itself, please file a bug: https://issues.skia.org/issues/new?component=1389291&template=1850622 Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
This was referenced Nov 20, 2024
Contributor
|
Nice! |
11 tasks
engine-flutter-autoroll
added a commit
to engine-flutter-autoroll/packages
that referenced
this pull request
Feb 12, 2025
engine-flutter-autoroll
added a commit
to engine-flutter-autoroll/packages
that referenced
this pull request
Feb 13, 2025
engine-flutter-autoroll
added a commit
to engine-flutter-autoroll/packages
that referenced
this pull request
Feb 13, 2025
engine-flutter-autoroll
added a commit
to engine-flutter-autoroll/packages
that referenced
this pull request
Mar 6, 2025
engine-flutter-autoroll
added a commit
to engine-flutter-autoroll/packages
that referenced
this pull request
Mar 7, 2025
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Closes #20949.
Signals (such as SIGTERM or SIGKILL) end up flowing through
exitWithHooks, which in turn, after running hooks, callexit().That means, as a result, anytry { } finally { }guarded execution may not run, which happens to also be howflutter_testerinstances are cleaned up if they have not terminated.This PR adds in-progress
flutter_testerruns (or any platformflutter_platformsupports) to the shutdown hooks, guaranteeing that the finalizers (which in turn, kill the process) are always executed as long as either the test completes, orexitWithHooksis called.The existing integration tests (
integration.shard/test_test.dart) still pass as well.