[commit: ghc] master: Testdriver: do not interfer with MinGW path magic (#10449) (ce166a3)

git at git.haskell.org git at git.haskell.org
Thu May 28 13:20:18 UTC 2015


Repository : ssh://git@git.haskell.org/ghc

On branch  : master
Link       : http://ghc.haskell.org/trac/ghc/changeset/ce166a3aaab28a9b08c60da6d0cfdab998b6e8ca/ghc

>---------------------------------------------------------------

commit ce166a3aaab28a9b08c60da6d0cfdab998b6e8ca
Author: Thomas Miedema <thomasmiedema at gmail.com>
Date:   Wed May 27 15:02:35 2015 +0200

    Testdriver: do not interfer with MinGW path magic (#10449)
    
    This should fix the testsuite driver on Windows using the MinGW tools
    with a native build of Python.
    
    MinGW automagically converts MinGW-style paths (e.g.
    '/c/programs/ghc/bin/ghc') into ordinary Windows paths (e.g.
    'C:/programs/ghc/bin/ghc') when a native Windows program is invoked. But
    it doesn't do so when those paths are wrapped with a pair of escaped
    double quotes.
    
    The fix is to not call `eval` on the paths in Python, which let's us use
    one less pair of quotes, and makes MinGW happy.
    
    Reviewers: Rufflewind, austin
    
    Differential Revision: https://phabricator.haskell.org/D911


>---------------------------------------------------------------

ce166a3aaab28a9b08c60da6d0cfdab998b6e8ca
 testsuite/driver/runtests.py |  9 +++++++--
 testsuite/mk/test.mk         | 28 +++++++++++++++++-----------
 2 files changed, 24 insertions(+), 13 deletions(-)

diff --git a/testsuite/driver/runtests.py b/testsuite/driver/runtests.py
index fcfad77..72e1419 100644
--- a/testsuite/driver/runtests.py
+++ b/testsuite/driver/runtests.py
@@ -40,7 +40,8 @@ config = getConfig() # get it from testglobals
 # cmd-line options
 
 long_options = [
-  "config=",  		# config file
+  "configfile=",	# config file
+  "config=",  		# config field
   "rootdir=", 		# root of tree containing tests (default: .)
   "output-summary=", 	# file in which to save the (human-readable) summary
   "only=",		# just this test (can be give multiple --only= flags)
@@ -55,7 +56,7 @@ long_options = [
 opts, args = getopt.getopt(sys.argv[1:], "e:", long_options)
        
 for opt,arg in opts:
-    if opt == '--config':
+    if opt == '--configfile':
         exec(open(arg).read())
 
     # -e is a string to execute from the command line.  For example:
@@ -63,6 +64,10 @@ for opt,arg in opts:
     if opt == '-e':
         exec(arg)
 
+    if opt == '--config':
+        field, value = arg.split('=', 1)
+        setattr(config, field, value)
+
     if opt == '--rootdir':
         config.rootdirs.append(arg)
 
diff --git a/testsuite/mk/test.mk b/testsuite/mk/test.mk
index 9927b6d..7e5b038 100644
--- a/testsuite/mk/test.mk
+++ b/testsuite/mk/test.mk
@@ -194,7 +194,7 @@ endif
 
 RUNTEST_OPTS +=  \
 	--rootdir=. \
-	--config=$(CONFIG) \
+	--configfile=$(CONFIG) \
 	-e 'config.confdir="$(CONFIGDIR)"' \
 	-e 'config.platform="$(TARGETPLATFORM)"' \
 	-e 'config.os="$(TargetOS_CPP)"' \
@@ -205,17 +205,23 @@ RUNTEST_OPTS +=  \
 	-e 'config.exeext="$(exeext)"' \
 	-e 'config.top="$(TOP_ABS)"'
 
-# Put an extra pair of quotes around non-empty program paths,
-# so we don't have to in .T scripts or driver/testlib.py.
-quote_path = $(if $1,"\"$1\"","")
+# Wrap non-empty program paths in quotes, because they may contain spaces. Do
+# it here, so we don't have to (and don't forget to do it) in the .T test
+# scripts (search for '{compiler}' or '{hpc}'). This may or may not be a good
+# idea.
+# Use `--config` instead of `-e`, because `-e` (which calls Python's `eval`
+# 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).
+quote_path = $(if $1,"$1")
 RUNTEST_OPTS +=  \
-	-e 'config.compiler=$(call quote_path,$(TEST_HC))' \
-	-e 'config.ghc_pkg=$(call quote_path,$(GHC_PKG))' \
-	-e 'config.haddock=$(call quote_path,$(HADDOCK))' \
-	-e 'config.hp2ps=$(call quote_path,$(HP2PS_ABS))' \
-	-e 'config.hpc=$(call quote_path,$(HPC))' \
-	-e 'config.gs=$(call quote_path,$(GS))' \
-	-e 'config.timeout_prog=$(call quote_path,$(TIMEOUT_PROGRAM))'
+	--config 'compiler=$(call quote_path,$(TEST_HC))' \
+	--config 'ghc_pkg=$(call quote_path,$(GHC_PKG))' \
+	--config 'haddock=$(call quote_path,$(HADDOCK))' \
+	--config 'hp2ps=$(call quote_path,$(HP2PS_ABS))' \
+	--config 'hpc=$(call quote_path,$(HPC))' \
+	--config 'gs=$(call quote_path,$(GS))' \
+	--config 'timeout_prog=$(call quote_path,$(TIMEOUT_PROGRAM))'
 
 ifneq "$(OUTPUT_SUMMARY)" ""
 RUNTEST_OPTS +=  \



More information about the ghc-commits mailing list