Implement System.Diagnostics.Process tests for Android#126099
Implement System.Diagnostics.Process tests for Android#126099adamsitnik merged 11 commits intomainfrom
Conversation
@copilot For now, please stick only with android |
Co-authored-by: adamsitnik <6011991+adamsitnik@users.noreply.github.com> Agent-Logs-Url: https://github.com/dotnet/runtime/sessions/52b94fd0-1cd0-4d55-b52f-3f41b2b5e6a4
…droid.cs Co-authored-by: adamsitnik <6011991+adamsitnik@users.noreply.github.com> Agent-Logs-Url: https://github.com/dotnet/runtime/sessions/800d4e96-f860-4a1c-89f3-e764451d1da9
Done in 403f131. Removed |
adamsitnik
left a comment
There was a problem hiding this comment.
@copilot address my feedback
src/libraries/System.Diagnostics.Process/tests/ProcessTests.Android.cs
Outdated
Show resolved
Hide resolved
src/libraries/System.Diagnostics.Process/tests/ProcessTests.Android.cs
Outdated
Show resolved
Hide resolved
src/libraries/System.Diagnostics.Process/tests/ProcessTests.AnyMobile.cs
Outdated
Show resolved
Hide resolved
…throughout Co-authored-by: adamsitnik <6011991+adamsitnik@users.noreply.github.com> Agent-Logs-Url: https://github.com/dotnet/runtime/sessions/8c73b007-1f6a-4064-8e02-ff21eaec112c
|
/azp list |
This comment was marked as resolved.
This comment was marked as resolved.
|
/azp run runtime-android runtime-androidemulator |
|
No pipelines are associated with this pull request. |
|
/azp run runtime-android |
|
Azure Pipelines successfully started running 1 pipeline(s). |
|
/azp run runtime-androidemulator |
|
Azure Pipelines successfully started running 1 pipeline(s). |
adamsitnik
left a comment
There was a problem hiding this comment.
@copilot I can see that only 3 test have failed (log):
I am not sure why. If we were missing permissions to launch the app, we would not get to comparing exit codes.
Perhaps we need to provide working directory in explicit way for the tests that use ls? Because the one using sleep has passed. @copilot give it a try (provide path to TEMP for example ProcessStartInfo.WorkingDirectory) unless you have better idea
03-25 11:06:25.769 6855 6881 I DOTNET : [PASS] System.Diagnostics.Tests.ProcessTests.GetProcesses_InvalidMachineName_ThrowsInvalidOperationException
03-25 11:06:25.828 6889 6889 W ls : type=1400 audit(0.0:5108): avc: denied { read } for name="/" dev="dm-3" ino=2 scontext=u:r:untrusted_app:s0:c14,c295,c512,c768 tcontext=u:object_r:rootfs:s0 tclass=dir permissive=0
03-25 11:06:25.910 6855 6881 I DOTNET : [FAIL] System.Diagnostics.Tests.ProcessTests.Process_Start_SimpleCommand_ExitsSuccessfully
03-25 11:06:25.910 6855 6881 I DOTNET : Assert.Equal() Failure: Values differ
03-25 11:06:25.910 6855 6881 I DOTNET : Expected: 0
03-25 11:06:25.910 6855 6881 I DOTNET : Actual: 1
03-25 11:06:25.910 6855 6881 I DOTNET : at System.Diagnostics.Tests.ProcessTests.Process_Start_SimpleCommand_ExitsSuccessfully()
03-25 11:06:25.910 6855 6881 I DOTNET : at System.Reflection.MethodBaseInvoker.InterpretedInvoke_Method(Object obj, IntPtr* args)
03-25 11:06:25.910 6855 6881 I DOTNET : at System.Reflection.MethodBaseInvoker.InvokeWithNoArgs(Object obj, BindingFlags invokeAttr)
03-25 11:06:25.914 6855 6881 I DOTNET : [PASS] System.Diagnostics.Tests.ProcessTests.HandleCount_GetNotStarted_ThrowsInvalidOperationException
03-25 11:06:25.914 6855 6881 I DOTNET : [IGNORED] System.Diagnostics.Tests.ProcessTests.TestExitTime
03-25 11:06:25.971 6890 6890 W ls : type=1400 audit(0.0:5109): avc: denied { read } for name="/" dev="dm-3" ino=2 scontext=u:r:untrusted_app:s0:c14,c295,c512,c768 tcontext=u:object_r:rootfs:s0 tclass=dir permissive=0
03-25 11:06:25.978 6855 6881 I DOTNET : [FAIL] System.Diagnostics.Tests.ProcessTests.Process_Start_CaptureStdout_ReadsOutput
03-25 11:06:25.978 6855 6881 I DOTNET : Assert.Equal() Failure: Values differ
03-25 11:06:25.978 6855 6881 I DOTNET : Expected: 0
03-25 11:06:25.978 6855 6881 I DOTNET : Actual: 1
03-25 11:06:25.978 6855 6881 I DOTNET : at System.Diagnostics.Tests.ProcessTests.Process_Start_CaptureStdout_ReadsOutput()
03-25 11:06:25.978 6855 6881 I DOTNET : at System.Reflection.MethodBaseInvoker.InterpretedInvoke_Method(Object obj, IntPtr* args)
03-25 11:06:25.978 6855 6881 I DOTNET : at System.Reflection.MethodBaseInvoker.InvokeWithNoArgs(Object obj, BindingFlags invokeAttr)
03-25 11:06:26.901 6855 6881 I DOTNET : [IGNORED] System.Diagnostics.Tests.ProcessTests.TestCreateNewProcessGroup_HandlerReceivesExpectedSignal
03-25 11:06:26.971 6897 6897 W ls : type=1400 audit(0.0:5113): avc: denied { read } for name="/" dev="dm-3" ino=2 scontext=u:r:untrusted_app:s0:c14,c295,c512,c768 tcontext=u:object_r:rootfs:s0 tclass=dir permissive=0
03-25 11:06:26.981 6855 6881 I DOTNET : [FAIL] System.Diagnostics.Tests.ProcessTests.Process_Start_WithArgumentList_ExitsSuccessfully
03-25 11:06:26.981 6855 6881 I DOTNET : Assert.Equal() Failure: Values differ
03-25 11:06:26.981 6855 6881 I DOTNET : Expected: 0
03-25 11:06:26.981 6855 6881 I DOTNET : Actual: 1
03-25 11:06:26.981 6855 6881 I DOTNET : at System.Diagnostics.Tests.ProcessTests.Process_Start_WithArgumentList_ExitsSuccessfully()
03-25 11:06:26.981 6855 6881 I DOTNET : at System.Reflection.MethodBaseInvoker.InterpretedInvoke_Method(Object obj, IntPtr* args)
03-25 11:06:26.981 6855 6881 I DOTNET : at System.Reflection.MethodBaseInvoker.InvokeWithNoArgs(Object obj, BindingFlags invokeAttr)
cc @lateralusX
|
Azure Pipelines successfully started running 1 pipeline(s). |
adamsitnik
left a comment
There was a problem hiding this comment.
@copilot the tests fail due to recently introduced ProcessHandlesTests tests. Go to ProcessHandlesTests.cs and annotate the entire class with [SkipOnPlatform(TestPlatforms.Android, "sh is not available on Android")]
Agent-Logs-Url: https://github.com/dotnet/runtime/sessions/1cc664b6-0eef-437b-8198-828ddf712f1e Co-authored-by: adamsitnik <6011991+adamsitnik@users.noreply.github.com>
Done in a2efbde. Added |
|
/azp run runtime-android |
|
/azp run runtime-androidemulator |
This comment has been minimized.
This comment has been minimized.
🤖 Copilot Code Review — PR #126099Note This review was generated by GitHub Copilot using multi-model analysis (Claude Opus 4.6 primary, Claude Sonnet 4.5 secondary). Findings were independently verified against full source files and native code. Holistic AssessmentMotivation: This PR adds Approach: The approach is sound — moving pipe creation from platform-specific Summary: Detailed Findings
|
|
lateralusX
left a comment
There was a problem hiding this comment.
Android process tests LGTM!
|
/ba-g failures are unrelated, the Android tests for Process are passing now |
|
Tagging subscribers to 'arch-android': @vitek-karas, @simonrozsival, @steveisok, @akoeplinger |
All existing
System.Diagnostics.Processtests depend onRemoteExecutor, which is unsupported on mobile platforms — leaving zero test coverage for Android.Changes
System.Diagnostics.Process.Tests.csprojandroidtoTargetFrameworksandroid— necessary becauseProcessTests.cscallsWriteScriptFiledefined inProcessTests.Unix.cs<Compile>entry for newProcessTests.Android.csProcessTests.Android.cs(new)Five Android-specific tests using
lsandsleep, resolved via PATH (which includes/system/binon Android via toybox/busybox). Tool names are passed directly toProcess.Start. Thelstests targetPath.GetTempPath()rather than/to avoid Android SELinux denyinguntrusted_appaccess to the root filesystem.Process_Start_InheritedIO_ExitsSuccessfullyls <TempPath>exits 0 with inherited parent handles,HasExited = trueProcess_Start_RedirectedStandardOutput_ReadsOutputProcess_Kill_TerminatesRunningProcesssleep 600can be killed;Id > 0;HasExitedtransitions correctlyProcess_Start_ExitCode_ReflectsCommandFailureProcess_ProcessName_IsSetForStartedProcessProcessNameis populatedProcess_Start_WithStandardHandles_CanRedirectIOStandardInputHandle(File.OpenNullHandle()),StandardOutputHandle(anonymous pipe, output asserted non-empty), andStandardErrorHandle(temp file) APIsAll tests are gated with
[PlatformSpecific(TestPlatforms.Android)].ProcessHandlesTests.cs(existing)ProcessHandlesTestsclass with[SkipOnPlatform(TestPlatforms.Android, "sh is not available on Android")]— the tests in this class useshwhich is not available on Android, causing failures when the test project runs on that platform.Original prompt
⚡ Quickly spin up Copilot coding agent tasks from anywhere on your macOS or Windows machine with Raycast.