summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Gamari <ben@smart-cactus.org>2022-10-18 12:37:12 -0400
committerCheng Shao <terrorjack@type.dance>2023-03-30 18:43:53 +0000
commite7392b4ecb39166328e60358e302108b6a9339b9 (patch)
tree754c7d5d500932a15c2020103a2b9941158c1412
parent79d0cb3210e71bc5eca97af7e12a654134336d1f (diff)
downloadhaskell-e7392b4ecb39166328e60358e302108b6a9339b9.tar.gz
testsuite/driver: Normalize away differences in ghc executable name
-rw-r--r--testsuite/driver/testlib.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/testsuite/driver/testlib.py b/testsuite/driver/testlib.py
index 173f96c908..237f881044 100644
--- a/testsuite/driver/testlib.py
+++ b/testsuite/driver/testlib.py
@@ -2347,6 +2347,18 @@ def normalise_errmsg(s: str) -> str:
s = normalise_callstacks(s)
s = normalise_type_reps(s)
+ # normalise slashes, minimise Windows/Unix filename differences
+ s = re.sub('\\\\', '/', s)
+
+ # Normalize the name of the GHC executable. Specifically,
+ # this catches the cases that:
+ #
+ # * In cross-compilers ghc's executable name may include
+ # a target prefix (e.g. `aarch64-linux-gnu-ghc`)
+ # * On Windows the executable name may mention the
+ # versioned name (e.g. `ghc-9.2.1`)
+ s = re.sub(Path(config.compiler).name + ':', 'ghc:', s)
+
# If somefile ends in ".exe" or ".exe:", zap ".exe" (for Windows)
# the colon is there because it appears in error messages; this
# hacky solution is used in place of more sophisticated filename