Skip to content

Commit

Permalink
Fix stack overflow tests to accept 800703E9 exit code too (dotnet#65331)
Browse files Browse the repository at this point in the history
Sometimes a process failing with stack overflow returns exit code
0x800703e9 (ERROR_STACK_OVERFLOW). This change updates the stack
overflow test to accept that code too.
  • Loading branch information
janvorli authored Feb 15, 2022
1 parent 6a69afc commit ec965b5
Showing 1 changed file with 11 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -40,19 +40,25 @@ static bool TestStackOverflow(string testName, string testArgs, out List<string>

stderrLines = lines;

int expectedExitCode;
int[] expectedExitCodes;
if ((Environment.OSVersion.Platform == PlatformID.Unix) || (Environment.OSVersion.Platform == PlatformID.MacOSX))
{
expectedExitCode = 128 + 6;
expectedExitCodes = new int[] { 128 + 6};
}
else
{
expectedExitCode = unchecked((int)0xC00000FD);
expectedExitCodes = new int[] { unchecked((int)0xC00000FD), unchecked((int)0x800703E9) };
}

if (testProcess.ExitCode != expectedExitCode)
if (!Array.Exists(expectedExitCodes, code => testProcess.ExitCode == code))
{
Console.WriteLine($"Exit code: 0x{testProcess.ExitCode:X8}, expected 0x{expectedExitCode:X8}");
string separator = string.Empty;
StringBuilder expectedListBuilder = new StringBuilder();
Array.ForEach(expectedExitCodes, code => {
expectedListBuilder.Append($"{separator}0x{code:X8}");
separator = " or ";
});
Console.WriteLine($"Exit code: 0x{testProcess.ExitCode:X8}, expected {expectedListBuilder.ToString()}");
return false;
}

Expand Down

0 comments on commit ec965b5

Please sign in to comment.