Skip to content
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

improve resiliency of process tests #35584

Merged
merged 3 commits into from
Apr 30, 2020
Merged

improve resiliency of process tests #35584

merged 3 commits into from
Apr 30, 2020

Conversation

wfurt
Copy link
Member

@wfurt wfurt commented Apr 28, 2020

I suspect Kill_ExitedChildProcess_DoesNotThrow is hanging in the WaitForExit so I modify it to use overload with timeout. I also add time limit and some more instrumentation to the Unix version.

Now the test should fail instead of hanging and we should hopefully collect more information.

fixes #35506

@wfurt wfurt added area-System.Diagnostics test-enhancement Improvements of test source code labels Apr 28, 2020
@wfurt wfurt requested review from stephentoub and danmoseley April 28, 2020 21:08
@ghost
Copy link

ghost commented Apr 28, 2020

Tagging subscribers to this area: @tommcdon, @krwq
Notify danmosemsft if you want to be subscribed.

Copy link
Member

@krwq krwq left a comment

Choose a reason for hiding this comment

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

LGTM thanks for adding those. Couple of optional comments

@@ -2119,7 +2119,7 @@ public void Kill_ExitedChildProcess_DoesNotThrow(bool killTree)
Process process = CreateProcess();
process.Start();

process.WaitForExit();
Assert.True(process.WaitForExit(Helpers.PassingTestTimeoutMilliseconds));
Copy link
Member

Choose a reason for hiding this comment

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

We already have WaitInMS for this (its 5 mins but that should still be OK)

Process[] all = Process.GetProcesses();
foreach (Process p in all)
{
Console.WriteLine("{0,8} {1}", p.Id, p.ProcessName);
Copy link
Member

Choose a reason for hiding this comment

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

Nit:

p.Dispose();

@wfurt wfurt merged commit 543037d into dotnet:master Apr 30, 2020
@wfurt wfurt deleted the processTests branch April 30, 2020 19:16
@ghost ghost locked as resolved and limited conversation to collaborators Dec 9, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-System.Diagnostics test-enhancement Improvements of test source code
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Long Running Test - System.Diagnostics.Tests.ProcessTests.Kill_ExitedChildProcess_DoesNotThrow
4 participants