Skip to content

Commit ad6c688

Browse files
committed
Run stack tests sequentially on windows
1 parent f38ff1d commit ad6c688

File tree

1 file changed

+11
-7
lines changed

1 file changed

+11
-7
lines changed

tests/BiosTests.hs

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ import HIE.Bios.Cradle
1818
import Control.Monad (forM_)
1919
import Control.Monad.Extra (unlessM)
2020
import Control.Monad.IO.Class
21+
import Data.Bool (bool)
2122
import Data.Foldable (for_)
2223
import Data.List ( sort, isPrefixOf )
2324
import Data.Typeable
@@ -64,15 +65,18 @@ main = do
6465
cabalDep <- checkToolIsAvailable "cabal"
6566
extraGhcDep <- checkToolIsAvailable extraGhc
6667

68+
-- There seems to be a race condition on stack tests on windows
69+
let stackTestGroup = bool testGroup (`sequentialTestGroup` AllFinish) isWindows
70+
6771
defaultMainWithIngredients (ignoreToolTests:verboseLogging:defaultIngredients) $
6872
testGroup "Bios-tests"
6973
[ testGroup "Find cradle" findCradleTests
7074
, testGroup "Symlink" symbolicLinkTests
7175
, testGroup "Loading tests"
7276
[ testGroup "bios" biosTestCases
7377
, testGroup "direct" directTestCases
74-
, testGroupWithDependency cabalDep (cabalTestCases extraGhcDep)
75-
, ignoreOnUnsupportedGhc $ testGroupWithDependency stackDep stackTestCases
78+
, withDependency testGroup cabalDep (cabalTestCases extraGhcDep)
79+
, ignoreOnUnsupportedGhc $ withDependency stackTestGroup stackDep stackTestCases
7680
]
7781
]
7882

@@ -259,7 +263,7 @@ cabalTestCases extraGhcDep =
259263
, biosTestCase "implicit-cabal-deep-project" $ runTestEnv "./implicit-cabal-deep-project" $ do
260264
testImplicitDirectoryM isCabalCradle "foo/Main.hs"
261265
]
262-
, testGroupWithDependency extraGhcDep
266+
, withDependency testGroup extraGhcDep
263267
[ biosTestCase "Appropriate ghc and libdir" $ runTestEnvLocal "./cabal-with-ghc" $ do
264268
initCradle "src/MyLib.hs"
265269
assertCradle isCabalCradle
@@ -292,7 +296,7 @@ cabalTestCases extraGhcDep =
292296
, biosTestCase "multi-cabal-with-project, load" $ runTestEnv "multi-cabal-with-project" $ do
293297
testDirectoryM isCabalCradle "appB/src/Lib.hs"
294298
testDirectoryM isCabalCradle "appB/src/Lib.hs"
295-
, testGroupWithDependency extraGhcDep
299+
, withDependency testGroup extraGhcDep
296300
[ biosTestCase "Honours extra ghc setting" $ runTestEnv "cabal-with-ghc-and-project" $ do
297301
initCradle "src/MyLib.hs"
298302
assertCradle isCabalCradle
@@ -503,14 +507,14 @@ checkToolIsAvailable f = do
503507
, toolExists = exists
504508
}
505509

506-
testGroupWithDependency :: ToolDependency -> [TestTree] -> TestTree
507-
testGroupWithDependency td tc = askOption @IgnoreToolDeps (\case
510+
withDependency :: (TestName -> [TestTree] -> TestTree) -> ToolDependency -> [TestTree] -> TestTree
511+
withDependency group td tc = askOption @IgnoreToolDeps (\case
508512
IgnoreToolDeps ignoreToolDep
509513
| ignoreToolDep || toolExists td -> tg
510514
| otherwise -> itg
511515
)
512516
where
513-
tg = testGroup (toolName td) tc
517+
tg = group (toolName td) tc
514518

515519
itg =
516520
ignoreTestBecause

0 commit comments

Comments
 (0)