Browse Source

Fixed CancelLongRunningAppTestFixture test - process.Kill() / Win32 TerminateProcess does not wait for the termination to finish, so sometimes the test has to wait a bit to see if the process was killed successfully.

git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/branches/3.0@3429 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61
shortcuts
Daniel Grunwald 17 years ago
parent
commit
79e074f98f
  1. 10
      src/Main/Base/Test/CancelLongRunningAppTestFixture.cs

10
src/Main/Base/Test/CancelLongRunningAppTestFixture.cs

@ -30,7 +30,7 @@ namespace ICSharpCode.SharpDevelop.Tests @@ -30,7 +30,7 @@ namespace ICSharpCode.SharpDevelop.Tests
public void Cancel()
{
runner.Start(GetConsoleAppFileName(), "-forever");
string processName = Path.GetFileName(GetConsoleAppFileName());
processName = Path.ChangeExtension(processName, null);
@ -44,7 +44,13 @@ namespace ICSharpCode.SharpDevelop.Tests @@ -44,7 +44,13 @@ namespace ICSharpCode.SharpDevelop.Tests
// Check console app has been shutdown.
runningProcesses = Process.GetProcessesByName(processName);
Assert.AreEqual(0, runningProcesses.Length, "Process should have stopped.");
if (runningProcesses.Length == 1) {
// Windows kills the process asynchronously, so sometimes we have to wait a bit
if (!runningProcesses[0].WaitForExit(2500))
Assert.Fail("Process should have stopped.");
} else {
Assert.AreEqual(0, runningProcesses.Length, "Process should have stopped.");
}
}
}
}

Loading…
Cancel
Save