diff --git a/ghcup.cabal b/ghcup.cabal index 2565d7a..ff65ac7 100644 --- a/ghcup.cabal +++ b/ghcup.cabal @@ -431,6 +431,9 @@ test-suite ghcup-optparse-test Utils WhereisTest + if os(windows) + cpp-options: -DIS_WINDOWS + default-language: Haskell2010 ghc-options: -Wall build-depends: diff --git a/test/optparse-test/CompileTest.hs b/test/optparse-test/CompileTest.hs index 9979a9e..e246757 100644 --- a/test/optparse-test/CompileTest.hs +++ b/test/optparse-test/CompileTest.hs @@ -1,5 +1,6 @@ {-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE QuasiQuotes #-} +{-# LANGUAGE CPP #-} module CompileTest where @@ -91,8 +92,13 @@ compileGhcCheckList = mapSecond CompileGHC , (baseCmd <> "--flavour make", baseOptions{GHC.buildFlavour = Just "make"}) , (baseCmd <> "--hadrian", baseOptions{GHC.buildSystem = Just Hadrian}) , (baseCmd <> "--make", baseOptions{GHC.buildSystem = Just Make}) +#ifdef IS_WINDOWS + , (baseCmd <> "-i C:\\\\tmp\\out_dir", baseOptions{GHC.isolateDir = Just "C:\\\\tmp\\out_dir"}) + , (baseCmd <> "--isolate C:\\\\tmp\\out_dir", baseOptions{GHC.isolateDir = Just "C:\\\\tmp\\out_dir"}) +#else , (baseCmd <> "-i /tmp/out_dir", baseOptions{GHC.isolateDir = Just "/tmp/out_dir"}) , (baseCmd <> "--isolate /tmp/out_dir", baseOptions{GHC.isolateDir = Just "/tmp/out_dir"}) +#endif ] where baseCmd :: String @@ -150,8 +156,13 @@ compileHlsCheckList = mapSecond CompileHLS , (baseCmd <> "-o 2.0.0.0-p1", baseOptions{HLS.ovewrwiteVer = Right $ mkVersion' "2.0.0.0-p1"}) , (baseCmd <> "--overwrite-version 2.0.0.0-p1", baseOptions{HLS.ovewrwiteVer = Right $ mkVersion' "2.0.0.0-p1"}) , (baseCmd <> "--git-describe-version", baseOptions{HLS.ovewrwiteVer = Left True}) +#ifdef IS_WINDOWS + , (baseCmd <> "-i C:\\\\tmp\\out_dir", baseOptions{HLS.isolateDir = Just "C:\\\\tmp\\out_dir"}) + , (baseCmd <> "--isolate C:\\\\tmp\\out_dir", baseOptions{HLS.isolateDir = Just "C:\\\\tmp\\out_dir"}) +#else , (baseCmd <> "-i /tmp/out_dir", baseOptions{HLS.isolateDir = Just "/tmp/out_dir"}) , (baseCmd <> "--isolate /tmp/out_dir", baseOptions{HLS.isolateDir = Just "/tmp/out_dir"}) +#endif , (baseCmd <> "--cabal-project file:///tmp/cabal.project", baseOptions{HLS.cabalProject = Just $ Right [uri|file:///tmp/cabal.project|]}) , (baseCmd <> "--cabal-project cabal.ghc8107.project", baseOptions{HLS.cabalProject = Just $ Left "cabal.ghc8107.project"}) , (baseCmd <> "--cabal-project-local file:///tmp/cabal.project.local", baseOptions{HLS.cabalProjectLocal = Just [uri|file:///tmp/cabal.project.local|]}) diff --git a/test/optparse-test/InstallTest.hs b/test/optparse-test/InstallTest.hs index 5dcfe35..8f13e42 100644 --- a/test/optparse-test/InstallTest.hs +++ b/test/optparse-test/InstallTest.hs @@ -1,5 +1,6 @@ +{-# LANGUAGE CPP #-} {-# LANGUAGE OverloadedStrings #-} -{-# LANGUAGE QuasiQuotes #-} +{-# LANGUAGE QuasiQuotes #-} module InstallTest where @@ -45,7 +46,11 @@ oldStyleCheckList = ("install", Right defaultOptions) : ("install --set", Right defaultOptions{instSet = True}) : ("install --force", Right defaultOptions{forceInstall = True}) +#ifdef IS_WINDOWS + : ("install -i C:\\\\", Right defaultOptions{Install.isolateDir = Just "C:\\\\"}) +#else : ("install -i /", Right defaultOptions{Install.isolateDir = Just "/"}) +#endif : ("install -u https://gitlab.haskell.org/ghc/ghc/-/jobs/artifacts/master/raw/ghc-x86_64-linux-fedora33-release.tar.xz head" , Right defaultOptions { instBindist = Just [uri|https://gitlab.haskell.org/ghc/ghc/-/jobs/artifacts/master/raw/ghc-x86_64-linux-fedora33-release.tar.xz|] diff --git a/test/optparse-test/RunTest.hs b/test/optparse-test/RunTest.hs index f32f25e..d5c4a94 100644 --- a/test/optparse-test/RunTest.hs +++ b/test/optparse-test/RunTest.hs @@ -1,4 +1,5 @@ {-# LANGUAGE OverloadedStrings #-} +{-# LANGUAGE CPP #-} module RunTest where @@ -39,8 +40,13 @@ runCheckList = , ("run --cabal 3.10", defaultOptions{runCabalVer = Just $ ToolVersion $ mkVersion' "3.10"}) , ("run --hls 2.0", defaultOptions{runHLSVer = Just $ ToolVersion $ mkVersion' "2.0"}) , ("run --stack 2.9", defaultOptions{runStackVer = Just $ ToolVersion $ mkVersion' "2.9"}) +#ifdef IS_WINDOWS + , ("run -b C:\\\\tmp\\dir", defaultOptions{runBinDir = Just "C:\\\\tmp\\dir"}) + , ("run --bindir C:\\\\tmp\\dir", defaultOptions{runBinDir = Just "C:\\\\tmp\\dir"}) +#else , ("run -b /tmp/dir", defaultOptions{runBinDir = Just "/tmp/dir"}) , ("run --bindir /tmp/dir", defaultOptions{runBinDir = Just "/tmp/dir"}) +#endif , ("run -q", defaultOptions{runQuick = True}) , ("run --quick", defaultOptions{runQuick = True}) , ("run --ghc latest --cabal 3.10 --stack 2.9 --hls 2.0 --install",