[commit: ghc] master: Testsuite: fix enum01/02/03 on Windows (#9399) (f07bf19)

git at git.haskell.org git at git.haskell.org
Wed May 25 19:27:45 UTC 2016


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

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

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

commit f07bf19ec49d25395dd47923ba5e6b525ce7e68f
Author: Thomas Miedema <thomasmiedema at gmail.com>
Date:   Wed May 25 17:51:26 2016 +0200

    Testsuite: fix enum01/02/03 on Windows (#9399)


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

f07bf19ec49d25395dd47923ba5e6b525ce7e68f
 libraries/base/tests/all.T              |  2 +-
 libraries/base/tests/enum01.hs          |  2 +-
 libraries/base/tests/enum02.hs          |  2 +-
 libraries/base/tests/enum03.hs          |  2 +-
 libraries/base/tests/enum_processor.bat | 11 +++++++++++
 libraries/base/tests/enum_processor.py  |  2 --
 testsuite/driver/extra_files.py         |  6 +++---
 testsuite/mk/test.mk                    |  2 +-
 8 files changed, 19 insertions(+), 10 deletions(-)

diff --git a/libraries/base/tests/all.T b/libraries/base/tests/all.T
index fc97666..ac22336 100644
--- a/libraries/base/tests/all.T
+++ b/libraries/base/tests/all.T
@@ -78,7 +78,7 @@ test('dynamic003',      extra_run_opts('+RTS -K32m -RTS'), compile_and_run, ['']
 test('dynamic004',      omit_ways(['normal', 'threaded1', 'ghci']), compile_and_run, [''])
 test('dynamic005',      normal, compile_and_run, [''])
 
-enum_setups = [when(fast(), skip), when(opsys('mingw32'), expect_broken(9399))]
+enum_setups = [when(fast(), skip)]
 test('enum01',          enum_setups, compile_and_run, [''])
 test('enum02',          enum_setups, compile_and_run, [''])
 test('enum03',          enum_setups, compile_and_run, [''])
diff --git a/libraries/base/tests/enum01.hs b/libraries/base/tests/enum01.hs
index 0ae39b1..245f6f7 100644
--- a/libraries/base/tests/enum01.hs
+++ b/libraries/base/tests/enum01.hs
@@ -1,5 +1,5 @@
 -- !!! Testing the Prelude's Enum instances.
-{-# OPTIONS_GHC -F -pgmF ./enum_processor.py #-}
+{-# OPTIONS_GHC -F -pgmF ./enum_processor.bat #-}
 -- The processor is a non-CPP-based equivalent of
 -- #define printTest(x) (do{ putStr ( "    " ++ "x" ++ " = " ) ; print (x) })
 -- which is not portable to clang
diff --git a/libraries/base/tests/enum02.hs b/libraries/base/tests/enum02.hs
index f7e843c..2d06f95 100644
--- a/libraries/base/tests/enum02.hs
+++ b/libraries/base/tests/enum02.hs
@@ -1,5 +1,5 @@
 -- !!! Testing the Int Enum instances.
-{-# OPTIONS_GHC -F -pgmF ./enum_processor.py #-}
+{-# OPTIONS_GHC -F -pgmF ./enum_processor.bat #-}
 -- The processor is a non-CPP-based equivalent of
 -- #define printTest(x) (do{ putStr ( "    " ++ "x" ++ " = " ) ; print (x) })
 -- which is not portable to clang
diff --git a/libraries/base/tests/enum03.hs b/libraries/base/tests/enum03.hs
index 181354a..28d02d1 100644
--- a/libraries/base/tests/enum03.hs
+++ b/libraries/base/tests/enum03.hs
@@ -1,5 +1,5 @@
 -- !!! Testing the Word Enum instances.
-{-# OPTIONS_GHC -F -pgmF ./enum_processor.py #-}
+{-# OPTIONS_GHC -F -pgmF ./enum_processor.bat #-}
 -- The processor is a non-CPP-based equivalent of
 -- #define printTest(x) (do{ putStr ( "    " ++ "x" ++ " = " ) ; print (x) })
 -- which is not portable to clang
diff --git a/libraries/base/tests/enum_processor.bat b/libraries/base/tests/enum_processor.bat
new file mode 100755
index 0000000..2b13a7d
--- /dev/null
+++ b/libraries/base/tests/enum_processor.bat
@@ -0,0 +1,11 @@
+:;# Problem: GHC on Windows doesn't like '-pgmF ./enum_processor.py'.
+:;#          See ticket:365#comment:7 for details.
+:;#
+:;# Workaround: this file, which functions both as a Windows .bat script and a
+:;# Unix shell script. Hacky, but it seems to work.
+
+:;# Starts with a ':', to skip on Windows.
+:; "${PYTHON}" enum_processor.py $@; exit $?
+
+:;# Windows only:
+%PYTHON% enum_processor.py %*
diff --git a/libraries/base/tests/enum_processor.py b/libraries/base/tests/enum_processor.py
old mode 100755
new mode 100644
index 53bea4c..15243f1
--- a/libraries/base/tests/enum_processor.py
+++ b/libraries/base/tests/enum_processor.py
@@ -1,5 +1,3 @@
-#!/usr/bin/env python
-
 # The rough equivalent of the traditional CPP:
 #   #define printTest(x) (do{ putStr ( "    " ++ "x" ++ " = " ) ; print (x) })
 # which is not portable to clang.
diff --git a/testsuite/driver/extra_files.py b/testsuite/driver/extra_files.py
index 0a2bfe6..650ba45 100644
--- a/testsuite/driver/extra_files.py
+++ b/testsuite/driver/extra_files.py
@@ -251,9 +251,9 @@ extra_src_files = {
   'dynbrk004': ['../mdo.hs'],
   'dynbrk005': ['TupleN.hs'],
   'encoding004': ['encoded-data/'],
-  'enum01': ['enum_processor.py'],
-  'enum02': ['enum_processor.py'],
-  'enum03': ['enum_processor.py'],
+  'enum01': ['enum_processor.bat', 'enum_processor.py'],
+  'enum02': ['enum_processor.bat', 'enum_processor.py'],
+  'enum03': ['enum_processor.bat', 'enum_processor.py'],
   'exampleTest': ['AnnotationTuple.hs'],
   'fast2haskell': ['Fast2haskell.hs', 'Main.hs'],
   'ffi018_ghci': ['ffi018.h'],
diff --git a/testsuite/mk/test.mk b/testsuite/mk/test.mk
index 4091b98..d7e65bb 100644
--- a/testsuite/mk/test.mk
+++ b/testsuite/mk/test.mk
@@ -281,7 +281,7 @@ $(TIMEOUT_PROGRAM) :
 # communicate with the topmake.
 # See Note [Communicating options and variables to a submake]
 test: $(TIMEOUT_PROGRAM)
-	+$(PYTHON) $(RUNTESTS) $(RUNTEST_OPTS) \
+	+PYTHON="$(PYTHON)" "$(PYTHON)" $(RUNTESTS) $(RUNTEST_OPTS) \
 		$(patsubst %, --only=%, $(TEST)) \
 		$(patsubst %, --only=%, $(TESTS)) \
 		$(patsubst %, --way=%, $(WAY)) \



More information about the ghc-commits mailing list