aboutsummaryrefslogtreecommitdiff
path: root/haddock-test/src/Test
diff options
context:
space:
mode:
authoralexbiehl <alex.biehl@gmail.com>2018-03-02 14:21:23 +0100
committeralexbiehl <alex.biehl@gmail.com>2018-03-02 14:21:23 +0100
commit4abf7d4979b5364da59f7412a3d7143aea26cf7e (patch)
tree9b269762b9a46f85d8e9ba0ddc54619855e3594d /haddock-test/src/Test
parent7a36a41e154f9ff380b10584ec1a9f8bc4003be1 (diff)
Enable running test suite with stock haddock and ghc using
``` $ cabal new-run -- html-test --haddock-path=$(which haddock) --ghc-path=$(which ghc) ```
Diffstat (limited to 'haddock-test/src/Test')
-rw-r--r--haddock-test/src/Test/Haddock/Config.hs12
1 files changed, 10 insertions, 2 deletions
diff --git a/haddock-test/src/Test/Haddock/Config.hs b/haddock-test/src/Test/Haddock/Config.hs
index 988636e4..2d16fa63 100644
--- a/haddock-test/src/Test/Haddock/Config.hs
+++ b/haddock-test/src/Test/Haddock/Config.hs
@@ -98,6 +98,7 @@ data Flag
= FlagHaddockPath FilePath
| FlagHaddockOptions String
| FlagHaddockStdOut FilePath
+ | FlagGhcPath FilePath
| FlagDiffTool FilePath
| FlagNoDiff
| FlagAccept
@@ -108,6 +109,8 @@ data Flag
flagsHaddockPath :: [Flag] -> Maybe FilePath
flagsHaddockPath flags = mlast [ path | FlagHaddockPath path <- flags ]
+flagsGhcPath :: [Flag] -> Maybe FilePath
+flagsGhcPath flags = mlast [ path | FlagGhcPath path <- flags ]
flagsHaddockOptions :: [Flag] -> [String]
flagsHaddockOptions flags = concat
@@ -130,6 +133,8 @@ options =
"additional options to run Haddock with"
, Option [] ["haddock-stdout"] (ReqArg FlagHaddockStdOut "FILE")
"where to redirect Haddock output"
+ , Option [] ["ghc-path"] (ReqArg FlagGhcPath "FILE")
+ "path ghc executable"
, Option [] ["diff-tool"] (ReqArg FlagDiffTool "PATH")
"diff tool to use when printing failed cases"
, Option ['a'] ["accept"] (NoArg FlagAccept)
@@ -178,8 +183,11 @@ loadConfig ccfg dcfg flags files = do
hPutStrLn stderr "Haddock executable not found"
exitFailure
- ghcPath <- init <$> rawSystemStdout normal cfgHaddockPath
- ["--print-ghc-path"]
+ ghcPath <- case flagsGhcPath flags of
+ Just fp -> return fp
+ Nothing -> init <$> rawSystemStdout normal
+ cfgHaddockPath
+ ["--print-ghc-path"]
printVersions cfgEnv cfgHaddockPath