Skip to content

Commit

Permalink
Merge pull request #8055 from jneira/enable-hackage-tests-for-win
Browse files Browse the repository at this point in the history
Enable hackage tests for windows
  • Loading branch information
mergify[bot] authored Mar 27, 2022
2 parents 971db6c + 9528d54 commit 179375f
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 14 deletions.
2 changes: 0 additions & 2 deletions Cabal-tests/Cabal-tests.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -155,8 +155,6 @@ test-suite hackage-tests
type: exitcode-stdio-1.0
main-is: HackageTests.hs

if os(windows)
buildable: False

hs-source-dirs: tests
build-depends:
Expand Down
7 changes: 6 additions & 1 deletion Cabal-tests/tests/HackageTests.hs
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ import Data.TreeDiff.Pretty (ansiWlEditExprCompact)
parseIndex :: (Monoid a, NFData a) => (FilePath -> Bool)
-> (FilePath -> B.ByteString -> IO a) -> IO a
parseIndex predicate action = do
cabalDir <- getAppUserDataDirectory "cabal"
cabalDir <- getCabalDir
configPath <- getCabalConfigPath cabalDir
cfg <- B.readFile configPath
cfgFields <- either (fail . show) pure $ Parsec.readFields cfg
Expand All @@ -74,6 +74,11 @@ parseIndex predicate action = do
tarName repo = repoCache </> repo </> "01-index.tar"
mconcat <$> traverse (parseIndex' predicate action . tarName) repos
where
getCabalDir = do
mx <- lookupEnv "CABAL_DIR"
case mx of
Just x -> return x
Nothing -> getAppUserDataDirectory "cabal"
getCabalConfigPath cabalDir = do
mx <- lookupEnv "CABAL_CONFIG"
case mx of
Expand Down
18 changes: 7 additions & 11 deletions validate.sh
Original file line number Diff line number Diff line change
Expand Up @@ -401,18 +401,14 @@ CMD="$($CABALPLANLISTBIN Cabal-tests:test:no-thunks-test) $TESTSUITEJOBS --hide-
(cd Cabal-tests && timed $CMD) || exit 1

CMD=$($CABALPLANLISTBIN Cabal-tests:test:hackage-tests)
# hackage-tests is not buildable in windows so $CMD will be empty here
if [ "$OSTYPE" != "msys" ]; then
(cd Cabal-tests && timed $CMD read-fields) || exit 1
if $HACKAGETESTSALL; then
(cd Cabal-tests && timed $CMD parsec) || exit 1
(cd Cabal-tests && timed $CMD roundtrip) || exit 1
else
(cd Cabal-tests && timed $CMD parsec d) || exit 1
(cd Cabal-tests && timed $CMD roundtrip k) || exit 1
fi
(cd Cabal-tests && timed $CMD read-fields) || exit 1
if $HACKAGETESTSALL; then
(cd Cabal-tests && timed $CMD parsec) || exit 1
(cd Cabal-tests && timed $CMD roundtrip) || exit 1
else
(cd Cabal-tests && timed $CMD parsec d) || exit 1
(cd Cabal-tests && timed $CMD roundtrip k) || exit 1
fi

}

# Cabal cabal-testsuite
Expand Down

0 comments on commit 179375f

Please sign in to comment.