[Git][ghc/ghc][master] 4 commits: rts/win32: Exit with EXIT_HEAPOVERFLOW if memory commit fails

Marge Bot gitlab at gitlab.haskell.org
Sun Jul 26 17:24:05 UTC 2020



 Marge Bot pushed to branch master at Glasgow Haskell Compiler / GHC


Commits:
da7269a4 by Ben Gamari at 2020-07-26T13:23:59-04:00
rts/win32: Exit with EXIT_HEAPOVERFLOW if memory commit fails

Since switching to the two-step allocator, the `outofmem` test fails via
`osCommitMemory` failing to commit. However, this was previously exiting
with `EXIT_FAILURE`, rather than `EXIT_HEAPOVERFLOW`. I think the latter
is a more reasonable exit code for this case and matches the behavior on
POSIX platforms.

- - - - -
f153a1d0 by Ben Gamari at 2020-07-26T13:23:59-04:00
testsuite: Update win32 output for parseTree

- - - - -
e91672f0 by Ben Gamari at 2020-07-26T13:23:59-04:00
testsuite: Normalise WinIO error message differences

Previously the old Windows IO manager threw different errors than WinIO.
We now canonicalise these to the WinIO errors.

- - - - -
9cbfe086 by Ben Gamari at 2020-07-26T13:23:59-04:00
gitlab-ci: Kill ssh-agent after pushing test metrics

Otherwise the Windows builds hang forever waiting for the process to
terminate.

- - - - -


5 changed files:

- .gitlab/test-metrics.sh
- libraries/base/tests/IO/all.T
- rts/win32/OSMem.c
- testsuite/driver/testlib.py
- testsuite/tests/ghc-api/annotations/parseTree.stdout-mingw32


Changes:

=====================================
.gitlab/test-metrics.sh
=====================================
@@ -81,6 +81,10 @@ function push() {
     echo ""
     echo "Failed to push git notes. Fetching, appending, and retrying... $MAX_RETRY retries left."
   done
+
+  # Be sure to kill agent before we terminate since otherwise the Windows CI
+  # job won't finish.
+  ssh-agent -k
 }
 
 case $1 in
@@ -88,3 +92,4 @@ case $1 in
   pull) pull ;;
   *) fail "Invalid mode $1" ;;
 esac
+


=====================================
libraries/base/tests/IO/all.T
=====================================
@@ -10,7 +10,7 @@ test('IOError001', [omit_ways(['ghci']), set_stdin('IOError001.hs')],
 test('IOError002',      normal, compile_and_run, [''])
 test('finalization001', normal, compile_and_run, [''])
 test('hClose001', [], compile_and_run, [''])
-test('hClose002', [], compile_and_run, [''])
+test('hClose002', [normalise_win32_io_errors], compile_and_run, [''])
 test('hClose003',       reqlib('unix'), compile_and_run, ['-package unix'])
 test('hFileSize001',    normal, compile_and_run, [''])
 test('hFileSize002', [omit_ways(['ghci'])], compile_and_run, [''])
@@ -61,8 +61,8 @@ test('misc001', [extra_run_opts('misc001.hs misc001.out')], compile_and_run,
      [''])
 
 test('openFile001',  normal, compile_and_run, [''])
-test('openFile002',  exit_code(1), compile_and_run, [''])
-test('openFile003', [], compile_and_run, [''])
+test('openFile002',  [exit_code(1), normalise_win32_io_errors], compile_and_run, [''])
+test('openFile003', [normalise_win32_io_errors], compile_and_run, [''])
 test('openFile004', [], compile_and_run, [''])
 test('openFile005', [], compile_and_run, [''])
 test('openFile006', [], compile_and_run, [''])


=====================================
rts/win32/OSMem.c
=====================================
@@ -472,7 +472,7 @@ void osCommitMemory (void *at, W_ size)
     temp = VirtualAlloc(at, size, MEM_COMMIT, PAGE_READWRITE);
     if (temp == NULL) {
         sysErrorBelch("osCommitMemory: VirtualAlloc MEM_COMMIT failed");
-        stg_exit(EXIT_FAILURE);
+        stg_exit(EXIT_HEAPOVERFLOW);
     }
 }
 


=====================================
testsuite/driver/testlib.py
=====================================
@@ -743,6 +743,30 @@ def normalise_whitespace_fun(f):
 def _normalise_whitespace_fun(name, opts, f):
     opts.whitespace_normaliser = f
 
+def normalise_win32_io_errors(name, opts):
+    """
+    On Windows we currently have two IO manager implementations: both WinIO IO
+    manager and the old POSIX-emulated implementation. These currently differ
+    slightly in the error messages that they provide. Normalise these
+    differences away, preferring the new WinIO errors.
+
+    This can be dropped when the old IO manager is removed.
+    """
+
+    SUBS = [
+        ('Bad file descriptor', 'The handle is invalid'),
+        ('Permission denied', 'Access is denied.'),
+        ('No such file or directory', 'The system cannot find the file specified.'),
+    ]
+
+    def f(s: str):
+        for old,new in SUBS:
+            s = s.replace(old, new)
+
+        return s
+
+    return when(opsys('mingw32'), normalise_fun(f))
+
 def normalise_version_( *pkgs ):
     def normalise_version__( str ):
         return re.sub('(' + '|'.join(map(re.escape,pkgs)) + ')-[0-9.]+',


=====================================
testsuite/tests/ghc-api/annotations/parseTree.stdout-mingw32
=====================================
@@ -1,11 +1,11 @@
-[(AnnotationTuple.hs:14:20, [p], Unit 1),
- (AnnotationTuple.hs:14:23-29, [p], Unit "hello"),
- (AnnotationTuple.hs:14:35-37, [p], Unit 6.5),
+[(AnnotationTuple.hs:14:20, [p], Solo 1),
+ (AnnotationTuple.hs:14:23-29, [p], Solo "hello"),
+ (AnnotationTuple.hs:14:35-37, [p], Solo 6.5),
  (AnnotationTuple.hs:14:39, [m], ()),
- (AnnotationTuple.hs:14:41-52, [p], Unit [5, 5, 6, 7]),
- (AnnotationTuple.hs:16:8, [p], Unit 1),
- (AnnotationTuple.hs:16:11-17, [p], Unit "hello"),
- (AnnotationTuple.hs:16:20-22, [p], Unit 6.5),
+ (AnnotationTuple.hs:14:41-52, [p], Solo [5, 5, 6, 7]),
+ (AnnotationTuple.hs:16:8, [p], Solo 1),
+ (AnnotationTuple.hs:16:11-17, [p], Solo "hello"),
+ (AnnotationTuple.hs:16:20-22, [p], Solo 6.5),
  (AnnotationTuple.hs:16:24, [m], ()),
  (AnnotationTuple.hs:16:25, [m], ()),
  (AnnotationTuple.hs:16:26, [m], ()), (<no location info>, [m], ())]



View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/a7c4439a407ad85b76aab9301fda61e7c10183ff...9cbfe0868418a531da0872b0c477a15aa67f8861

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/a7c4439a407ad85b76aab9301fda61e7c10183ff...9cbfe0868418a531da0872b0c477a15aa67f8861
You're receiving this email because of your account on gitlab.haskell.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/ghc-commits/attachments/20200726/9a305596/attachment-0001.html>


More information about the ghc-commits mailing list