diff options
author | Ben Gamari <ben@smart-cactus.org> | 2019-06-11 09:54:55 -0400 |
---|---|---|
committer | Marge Bot <ben+marge-bot@smart-cactus.org> | 2019-06-13 11:52:47 -0400 |
commit | c53dfb3b2cddfe2d00d9017c9240042cc6bc7fcf (patch) | |
tree | 130d5668b264d7ae5217976b9156373ee7651bc6 | |
parent | d550b771f6ebb91bfe860fc08811a7d74b39eb38 (diff) | |
download | haskell-c53dfb3b2cddfe2d00d9017c9240042cc6bc7fcf.tar.gz |
testsuite: A more portable solution to #9399
Previously we used an awful hybrid batch script/Bourne shell script to
allow this test to run both on Windows and Linux (fixing #9399).
However, this breaks on some libc implementations (e.g. musl). Fix this.
Fixes #16798.
-rw-r--r-- | libraries/base/tests/all.T | 28 | ||||
-rw-r--r-- | libraries/base/tests/enum01.hs | 4 | ||||
-rw-r--r-- | libraries/base/tests/enum02.hs | 4 | ||||
-rw-r--r-- | libraries/base/tests/enum03.hs | 4 | ||||
-rwxr-xr-x | libraries/base/tests/enum_processor.bat | 6 | ||||
-rwxr-xr-x[-rw-r--r--] | libraries/base/tests/enum_processor.py | 2 |
6 files changed, 23 insertions, 25 deletions
diff --git a/libraries/base/tests/all.T b/libraries/base/tests/all.T index 62184567ad..0fd97610d0 100644 --- a/libraries/base/tests/all.T +++ b/libraries/base/tests/all.T @@ -94,13 +94,27 @@ test('dynamic004', omit_ways(['normal', 'threaded1', 'ghci']), compile_and_ test('dynamic005', normal, compile_and_run, ['']) enum_setups = [when(fast(), skip)] -test('enum01', [extra_files(['enum_processor.bat', 'enum_processor.py']), - enum_setups], compile_and_run, ['']) -test('enum02', [extra_files(['enum_processor.bat', 'enum_processor.py']), - enum_setups], compile_and_run, ['']) -test('enum03', [extra_files(['enum_processor.bat', 'enum_processor.py']), - enum_setups], compile_and_run, ['']) -test('enum04', normal, compile_and_run, ['']) +def enum_test(name): + """ + These tests have a funky Python preprocessor which require some headstands + to run on Windows. + """ + if opsys('mingw32'): + test(name, + [when(opsys('mingw32'), extra_files(['enum_processor.bat'])), + extra_files(['enum_processor.py'])], + compile_and_run, + ['-F -pgmF ./enum_processor.bat']) + else: + test(name, + [extra_files(['enum_processor.py'])], + compile_and_run, + ['-F -pgmF ./enum_processor.py']) + +enum_test('enum01') +enum_test('enum02') +enum_test('enum03') +test('enum04', normal, compile_and_run, ['']) test('exceptionsrun001', normal, compile_and_run, ['']) test('exceptionsrun002', normal, compile_and_run, ['']) diff --git a/libraries/base/tests/enum01.hs b/libraries/base/tests/enum01.hs index 5aea7dea4d..4dfc29978c 100644 --- a/libraries/base/tests/enum01.hs +++ b/libraries/base/tests/enum01.hs @@ -1,8 +1,4 @@ -- !!! Testing the Prelude's Enum instances. -{-# 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 module Main(main) where diff --git a/libraries/base/tests/enum02.hs b/libraries/base/tests/enum02.hs index 2d06f95f90..3741880f57 100644 --- a/libraries/base/tests/enum02.hs +++ b/libraries/base/tests/enum02.hs @@ -1,8 +1,4 @@ -- !!! Testing the Int Enum instances. -{-# 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 module Main(main) where diff --git a/libraries/base/tests/enum03.hs b/libraries/base/tests/enum03.hs index 28d02d1c13..a701df4501 100644 --- a/libraries/base/tests/enum03.hs +++ b/libraries/base/tests/enum03.hs @@ -1,8 +1,4 @@ -- !!! Testing the Word Enum instances. -{-# 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 module Main(main) where diff --git a/libraries/base/tests/enum_processor.bat b/libraries/base/tests/enum_processor.bat index 2b13a7db07..6f9eb0fd29 100755 --- a/libraries/base/tests/enum_processor.bat +++ b/libraries/base/tests/enum_processor.bat @@ -1,11 +1,5 @@ :;# 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 index 15243f11ff..b4ca3e9797 100644..100755 --- a/libraries/base/tests/enum_processor.py +++ b/libraries/base/tests/enum_processor.py @@ -1,3 +1,5 @@ +#!/usr/bin/env python3 + # The rough equivalent of the traditional CPP: # #define printTest(x) (do{ putStr ( " " ++ "x" ++ " = " ) ; print (x) }) # which is not portable to clang. |