Commit e91672f0 authored by Ben Gamari's avatar Ben Gamari 🐢 Committed by Marge Bot

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.
parent f153a1d0
......@@ -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, [''])
......@@ -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.]+',
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment