Skip to content

Commit e19c5a3

Browse files
authored
Enable test suite to run in parallel (haskell/ghcide#833)
* Enable test suite to run in parallel To run the test suite in parallel with Cabal: > cabal test --test-options="+RTS -N" Locally, this runs the test suite in 58s in a Xeon with 56 logical cores Importantly, this change does not change CI (unless stack passes +RTS -N secretly) * Revert runInDir
1 parent f3f922d commit e19c5a3

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

ghcide/test/exe/Main.hs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,6 @@ import Development.IDE.Plugin.Test (TestRequest(BlockSeconds,GetInterfaceFilesDi
6161
main :: IO ()
6262
main = do
6363
-- We mess with env vars so run single-threaded.
64-
setEnv "TASTY_NUM_THREADS" "1" True
6564
defaultMainWithRerun $ testGroup "ghcide"
6665
[ testSession "open close" $ do
6766
doc <- createDoc "Testing.hs" "haskell" ""
@@ -2115,6 +2114,7 @@ findDefinitionAndHoverTests = let
21152114
closeDoc fooDoc
21162115

21172116
doc <- openTestDataDoc (dir </> sourceFilePath)
2117+
void (skipManyTill anyMessage message :: Session WorkDoneProgressEndNotification)
21182118
found <- get doc pos
21192119
check found targetRange
21202120

@@ -2126,7 +2126,7 @@ findDefinitionAndHoverTests = let
21262126
check expected =
21272127
case hover of
21282128
Nothing -> unless (expected == ExpectNoHover) $ liftIO $ assertFailure "no hover found"
2129-
Just Hover{_contents = (HoverContents MarkupContent{_value = msg})
2129+
Just Hover{_contents = (HoverContents MarkupContent{_value = standardizeQuotes -> msg})
21302130
,_range = rangeInHover } ->
21312131
case expected of
21322132
ExpectRange expectedRange -> checkHoverRange expectedRange rangeInHover msg
@@ -2186,7 +2186,7 @@ findDefinitionAndHoverTests = let
21862186
aaaL14 = Position 18 20 ; aaa = [mkR 11 0 11 3]
21872187
dcL7 = Position 11 11 ; tcDC = [mkR 7 23 9 16]
21882188
dcL12 = Position 16 11 ;
2189-
xtcL5 = Position 9 11 ; xtc = [ExpectExternFail, ExpectHoverText ["Int", "Defined in GHC.Types"]]
2189+
xtcL5 = Position 9 11 ; xtc = [ExpectExternFail, ExpectHoverText ["Int", "Defined in 'GHC.Types'"]]
21902190
tcL6 = Position 10 11 ; tcData = [mkR 7 0 9 16, ExpectHoverText ["TypeConstructor", "GotoHover.hs:8:1"]]
21912191
vvL16 = Position 20 12 ; vv = [mkR 20 4 20 6]
21922192
opL16 = Position 20 15 ; op = [mkR 21 2 21 4]
@@ -2196,7 +2196,7 @@ findDefinitionAndHoverTests = let
21962196
xvL20 = Position 24 8 ; xvMsg = [ExpectExternFail, ExpectHoverText ["Data.Text.pack", ":: String -> Text"]]
21972197
clL23 = Position 27 11 ; cls = [mkR 25 0 26 20, ExpectHoverText ["MyClass", "GotoHover.hs:26:1"]]
21982198
clL25 = Position 29 9
2199-
eclL15 = Position 19 8 ; ecls = [ExpectExternFail, ExpectHoverText ["Num", "Defined in GHC.Num"]]
2199+
eclL15 = Position 19 8 ; ecls = [ExpectExternFail, ExpectHoverText ["Num", "Defined in 'GHC.Num'"]]
22002200
dnbL29 = Position 33 18 ; dnb = [ExpectHoverText [":: ()"], mkR 33 12 33 21]
22012201
dnbL30 = Position 34 23
22022202
lcbL33 = Position 37 26 ; lcb = [ExpectHoverText [":: Char"], mkR 37 26 37 27]

ghcide/test/src/Development/IDE/Test.hs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ module Development.IDE.Test
1212
, expectDiagnosticsWithTags
1313
, expectNoMoreDiagnostics
1414
, canonicalizeUri
15+
, standardizeQuotes
1516
) where
1617

1718
import Control.Applicative.Combinators

0 commit comments

Comments
 (0)