aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorjneira <atreyu.bbb@gmail.com>2020-05-08 22:23:05 +0200
committerDaniel Gröber (dxld) <dxld@darkboxed.org>2020-05-20 09:53:08 +0200
commitc4bfdcedc4620d2dfceb57925d9ced35544cf682 (patch)
treec51700ded14f6ab347663cf68afd267fb138bfea /tests
parent8b51b51e90458b226e68fd8a1785f28252d58325 (diff)
Fix programs-test in windows
Diffstat (limited to 'tests')
-rw-r--r--tests/ProgramsTest.hs24
1 files changed, 17 insertions, 7 deletions
diff --git a/tests/ProgramsTest.hs b/tests/ProgramsTest.hs
index 467c1cc..4e7c557 100644
--- a/tests/ProgramsTest.hs
+++ b/tests/ProgramsTest.hs
@@ -10,6 +10,7 @@ import System.Environment
import System.Exit
import System.FilePath
import System.IO.Temp
+import System.Info
import Text.Show.Pretty
import CabalHelper.Compiletime.Types
@@ -18,7 +19,8 @@ import Symlink (createSymbolicLink)
main :: IO ()
main = do
- prog_name <- getProgName
+ -- In windows, program name ends with .exe
+ prog_name <- dropExtension <$> getProgName
args <- getArgs
case prog_name of
"programs-test"
@@ -50,16 +52,24 @@ do_test = do
withSystemTempDirectory "c-h-programs-test" $ \tmpdir -> do
+ let ext = case System.Info.os of
+ "mingw32" -> "exe"
+ _ -> ""
+
forM_ ["8.6.5", "8.4.4"] $ \ver -> do
- let ghc = tmpdir </> "ghc-" ++ ver
- let ghc_pkg = tmpdir </> "ghc-pkg-" ++ ver
- let haddock = tmpdir </> "haddock-" ++ ver
+ let ghc = tmpdir </> "ghc-" ++ ver <.> ext
+ let ghc_pkg = tmpdir </> "ghc-pkg-" ++ ver <.> ext
+ let haddock = tmpdir </> "haddock-" ++ ver <.> ext
let progs = defaultPrograms { ghcProgram = ghc }
- createSymbolicLink prog ghc
- createSymbolicLink prog ghc_pkg
- createSymbolicLink prog haddock
+ let link = case System.Info.os of
+ "mingw32" -> copyFile
+ _ -> createSymbolicLink
+
+ link prog ghc
+ link prog ghc_pkg
+ link prog haddock
let ?verbose = (==4)