Out-of-tree tests broken on MinGW + native Python due to quoting of config.compiler
Ever since commit 5258566e it seems that out-of-tree tests will not run on MinGW anymore. Note that I am using MinGW tools with a native Windows build of Python, which is the main cause of the problem.
The apparent error is something along the lines of "cannot eval an empty string":
Traceback (most recent call last):
File "testsuite/driver/runtests.py", line 196, in <module>
get_compiler_info()
File "<string>", line 166, in get_compiler_info
File "<string>", line 0
^
SyntaxError: unexpected EOF while parsing
But this error is quite misleading. What really happened was that it tried to run GHC with the --info
argument but failed silently and returned an empty string. If you apply D908, it becomes a lot more obvious: Python is failing to run /c/programs/ghc/bin/ghc --info
because /c/programs/ghc/bin/ghc
"does not exist" as Python does not understand MinGW-style paths.
The funny thing is that it worked just fine before 525856, so you have to wonder why quoting the paths caused this. It turns out that MinGW does some magic behind the scenes, automagically converting MinGW-style paths into ordinary Python paths when a native Windows program is invoked. In particular, it means running this in MinGW shell
python run-tests.py -e 'config.compiler=/c/programs/ghc/ghc'
will actually invoke Python with config.compiler=C:/programs/ghc/ghc
. However, if it's explicitly quoted (edit: and also escaped with backslashes) like this
python run-tests.py -e 'config.compiler="\"/c/programs/ghc/ghc\""'
the magic doesn't work anymore.