summaryrefslogtreecommitdiff
path: root/testsuite/driver
diff options
context:
space:
mode:
authorBen Gamari <ben@smart-cactus.org>2020-07-23 11:31:47 -0400
committerMarge Bot <ben+marge-bot@smart-cactus.org>2020-07-26 13:23:59 -0400
commite91672f0b7185bbafbe8ed1f2ae2cb775111f950 (patch)
treee0b7f2265b3e1ffd6bb3fd824eccb69c65b7d276 /testsuite/driver
parentf153a1d0a3351ad4d94cef4cef8e63bab5b47008 (diff)
downloadhaskell-e91672f0b7185bbafbe8ed1f2ae2cb775111f950.tar.gz
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.
Diffstat (limited to 'testsuite/driver')
-rw-r--r--testsuite/driver/testlib.py24
1 files changed, 24 insertions, 0 deletions
diff --git a/testsuite/driver/testlib.py b/testsuite/driver/testlib.py
index a6ff229c06..fc83eb6477 100644
--- a/testsuite/driver/testlib.py
+++ b/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.]+',