Commit db371c10 authored by Tamar Christina's avatar Tamar Christina
Browse files

T11300: Fix test on windows

Summary: Fix exit code for Windows to match expected for out-of-memory test

Test Plan: ./validate

Reviewers: simonmar, austin, thomie, bgamari

Reviewed By: thomie, bgamari

Differential Revision: https://phabricator.haskell.org/D1753

GHC Trac Issues: #11422
parent fd686c43
......@@ -59,7 +59,8 @@ allocNew(nat n) {
rec=0;
if (GetLastError() == ERROR_NOT_ENOUGH_MEMORY) {
errorBelch("out of memory");
errorBelch("Out of memory");
stg_exit(EXIT_HEAPOVERFLOW);
} else {
sysErrorBelch(
"getMBlocks: VirtualAlloc MEM_RESERVE %d blocks failed", n);
......@@ -177,7 +178,7 @@ commitBlocks(char* base, W_ size) {
temp = VirtualAlloc(base, size_delta, MEM_COMMIT, PAGE_READWRITE);
if(temp==0) {
sysErrorBelch("getMBlocks: VirtualAlloc MEM_COMMIT failed");
stg_exit(EXIT_FAILURE);
stg_exit(EXIT_HEAPOVERFLOW);
}
size-=size_delta;
base+=size_delta;
......
......@@ -23,21 +23,20 @@
// this should be in <excpt.h>, but it's been removed from MinGW distributions
#ifndef EH_UNWINDING
#define EH_UNWINDING 0x02
#define EH_UNWINDING 0x02
#endif /* EH_UNWINDING */
// Registered exception handler
PVOID __hs_handle = NULL;
long WINAPI __hs_exception_handler(struct _EXCEPTION_POINTERS *exception_data)
{
{
long action = EXCEPTION_CONTINUE_SEARCH;
// When the system unwinds the VEH stack after having handled an excn,
// return immediately.
if ((exception_data->ExceptionRecord->ExceptionFlags & EH_UNWINDING) == 0)
{
// Error handling cases covered by this implementation.
switch (exception_data->ExceptionRecord->ExceptionCode) {
case EXCEPTION_FLT_DIVIDE_BY_ZERO:
......@@ -62,7 +61,7 @@ long WINAPI __hs_exception_handler(struct _EXCEPTION_POINTERS *exception_data)
if (EXCEPTION_CONTINUE_EXECUTION == action)
{
fflush(stdout);
stg_exit(1);
stg_exit(EXIT_FAILURE);
}
}
......@@ -88,7 +87,7 @@ void __unregister_hs_exception_handler( void )
{
if (__hs_handle != NULL)
{
// Should the return value be checked? we're terminating anyway.
// Should the return value be checked? we're terminating anyway.
RemoveVectoredExceptionHandler(__hs_handle);
__hs_handle = NULL;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment