[tests] Add DotNetRunCtrlC integration test#11293
Draft
jonathanpeppers wants to merge 1 commit intomainfrom
Draft
[tests] Add DotNetRunCtrlC integration test#11293jonathanpeppers wants to merge 1 commit intomainfrom
jonathanpeppers wants to merge 1 commit intomainfrom
Conversation
Add a device integration test that verifies Ctrl+C (SIGINT) sent to
`dotnet run` properly stops the Android app on the device/emulator.
The test:
1. Builds and launches an Android app via `dotnet run` with WaitForExit
2. Waits for app logcat output confirming launch
3. Verifies the app PID exists on the device
4. Sends SIGINT via Process.SendCtrlC() extension method
5. Asserts the process exits gracefully
6. Verifies Microsoft.Android.Run's Ctrl+C handler ran ("Stopping application...")
7. Confirms the app is no longer running on the device
Also adds a `SendCtrlC()` extension method on `Process` in
`ProcessExtensions.cs`, using libc `kill(pid, SIGINT)` P/Invoke.
Windows support is not yet implemented (throws PlatformNotSupportedException).
Fixes: #11264
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
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
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.
Adds a device integration test that verifies Ctrl+C (SIGINT) sent to
dotnet runproperly stops the Android app on the device/emulator.Test flow:
dotnet runwithWaitForExit=trueadb shell pidofprocess.SendCtrlC()extension methodMicrosoft.Android.Run's Ctrl+C handler ran ("Stopping application...")Also adds a
SendCtrlC()extension method onProcessinProcessExtensions.cs, using libckill(pid, SIGINT)P/Invoke (Unix/macOS only; throwsPlatformNotSupportedExceptionon Windows).Fixes #11264