Skip to content
This repository has been archived by the owner on Jan 2, 2021. It is now read-only.

Commit

Permalink
Enable test suite for windows, ghc-8.8 and ghc-8.10 (#855)
Browse files Browse the repository at this point in the history
* Remove -f-external-interpreter for 8.10

* Rerun tests in the first step

* Rerun tests in the first step for linux

* Wait for register caps

* Remove -f-external-interpreter for 8.10

* Rerun tests in the first step

* Rerun tests in the first step for linux

* Wait for register caps

* Refactor ignoreInWindows* functions

* Ignore test for win and ghc-8.8

* Enable all win jobs (again)

* Ignore in win the known broken in nix

* Ignore addDependentFile for ghc-8.8

* Ignore findsTHnewNameConstructor for ghc-8.8

* Use --rerun-update in first test execution

To make sure it creates/overwrites .tasty-rerun-log
  • Loading branch information
jneira authored Oct 9, 2020
1 parent a021701 commit b60a64f
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 21 deletions.
2 changes: 1 addition & 1 deletion .azure/linux-stack.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,6 @@ jobs:
displayName: 'stack build --test --only-dependencies'
- bash: |
export PATH=/opt/cabal/bin:$PATH
stack test --ghc-options=-Werror --stack-yaml=$STACK_YAML || stack test --ghc-options=-Werror --stack-yaml=$STACK_YAML --ta "--rerun" || LSP_TEST_LOG_COLOR=0 LSP_TEST_LOG_MESSAGES=true LSP_TEST_LOG_STDERR=true stack test --ghc-options=-Werror --stack-yaml=$STACK_YAML --ta "--rerun"
stack test --ghc-options=-Werror --stack-yaml=$STACK_YAML --ta "--rerun-update" || stack test --ghc-options=-Werror --stack-yaml=$STACK_YAML --ta "--rerun" || LSP_TEST_LOG_COLOR=0 LSP_TEST_LOG_MESSAGES=true LSP_TEST_LOG_STDERR=true stack test --ghc-options=-Werror --stack-yaml=$STACK_YAML --ta "--rerun"
# ghcide stack tests are flaky, see https://github.com/digital-asset/daml/issues/2606.
displayName: 'stack test --ghc-options=-Werror'
14 changes: 5 additions & 9 deletions .azure/windows-stack.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ jobs:
vmImage: 'windows-2019'
strategy:
matrix:
# stack_810:
# STACK_YAML: "stack8101.yaml"
# stack_88:
# STACK_YAML: "stack88.yaml"
stack_810:
STACK_YAML: "stack8101.yaml"
stack_88:
STACK_YAML: "stack88.yaml"
stack_86:
STACK_YAML: "stack.yaml"
stack_ghc_lib_88:
Expand Down Expand Up @@ -54,9 +54,5 @@ jobs:
fi
displayName: 'stack build --only-dependencies'
- bash: |
if [ "$STACK_YAML" = "stack8101.yaml" ]; then
stack test --ghc-options="-Werror -fexternal-interpreter" --stack-yaml $STACK_YAML || stack test --ghc-options="-Werror -fexternal-interpreter" --stack-yaml=$STACK_YAML --ta "--rerun" || LSP_TEST_LOG_COLOR=0 LSP_TEST_LOG_MESSAGES=true LSP_TEST_LOG_STDERR=true stack test --ghc-options="-Werror -fexternal-interpreter" --stack-yaml=$STACK_YAML --ta "--rerun"
else
stack test --ghc-options=-Werror --stack-yaml $STACK_YAML || stack test --ghc-options=-Werror --stack-yaml=$STACK_YAML --ta "--rerun" || LSP_TEST_LOG_COLOR=0 LSP_TEST_LOG_MESSAGES=true LSP_TEST_LOG_STDERR=true stack test --ghc-options=-Werror --stack-yaml=$STACK_YAML --ta "--rerun"
fi
stack test --ghc-options=-Werror --stack-yaml $STACK_YAML --ta "--rerun-update" || stack test --ghc-options=-Werror --stack-yaml=$STACK_YAML --ta "--rerun" || LSP_TEST_LOG_COLOR=0 LSP_TEST_LOG_MESSAGES=true LSP_TEST_LOG_STDERR=true stack test --ghc-options=-Werror --stack-yaml=$STACK_YAML --ta "--rerun"
displayName: 'stack test --ghc-options=-Werror'
31 changes: 20 additions & 11 deletions test/exe/Main.hs
Original file line number Diff line number Diff line change
Expand Up @@ -1711,7 +1711,7 @@ addFunctionConstraintTests = let
, "eq :: " <> constraint <> " => Pair a b -> Pair a b -> Bool"
, "eq (Pair x y) (Pair x' y') = x == x' && y == y'"
]

incompleteConstraintSourceCodeWithNewlinesInTypeSignature :: T.Text -> T.Text
incompleteConstraintSourceCodeWithNewlinesInTypeSignature constraint =
T.unlines
Expand Down Expand Up @@ -2296,7 +2296,7 @@ checkFileCompiles fp =

pluginSimpleTests :: TestTree
pluginSimpleTests =
ignoreInWindowsAndGHCGreaterThan86 $ testSessionWait "simple plugin" $ do
ignoreInWindowsForGHC88And810 $ testSessionWait "simple plugin" $ do
let content =
T.unlines
[ "{-# OPTIONS_GHC -fplugin GHC.TypeLits.KnownNat.Solver #-}"
Expand All @@ -2319,7 +2319,7 @@ pluginSimpleTests =

pluginParsedResultTests :: TestTree
pluginParsedResultTests =
ignoreInWindowsAndGHCGreaterThan86 $ testSessionWait "parsedResultAction plugin" $ do
ignoreInWindowsForGHC88And810 $ testSessionWait "parsedResultAction plugin" $ do
let content =
T.unlines
[ "{-# LANGUAGE DuplicateRecordFields, TypeApplications, FlexibleContexts, DataKinds, MultiParamTypeClasses, TypeSynonymInstances, FlexibleInstances #-}"
Expand Down Expand Up @@ -2468,7 +2468,7 @@ thTests =
_ <- createDoc "A.hs" "haskell" sourceA
_ <- createDoc "B.hs" "haskell" sourceB
return ()
, thReloadingTest `xfail` "expect broken (#672)"
, ignoreInWindowsForGHC88 (thReloadingTest `xfail` "expect broken (#672)")
-- Regression test for https://github.com/digital-asset/ghcide/issues/614
, testSessionWait "findsTHIdentifiers" $ do
let sourceA =
Expand All @@ -2488,7 +2488,7 @@ thTests =
_ <- createDoc "A.hs" "haskell" sourceA
_ <- createDoc "B.hs" "haskell" sourceB
expectDiagnostics [ ( "B.hs", [(DsWarning, (4, 0), "Top-level binding with no type signature: main :: IO ()")] ) ]
, testCase "findsTHnewNameConstructor" $ withoutStackEnv $ runWithExtraFiles "THNewName" $ \dir -> do
, ignoreInWindowsForGHC88 $ testCase "findsTHnewNameConstructor" $ withoutStackEnv $ runWithExtraFiles "THNewName" $ \dir -> do

-- This test defines a TH value with the meaning "data A = A" in A.hs
-- Loads and export the template in B.hs
Expand Down Expand Up @@ -2981,12 +2981,20 @@ expectFailCabal = expectFailBecause
ignoreInWindowsBecause :: String -> TestTree -> TestTree
ignoreInWindowsBecause = if isWindows then ignoreTestBecause else flip const

ignoreInWindowsAndGHCGreaterThan86 :: TestTree -> TestTree
#if MIN_GHC_API_VERSION(8,8,1)
ignoreInWindowsAndGHCGreaterThan86 =
ignoreInWindowsBecause "tests are unreliable for windows and ghc greater than 8.6.5"
ignoreInWindowsForGHC88And810 :: TestTree -> TestTree
#if MIN_GHC_API_VERSION(8,8,1) && !MIN_GHC_API_VERSION(9,0,0)
ignoreInWindowsForGHC88And810 =
ignoreInWindowsBecause "tests are unreliable in windows for ghc 8.8 and 8.10"
#else
ignoreInWindowsForGHC88And810 = id
#endif

ignoreInWindowsForGHC88 :: TestTree -> TestTree
#if MIN_GHC_API_VERSION(8,8,1) && !MIN_GHC_API_VERSION(8,10,1)
ignoreInWindowsForGHC88 =
ignoreInWindowsBecause "tests are unreliable in windows for ghc 8.8"
#else
ignoreInWindowsAndGHCGreaterThan86 = id
ignoreInWindowsForGHC88 = id
#endif

data Expect
Expand Down Expand Up @@ -3095,7 +3103,7 @@ loadCradleOnlyonce = testGroup "load cradle only once"

dependentFileTest :: TestTree
dependentFileTest = testGroup "addDependentFile"
[testGroup "file-changed" [testSession' "test" test]
[testGroup "file-changed" [ignoreInWindowsForGHC88 $ testSession' "test" test]
]
where
test dir = do
Expand Down Expand Up @@ -3477,6 +3485,7 @@ clientSettingsTest = testGroup "client settings handling"
logNot <- skipManyTill anyMessage loggingNotification
isMessagePresent "Updating Not supported" [getLogMessage logNot]
, testSession "ghcide restarts shake session on config changes" $ do
void $ skipManyTill anyMessage $ message @RegisterCapabilityRequest
sendNotification WorkspaceDidChangeConfiguration (DidChangeConfigurationParams (toJSON ("" :: String)))
nots <- skipManyTill anyMessage $ count 3 loggingNotification
isMessagePresent "Restarting build session" (map getLogMessage nots)
Expand Down

0 comments on commit b60a64f

Please sign in to comment.