Commit bb996712 authored by thomie's avatar thomie
Browse files

Revert "The test runner now also works under the msys-native Python."

To make the test runner work under msys-native Python...

Commit 5258566e broke the msys testsuite
driver (#10441). It changed the quoting of `config.compiler` from single
quotes to double quote, which turns out to not be compatible with what
the function `passThroughCmd` expected.

We could fix `passThroughCmd` to handle the case where `config.compiler`
is double quoted, and scatter some notes around to make sure the quoting
done in various places of the testsuite driver stay compatible.

Instead, this commit reverts 101c62e2,
which introdced the function `passThroughCmd` in the first place
(#9626). ezyang reports that doing this revert fixes the testsuite
driver for him using the the following version of msys2:

  msys2-keyring r8.3864337-1
  msys2-runtime 2.1.0.16351.cd3184b-1
  msys2-runtime-devel 2.1.0.16351.cd3184b-1
  msys2-w32api-headers 5.0.0.4456.c8b6742-1
  msys2-w32api-runtime 5.0.0.4455.32db221-1

Ideally we'd know what minimum version of msys2 we require, but for now
this fix is better than nothing.

Only gintas ever reported the original problem, and he actually
mentioned shortly afterwards: "This may have been fixed by a recent
release of msys2, but I am not sure."

Differential Revision: https://phabricator.haskell.org/D952
parent 3b55659d
......@@ -1806,25 +1806,9 @@ def rawSystem(cmd_and_args):
cmd = cmd_and_args[0]
return subprocess.call([strip_quotes(cmd)] + cmd_and_args[1:])
# When running under native msys Python, any invocations of non-msys binaries,
# including timeout.exe, will have their arguments munged according to some
# heuristics, which leads to malformed command lines (#9626). The easiest way
# to avoid problems is to invoke through /usr/bin/cmd which sidesteps argument
# munging because it is a native msys application.
def passThroughCmd(cmd_and_args):
args = []
# cmd needs a Windows-style path for its first argument.
args.append(cmd_and_args[0].replace('/', '\\'))
# Other arguments need to be quoted to deal with spaces.
args.extend(['"%s"' % arg for arg in cmd_and_args[1:]])
return ["cmd", "/c", " ".join(args)]
# Note that this doesn't handle the timeout itself; it is just used for
# commands that have timeout handling built-in.
def rawSystemWithTimeout(cmd_and_args):
if config.os == 'mingw32' and sys.executable.startswith('/usr'):
# This is only needed when running under msys python.
cmd_and_args = passThroughCmd(cmd_and_args)
r = rawSystem(cmd_and_args)
if r == 98:
# The python timeout program uses 98 to signal that ^C was pressed
......
......@@ -213,6 +213,8 @@ RUNTEST_OPTS += \
# function) would require another pair of (escaped) quotes, which interfers
# with MinGW's magic path handling (see #10449, and
# http://www.mingw.org/wiki/Posix_path_conversion).
# We use double instead of single quotes, which may or may not be important
# when using msys2 (#9626, #10441).
quote_path = $(if $1,"$1")
RUNTEST_OPTS += \
--config 'compiler=$(call quote_path,$(TEST_HC))' \
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment