summaryrefslogtreecommitdiff
path: root/testsuite/config/ghc
diff options
context:
space:
mode:
authorThomas Miedema <thomasmiedema@gmail.com>2016-06-20 00:54:38 +0200
committerThomas Miedema <thomasmiedema@gmail.com>2016-06-20 16:22:07 +0200
commit1ddc10bb405e0f88584784bd42f5bdd5ded24dcf (patch)
tree9d6dd8adc8ecd5eeac5c34e7f380003e2b742940 /testsuite/config/ghc
parent6d0a4fc5af4ca2ff9b3db7168273a7ceb01c6c38 (diff)
downloadhaskell-1ddc10bb405e0f88584784bd42f5bdd5ded24dcf.tar.gz
Testsuite: *do* replace backslashes in config.libdir
See `Note [Replacing backward slashes in config.libdir]` There is one caveat: in ae4acbd1ba4168b867a1b5fe8de50c0199dfc1f4 I mentioned: > Changing backwards slashes to forward slashes apparently confuses > msys2/mingw magic path handling. I can not reproduce that problem anymore, however. This patch validates for me, and fixes all tests that use config.libdir for WAY=ghci. We'll see how it goes.
Diffstat (limited to 'testsuite/config/ghc')
-rw-r--r--testsuite/config/ghc35
1 files changed, 34 insertions, 1 deletions
diff --git a/testsuite/config/ghc b/testsuite/config/ghc
index 3be803de56..cf9a7ba50f 100644
--- a/testsuite/config/ghc
+++ b/testsuite/config/ghc
@@ -173,7 +173,8 @@ def get_compiler_info():
s = re.sub('[\r\n]', '', s)
rtsInfoDict = dict(eval(s))
- config.libdir = compilerInfoDict['LibDir']
+ # See Note [Replacing backward slashes in config.libdir].
+ config.libdir = compilerInfoDict['LibDir'].replace('\\', '/')
v = compilerInfoDict["Project version"]
config.compiler_version = v
@@ -224,3 +225,35 @@ def get_compiler_info():
config.plugin_way_flags = "-static"
config.ghc_th_way = "normal"
config.ghc_plugin_way = "normal"
+
+# Note [Replacing backward slashes in config.libdir]
+#
+# We *do* need to replace backslashes in config.libdir, for the following
+# reason:
+#
+# * Tests use config.libdir as follows:
+#
+# extra_run_opts('"' + config.libdir + '"')
+#
+# The double quotes are there because config.libdir might contain
+# spaces.
+#
+# * This string is then written /as is/ to <testname>.genscript in
+# testlib.interpreter_run:
+#
+# script.write(':set args ' + opts.extra_run_opts + '\n')
+#
+# * But GHCi expects the arguments to ':set args' to be proper Haskell
+# strings (when they are quoted), with backslashes escaped. Since
+# config.libdir contains single backslash characters, tests such as T5313
+# will fail for WAY=ghci with "Pattern match failure in do expression".
+#
+# Arguably the above code for writing `:set args` should be smarter. This
+# is tricky to get right though, because in GHCI `:set args foo\bar` (no
+# double quotes) works perfectly fine, and is interpreted as the Haskell
+# string "foo\\bar". Therfore, simply escaping all backward slashes in
+# opts.extra_run_opts before concatenating it with ':set args' is not right
+# either.
+#
+# Replacing backslashes to forward slashes in config.libdir works around the
+# problem.