[commit: ghc] master: T11300: Fix test on windows (db371c1)

git at git.haskell.org git at git.haskell.org
Thu Jan 14 20:24:13 UTC 2016


Repository : ssh://git@git.haskell.org/ghc

On branch  : master
Link       : http://ghc.haskell.org/trac/ghc/changeset/db371c10a2da722a18b0d5bc042eb2d02ba60e1b/ghc

>---------------------------------------------------------------

commit db371c10a2da722a18b0d5bc042eb2d02ba60e1b
Author: Tamar Christina <tamar at zhox.com>
Date:   Sun Jan 10 07:20:57 2016 +0100

    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


>---------------------------------------------------------------

db371c10a2da722a18b0d5bc042eb2d02ba60e1b
 rts/win32/OSMem.c    | 5 +++--
 rts/win32/veh_excn.c | 3 +--
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/rts/win32/OSMem.c b/rts/win32/OSMem.c
index 47e24f0..0009a4e 100644
--- a/rts/win32/OSMem.c
+++ b/rts/win32/OSMem.c
@@ -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;
diff --git a/rts/win32/veh_excn.c b/rts/win32/veh_excn.c
index a24354e..bf2151a 100644
--- a/rts/win32/veh_excn.c
+++ b/rts/win32/veh_excn.c
@@ -37,7 +37,6 @@ long WINAPI __hs_exception_handler(struct _EXCEPTION_POINTERS *exception_data)
     // 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);
         }
     }
 



More information about the ghc-commits mailing list