aboutsummaryrefslogtreecommitdiff
path: root/tests/GhcSession.hs
diff options
context:
space:
mode:
Diffstat (limited to 'tests/GhcSession.hs')
-rw-r--r--tests/GhcSession.hs28
1 files changed, 2 insertions, 26 deletions
diff --git a/tests/GhcSession.hs b/tests/GhcSession.hs
index e4ae431..6662b41 100644
--- a/tests/GhcSession.hs
+++ b/tests/GhcSession.hs
@@ -22,7 +22,6 @@ import Data.Maybe
import Data.Version
import Data.Bifunctor
import qualified Data.Map as Map
-import System.Console.GetOpt as GetOpt
import System.Environment (getArgs)
import System.Exit
import System.FilePath ((</>), (<.>), makeRelative, takeDirectory)
@@ -43,6 +42,8 @@ import CabalHelper.Compiletime.Program.GHC
import CabalHelper.Compiletime.Program.CabalInstall
(CabalInstallVersion(..), cabalInstallVersion)
+import TestOptions
+
data TestConfig = TC
{ location :: TestLocation
, cabalLowerBound :: Version
@@ -60,31 +61,6 @@ testConfigToTestSpec (TC loc _ _ _) pt =
let (topdir, projdir, cabal_file) = testLocPath loc in
"- " ++ intercalate ":" [topdir, projdir, cabal_file, show pt]
-type ModProgs = (Programs -> Programs)
-
-options :: [OptDescr ModProgs]
-options =
- [ GetOpt.Option [] ["with-cabal"]
- (ReqArg (\arg -> \p -> p { cabalProgram = arg }) "PROG")
- "name or path of 'cabal' executable"
- , GetOpt.Option [] ["with-stack"]
- (ReqArg (\arg -> \p -> p { stackProgram = arg }) "PROG")
- "name or path of 'stack' executable"
- , GetOpt.Option [] ["with-ghc"]
- (ReqArg (\arg -> \cp -> cp { ghcProgram = arg }) "PROG")
- "name or path of 'ghc' executable"
- , GetOpt.Option [] ["with-ghc-pkg"]
- (ReqArg (\arg -> \cp -> cp { ghcPkgProgram = arg }) "PROG")
- "name or path of 'ghc-pkg' executable"
- ]
-
-testOpts :: [String] -> IO (ModProgs, [String])
-testOpts args =
- case getOpt Permute options args of
- (o,n,[] ) -> return (foldl (flip (.)) id o, n)
- (_,_,errs) -> ioError (userError (concat errs ++ usageInfo header options))
- where header = "Usage: ghc-session [OPTION..] [TEST_SPEC..]"
-
main :: IO ()
main = do
(modProgs, args) <- testOpts =<< getArgs