GitHub test action (#903)

* Add github test action

* Disable unreliable test

Does not work reliably on all platforms.

Reenable when #861 lands

* Add hlint and -Werror

* Explicit timeout

6h is the default and also the maximum:

https://docs.github.com/en/free-pro-team@latest/actions/reference/usage-limits-billing-and-administration

* Experiment tests to use Cabal instead of Stack

* Fix an unreliable test

* Trim down matrix

* Add ghc-lib to the test matrix

* Address broken hie-compat ghc-lib build

* Drop stack descriptor family

We keep two stack descriptors:

- One for Nightly
- One for Windows (stuck in GHC 8.10.1)

To ensure that `stack test` doesn't break, we keep running the stack tests in CI

* Update README to point end users to HLS

* Drop support for `stack test`
This commit is contained in:
Pepe Iborra 2020-11-15 23:08:17 +00:00 committed by GitHub
parent a791afdea1
commit 03e89d9b47
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
12 changed files with 141 additions and 217 deletions

View File

@ -3,29 +3,19 @@ jobs:
timeoutInMinutes: 60
pool:
vmImage: 'ubuntu-latest'
strategy:
matrix:
stack_810:
STACK_YAML: "stack810.yaml"
stack_88:
STACK_YAML: "stack88.yaml"
stack_86:
STACK_YAML: "stack.yaml"
stack_ghc_lib_88:
STACK_YAML: "stack-ghc-lib.yaml"
variables:
STACK_ROOT: $(Pipeline.Workspace)/.stack
steps:
- checkout: self
- task: Cache@2
inputs:
key: stack-root-cache | $(Agent.OS) | $(Build.SourcesDirectory)/$(STACK_YAML) | $(Build.SourcesDirectory)/ghcide.cabal
key: stack-root-cache | $(Agent.OS) | $(Build.SourcesDirectory)/stack.yaml | $(Build.SourcesDirectory)/ghcide.cabal
path: $(STACK_ROOT)
cacheHitVar: STACK_ROOT_CACHE_RESTORED
displayName: "Cache stack root"
- task: Cache@2
inputs:
key: stack-work-cache | $(Agent.OS) | $(Build.SourcesDirectory)/$(STACK_YAML) | $(Build.SourcesDirectory)/ghcide.cabal
key: stack-work-cache | $(Agent.OS) | $(Build.SourcesDirectory)/stack.yaml | $(Build.SourcesDirectory)/ghcide.cabal
path: .stack-work
cacheHitVar: STACK_WORK_CACHE_RESTORED
displayName: "Cache stack work"
@ -41,14 +31,9 @@ jobs:
fi
mkdir -p $STACK_ROOT
displayName: 'Install Stack'
- bash: stack setup --stack-yaml=$STACK_YAML
- bash: stack setup
displayName: 'stack setup'
- bash: cabal update # some tests use Cabal cradles
displayName: 'cabal update'
- bash: stack build --test --only-dependencies --stack-yaml=$STACK_YAML
displayName: 'stack build --test --only-dependencies'
- bash: |
export PATH=/opt/cabal/bin:$PATH
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'
- bash: stack build --test --no-run-tests
displayName: 'stack build --test --no-run-tests'

View File

@ -3,29 +3,19 @@ jobs:
timeoutInMinutes: 120
pool:
vmImage: 'windows-2019'
strategy:
matrix:
stack_810:
STACK_YAML: "stack8101.yaml"
stack_88:
STACK_YAML: "stack88.yaml"
stack_86:
STACK_YAML: "stack.yaml"
stack_ghc_lib_88:
STACK_YAML: "stack-ghc-lib.yaml"
variables:
STACK_ROOT: "C:\\sr"
steps:
- checkout: self
- task: Cache@2
inputs:
key: stack-root-cache | $(Agent.OS) | $(Build.SourcesDirectory)/$(STACK_YAML) | $(Build.SourcesDirectory)/ghcide.cabal
key: stack-root-cache | $(Agent.OS) | $(Build.SourcesDirectory)/stack-windows.yaml | $(Build.SourcesDirectory)/ghcide.cabal
path: $(STACK_ROOT)
cacheHitVar: STACK_ROOT_CACHE_RESTORED
displayName: "Cache stack root"
- task: Cache@2
inputs:
key: stack-work-cache | $(Agent.OS) | $(Build.SourcesDirectory)/$(STACK_YAML) | $(Build.SourcesDirectory)/ghcide.cabal
key: stack-work-cache | $(Agent.OS) | $(Build.SourcesDirectory)/stack-windows.yaml | $(Build.SourcesDirectory)/ghcide.cabal
path: .stack-work
cacheHitVar: STACK_WORK_CACHE_RESTORED
displayName: "Cache stack work"
@ -37,22 +27,15 @@ jobs:
unzip -o /usr/bin/stack.zip -d /usr/bin/
mkdir -p "$STACK_ROOT"
displayName: 'Install Stack'
- bash: stack setup --stack-yaml $STACK_YAML
- bash: stack setup --stack-yaml stack-windows.yaml
displayName: 'stack setup'
- bash: |
# Installing happy and alex standalone to avoid error "strip.exe: unable to rename ../*.exe; reason: File exists"
stack install happy --stack-yaml $STACK_YAML
stack install alex --stack-yaml $STACK_YAML
stack install happy --stack-yaml stack-windows.yaml
stack install alex --stack-yaml stack-windows.yaml
choco install -y cabal --version=$CABAL_VERSION
$(cygpath $ProgramData)/chocolatey/bin/RefreshEnv.cmd
# GHC 8.10.1 fails with ghc segfaults, using -fexternal-interpreter seems to make it working
# There are other transient errors like timeouts downloading from stackage so we retry 3 times
if [ "$STACK_YAML" = "stack8101.yaml" ]; then
stack build --only-dependencies --stack-yaml $STACK_YAML --ghc-options="-fexternal-interpreter" || stack build --only-dependencies --stack-yaml $STACK_YAML --ghc-options="-fexternal-interpreter" || stack build --only-dependencies --stack-yaml $STACK_YAML --ghc-options="-fexternal-interpreter"
else
stack build --only-dependencies --stack-yaml $STACK_YAML || stack build --only-dependencies --stack-yaml $STACK_YAML || stack build --only-dependencies --stack-yaml $STACK_YAML
fi
displayName: 'stack build --only-dependencies'
- bash: |
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'
stack build --test --no-run-tests --stack-yaml stack-windows.yaml --ghc-options="-fexternal-interpreter" || stack build --test --no-run-tests --stack-yaml stack-windows.yaml --ghc-options="-fexternal-interpreter" || stack build --test --no-run-tests --stack-yaml stack-windows.yaml --ghc-options="-fexternal-interpreter"
displayName: 'stack build --test'

View File

@ -22,15 +22,11 @@ jobs:
- name: Cache Cabal
uses: actions/cache@v2
env:
cache-name: cache-cabal
with:
path: ~/.cabal/
key: ${{ runner.os }}-${{ matrix.ghc }}-build-${{ env.cache-name }}-${{ hashFiles('ghcide.cabal', 'cabal.project') }}
restore-keys: |
${{ runner.os }}-${{ matrix.ghc }}-build-${{ env.cache-name }}-
${{ runner.os }}-${{ matrix.ghc }}-build-
${{ runner.os }}-${{ matrix.ghc }}
path: |
~/.cabal/packages
~/.cabal/store
key: ${{ runner.os }}-${{ matrix.ghc }}-cabal-bench
- run: cabal update

69
.github/workflows/test.yml vendored Normal file
View File

@ -0,0 +1,69 @@
name: Testing
on: [push, pull_request]
jobs:
test:
timeout-minutes: 360
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [macOS-latest, ubuntu-latest, windows-latest]
ghc: ['8.10.2', '8.8.4', '8.6.5']
ghc-lib: [false]
exclude:
- os: windows-latest
ghc: '8.10.2' # broken due to https://gitlab.haskell.org/ghc/ghc/-/issues/18550
- os: windows-latest
ghc: '8.8.4' # also fails due to segfault :(
include:
- os: windows-latest
ghc: '8.10.1'
- os: ubuntu-latest
ghc: '8.10.1'
ghc-lib: true
steps:
- uses: actions/checkout@v2
- uses: actions/setup-haskell@v1.1.3
with:
ghc-version: ${{ matrix.ghc }}
cabal-version: '3.2'
- run: ./fmt.sh
name: "HLint via ./fmt.sh"
- name: Cache Cabal
uses: actions/cache@v2
with:
path: |
~/.cabal/packages
~/.cabal/store
key: ${{ runner.os }}-${{ matrix.ghc }}-{{matrix.ghc-lib}}-cabal-test
- run: cabal update
- name: cabal.project.local
run: |
echo "tests: True" > cabal.project.local
echo "package ghcide" >> cabal.project.local
echo " ghc-options: -Werror" >> cabal.project.local
- name: ghc-lib
if: ${{ matrix.ghc-lib }}
run: |
echo " flags: ghc-lib" >> cabal.project.local
echo "package hie-compat" >> cabal.project.local
echo " flags: ghc-lib" >> cabal.project.local
- name: Build
shell: bash
# Retry it three times to workaround compiler segfaults in windows
run: cabal build || cabal build || cabal build
- name: Test
shell: bash
# run the tests without parallelism to avoid running out of memory
run: cabal test --test-options="-j1 --rerun-update" || cabal test --test-options="-j1 --rerun" || LSP_TEST_LOG_COLOR=0 LSP_TEST_LOG_MESSAGES=true LSP_TEST_LOG_STDERR=true cabal test --test-options="-j1 --rerun"
if: ${{ !matrix.ghc-lib}}

View File

@ -46,6 +46,10 @@ a simple reproduction of the bug.
### Install `ghcide`
[We recommend](https://neilmitchell.blogspot.com/2020/09/dont-use-ghcide-anymore-directly.html) installing and using the Haskell extension in VS Code, or the prebuilt binaries provided by https://github.com/haskell/haskell-language-server
If you still wish to install `ghcide` direcly, the instructions below might prove useful *but you are on your own*.
#### With Nix
Note that you need to compile `ghcide` with the same `ghc` as the project you are working on.
@ -317,13 +321,15 @@ args = ["--lsp"]
## Hacking on ghcide
To build and work on `ghcide` itself, you can use Stack or cabal, e.g.,
running `stack test` will execute the test suite.
To build and work on `ghcide` itself, you should use cabal, e.g.,
running `cabal test` will execute the test suite. You can use `stack test` too, but
note that some tests will fail, and none of the maintainers are currently using `stack`.
If you are using Windows, you should disable the `auto.crlf` setting and configure your editor to use LF line endings, directly or making it use the existing `.editor-config`.
If you are chasing down test failures, you can use the tasty-rerun feature by running tests as
stack --stack-yaml=stack84.yaml test --test-arguments "--rerun"
cabal test --test-options"--rerun"
This writes a log file called `.tasty-rerun-log` of the failures, and only runs those.
See the [tasty-rerun](https://hackage.haskell.org/package/tasty-rerun-1.1.17/docs/Test-Tasty-Ingredients-Rerun.html) documentation for other options.
@ -332,12 +338,9 @@ If you are touching performance sensitive code, take the time to run a different
benchmark between HEAD and master using the benchHist script. This assumes that
"master" points to the upstream master.
Run the benchmarks with `stack`:
Run the benchmarks with `cabal bench`.
export STACK_YAML=...
stack bench
It should take around 15 minutes and the results will be stored in the `bench-hist` folder. To interpret the results, see the comments in the `bench/hist/Main.hs` module.
It should take around 15 minutes and the results will be stored in the `bench-results` folder. To interpret the results, see the comments in the `bench/hist/Main.hs` module.
More details in [bench/README](bench/README.md)

View File

@ -38,8 +38,8 @@ library
if (impl(ghc > 8.5) && impl(ghc < 8.7) && !flag(ghc-lib))
hs-source-dirs: src-ghc86
if ((impl(ghc > 8.7) && impl(ghc < 8.10)) || flag(ghc-lib))
if (impl(ghc > 8.7) && impl(ghc < 8.10))
hs-source-dirs: src-ghc88 src-reexport
if (impl(ghc > 8.9) && impl(ghc < 8.11))
if (impl(ghc > 8.9) && impl(ghc < 8.11) || flag(ghc-lib))
hs-source-dirs: src-ghc810 src-reexport

View File

@ -1,30 +0,0 @@
resolver: nightly-2019-09-16
packages:
- .
- ./hie-compat/
extra-deps:
- haskell-lsp-0.22.0.0
- haskell-lsp-types-0.22.0.0
- lsp-test-0.11.0.5
- extra-1.7.2
- hie-bios-0.7.1
- ghc-lib-parser-8.8.1
- ghc-lib-8.8.1
- fuzzy-0.1.0.0
- shake-0.18.5
- regex-base-0.94.0.0
- regex-tdfa-1.3.1.0
- haddock-library-1.8.0
- ghc-check-0.5.0.1
- parser-combinators-1.2.1
nix:
packages: [zlib]
flags:
ghcide:
ghc-lib: True
hie-compat:
ghc-lib: True
ghc-options:
ghc-lib-parser: -O0
ghc-lib: -O0
ghcide: -DSTACK

View File

@ -30,6 +30,3 @@ extra-deps:
nix:
packages: [zlib]
ghc-options:
ghcide: -DSTACK

View File

@ -1,28 +1,32 @@
resolver: nightly-2019-09-21
resolver: nightly-2020-09-02
allow-newer: true
packages:
- .
- ./hie-compat/
extra-deps:
- aeson-1.4.6.0
- haskell-lsp-0.22.0.0
- haskell-lsp-types-0.22.0.0
- lsp-test-0.11.0.6
- hie-bios-0.7.1@rev:2
- ghc-check-0.5.0.1
- hie-bios-0.7.1
# not yet in stackage
- Chart-diagrams-1.9.3
- SVGFonts-1.7.0.1
- diagrams-1.4
- diagrams-svg-1.4.3
- diagrams-contrib-1.4.4
- diagrams-core-1.4.2
- diagrams-lib-1.4.3
- diagrams-postscript-1.5
- monoid-extras-0.5.1
- svg-builder-0.1.1
- active-0.2.0.14
- dual-tree-0.2.2.1
- force-layout-0.4.0.6
- statestack-0.3
- implicit-hie-0.1.2.3
- implicit-hie-cradle-0.3.0.0
- fuzzy-0.1.0.0
- regex-pcre-builtin-0.95.1.1.8.43
- regex-base-0.94.0.0
- regex-tdfa-1.3.1.0
- shake-0.18.5
- parser-combinators-1.2.1
- haddock-library-1.8.0
- tasty-rerun-1.1.17
- ghc-check-0.5.0.1
- extra-1.7.2
nix:
packages: [zlib]
ghc-options:
ghcide: -DSTACK

View File

@ -1,35 +0,0 @@
resolver: nightly-2020-09-02
allow-newer: true
packages:
- .
- ./hie-compat/
extra-deps:
- haskell-lsp-0.22.0.0
- haskell-lsp-types-0.22.0.0
- lsp-test-0.11.0.6
- ghc-check-0.5.0.1
- hie-bios-0.7.1
# not yet in stackage
- Chart-diagrams-1.9.3
- SVGFonts-1.7.0.1
- diagrams-1.4
- diagrams-svg-1.4.3
- diagrams-contrib-1.4.4
- diagrams-core-1.4.2
- diagrams-lib-1.4.3
- diagrams-postscript-1.5
- monoid-extras-0.5.1
- svg-builder-0.1.1
- active-0.2.0.14
- dual-tree-0.2.2.1
- force-layout-0.4.0.6
- statestack-0.3
- implicit-hie-0.1.2.3
- implicit-hie-cradle-0.3.0.0
nix:
packages: [zlib]
ghc-options:
ghcide: -DSTACK

View File

@ -1,19 +0,0 @@
resolver: lts-16.12
packages:
- .
- ./hie-compat/
extra-deps:
- haskell-lsp-0.22.0.0
- haskell-lsp-types-0.22.0.0
- lsp-test-0.11.0.6
- ghc-check-0.5.0.1
- hie-bios-0.7.1
- extra-1.7.2
- implicit-hie-0.1.2.3
- implicit-hie-cradle-0.3.0.0
nix:
packages: [zlib]
ghc-options:
ghcide: -DSTACK

View File

@ -11,7 +11,7 @@
module Main (main) where
import Control.Applicative.Combinators
import Control.Exception (bracket, catch)
import Control.Exception (catch)
import qualified Control.Lens as Lens
import Control.Monad
import Control.Monad.IO.Class (liftIO)
@ -41,7 +41,7 @@ import Language.Haskell.LSP.Types.Capabilities
import qualified Language.Haskell.LSP.Types.Lens as Lsp (diagnostics, params, message)
import Language.Haskell.LSP.VFS (applyChange)
import Network.URI
import System.Environment.Blank (getEnv, setEnv, unsetEnv)
import System.Environment.Blank (getEnv, setEnv)
import System.FilePath
import System.IO.Extra hiding (withTempDir)
import qualified System.IO.Extra
@ -342,11 +342,11 @@ diagnosticTests = testGroup "diagnostics"
, testSessionWait "correct reference used with hs-boot" $ do
let contentB = T.unlines
[ "module ModuleB where"
, "import {-# SOURCE #-} ModuleA"
, "import {-# SOURCE #-} ModuleA()"
]
let contentA = T.unlines
[ "module ModuleA where"
, "import ModuleB"
, "import ModuleB()"
, "x = 5"
]
let contentAboot = T.unlines
@ -529,7 +529,7 @@ diagnosticTests = testGroup "diagnostics"
]
)
]
, testCase "typecheck-all-parents-of-interest" $ withoutStackEnv $ runWithExtraFiles "recomp" $ \dir -> do
, testCase "typecheck-all-parents-of-interest" $ runWithExtraFiles "recomp" $ \dir -> do
let bPath = dir </> "B.hs"
pPath = dir </> "P.hs"
@ -2098,7 +2098,7 @@ exportUnusedTests = testGroup "export unused actions"
[ "{-# OPTIONS_GHC -Wunused-top-binds #-}"
, "{-# LANGUAGE TypeOperators #-}"
, "module A ((:<)) where"
, "type (:<) = ()"])
, "type (:<) = ()"])
, testSession "type family operator" $ template
(T.unlines
[ "{-# OPTIONS_GHC -Wunused-top-binds #-}"
@ -2395,7 +2395,7 @@ findDefinitionAndHoverTests = let
, test broken broken outL45 outSig "top-level signature #310"
, test broken broken innL48 innSig "inner signature #310"
, test no yes holeL60 hleInfo "hole without internal name #847"
, test no yes cccL17 docLink "Haddock html links"
, test no skip cccL17 docLink "Haddock html links"
, testM yes yes imported importedSig "Imported symbol"
, testM yes yes reexported reexportedSig "Imported symbol (reexported)"
]
@ -2403,6 +2403,7 @@ findDefinitionAndHoverTests = let
yes = Just -- test should run and pass
broken = Just . (`xfail` "known broken")
no = const Nothing -- don't run this test at all
skip = const Nothing -- unreliable, don't run
checkFileCompiles :: FilePath -> Session () -> TestTree
checkFileCompiles fp diag =
@ -2417,11 +2418,7 @@ pluginSimpleTests =
testSessionWithExtraFiles "plugin" "simple plugin" $ \dir -> do
_ <- openDoc (dir </> "KnownNat.hs") "haskell"
liftIO $ writeFile (dir</>"hie.yaml")
#ifdef STACK
"cradle: {direct: {arguments: []}}"
#else
"cradle: {cabal: [{path: '.', component: 'lib:plugin'}]}"
#endif
expectDiagnostics
[ ( "KnownNat.hs",
@ -2594,7 +2591,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 ()")] ) ]
, ignoreInWindowsForGHC88 $ testCase "findsTHnewNameConstructor" $ withoutStackEnv $ runWithExtraFiles "THNewName" $ \dir -> do
, ignoreInWindowsForGHC88 $ testCase "findsTHnewNameConstructor" $ 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
@ -2609,7 +2606,7 @@ thTests =
-- | test that TH is reevaluated on typecheck
thReloadingTest :: TestTree
thReloadingTest = testCase "reloading-th-test" $ withoutStackEnv $ runWithExtraFiles "TH" $ \dir -> do
thReloadingTest = testCase "reloading-th-test" $ runWithExtraFiles "TH" $ \dir -> do
let aPath = dir </> "THA.hs"
bPath = dir </> "THB.hs"
@ -2643,7 +2640,7 @@ thReloadingTest = testCase "reloading-th-test" $ withoutStackEnv $ runWithExtraF
closeDoc cdoc
thLinkingTest :: TestTree
thLinkingTest = testCase "th-linking-test" $ withoutStackEnv $ runWithExtraFiles "TH" $ \dir -> do
thLinkingTest = testCase "th-linking-test" $ runWithExtraFiles "TH" $ \dir -> do
let aPath = dir </> "THA.hs"
bPath = dir </> "THB.hs"
@ -3104,13 +3101,6 @@ pattern R x y x' y' = Range (Position x y) (Position x' y')
xfail :: TestTree -> String -> TestTree
xfail = flip expectFailBecause
expectFailCabal :: String -> TestTree -> TestTree
#ifdef STACK
expectFailCabal _ = id
#else
expectFailCabal = expectFailBecause
#endif
ignoreTest8101 :: String -> TestTree -> TestTree
ignoreTest8101
| GHC_API_VERSION == ("8.10.1" :: String) = ignoreTestBecause
@ -3283,33 +3273,15 @@ cradleLoadedMessage = satisfy $ \case
cradleLoadedMethod :: T.Text
cradleLoadedMethod = "ghcide/cradle/loaded"
-- Stack sets this which trips up cabal in the multi-component tests.
-- However, our plugin tests rely on those env vars so we unset it locally.
withoutStackEnv :: IO a -> IO a
withoutStackEnv s =
bracket
(mapM getEnv vars >>= \prevState -> mapM_ unsetEnv vars >> pure prevState)
(\prevState -> mapM_ (\(var, value) -> restore var value) (zip vars prevState))
(const s)
where vars =
[ "GHC_PACKAGE_PATH"
, "GHC_ENVIRONMENT"
, "HASKELL_DIST_DIR"
, "HASKELL_PACKAGE_SANDBOX"
, "HASKELL_PACKAGE_SANDBOXES"
]
restore var Nothing = unsetEnv var
restore var (Just val) = setEnv var val True
ignoreFatalWarning :: TestTree
ignoreFatalWarning = testCase "ignore-fatal-warning" $ withoutStackEnv $ runWithExtraFiles "ignore-fatal" $ \dir -> do
ignoreFatalWarning = testCase "ignore-fatal-warning" $ runWithExtraFiles "ignore-fatal" $ \dir -> do
let srcPath = dir </> "IgnoreFatal.hs"
src <- liftIO $ readFileUtf8 srcPath
_ <- createDoc srcPath "haskell" src
expectNoMoreDiagnostics 5
simpleMultiTest :: TestTree
simpleMultiTest = testCase "simple-multi-test" $ withoutStackEnv $ runWithExtraFiles "multi" $ \dir -> do
simpleMultiTest = testCase "simple-multi-test" $ runWithExtraFiles "multi" $ \dir -> do
let aPath = dir </> "a/A.hs"
bPath = dir </> "b/B.hs"
aSource <- liftIO $ readFileUtf8 aPath
@ -3325,7 +3297,7 @@ simpleMultiTest = testCase "simple-multi-test" $ withoutStackEnv $ runWithExtraF
-- Like simpleMultiTest but open the files in the other order
simpleMultiTest2 :: TestTree
simpleMultiTest2 = testCase "simple-multi-test2" $ withoutStackEnv $ runWithExtraFiles "multi" $ \dir -> do
simpleMultiTest2 = testCase "simple-multi-test2" $ runWithExtraFiles "multi" $ \dir -> do
let aPath = dir </> "a/A.hs"
bPath = dir </> "b/B.hs"
bSource <- liftIO $ readFileUtf8 bPath
@ -3350,7 +3322,7 @@ ifaceTests = testGroup "Interface loading tests"
]
bootTests :: TestTree
bootTests = testCase "boot-def-test" $ withoutStackEnv $ runWithExtraFiles "boot" $ \dir -> do
bootTests = testCase "boot-def-test" $ runWithExtraFiles "boot" $ \dir -> do
let cPath = dir </> "C.hs"
cSource <- liftIO $ readFileUtf8 cPath
@ -3367,7 +3339,7 @@ bootTests = testCase "boot-def-test" $ withoutStackEnv $ runWithExtraFiles "boot
-- | test that TH reevaluates across interfaces
ifaceTHTest :: TestTree
ifaceTHTest = testCase "iface-th-test" $ withoutStackEnv $ runWithExtraFiles "TH" $ \dir -> do
ifaceTHTest = testCase "iface-th-test" $ runWithExtraFiles "TH" $ \dir -> do
let aPath = dir </> "THA.hs"
bPath = dir </> "THB.hs"
cPath = dir </> "THC.hs"
@ -3389,7 +3361,7 @@ ifaceTHTest = testCase "iface-th-test" $ withoutStackEnv $ runWithExtraFiles "TH
closeDoc cdoc
ifaceErrorTest :: TestTree
ifaceErrorTest = testCase "iface-error-test-1" $ withoutStackEnv $ runWithExtraFiles "recomp" $ \dir -> do
ifaceErrorTest = testCase "iface-error-test-1" $ runWithExtraFiles "recomp" $ \dir -> do
let bPath = dir </> "B.hs"
pPath = dir </> "P.hs"
@ -3441,7 +3413,7 @@ ifaceErrorTest = testCase "iface-error-test-1" $ withoutStackEnv $ runWithExtraF
expectNoMoreDiagnostics 2
ifaceErrorTest2 :: TestTree
ifaceErrorTest2 = testCase "iface-error-test-2" $ withoutStackEnv $ runWithExtraFiles "recomp" $ \dir -> do
ifaceErrorTest2 = testCase "iface-error-test-2" $ runWithExtraFiles "recomp" $ \dir -> do
let bPath = dir </> "B.hs"
pPath = dir </> "P.hs"
@ -3479,7 +3451,7 @@ ifaceErrorTest2 = testCase "iface-error-test-2" $ withoutStackEnv $ runWithExtra
expectNoMoreDiagnostics 2
ifaceErrorTest3 :: TestTree
ifaceErrorTest3 = testCase "iface-error-test-3" $ withoutStackEnv $ runWithExtraFiles "recomp" $ \dir -> do
ifaceErrorTest3 = testCase "iface-error-test-3" $ runWithExtraFiles "recomp" $ \dir -> do
let bPath = dir </> "B.hs"
pPath = dir </> "P.hs"
@ -3550,21 +3522,20 @@ nonLspCommandLine = testGroup "ghcide command line"
setEnv "HOME" "/homeless-shelter" False
(ec, _, _) <- withoutStackEnv $ readCreateProcessWithExitCode cmd ""
(ec, _, _) <- readCreateProcessWithExitCode cmd ""
ec @=? ExitSuccess
]
benchmarkTests :: TestTree
-- These tests require stack and will fail with cabal test
benchmarkTests =
let ?config = Bench.defConfig
{ Bench.verbosity = Bench.Quiet
, Bench.repetitions = Just 3
, Bench.buildTool = Bench.Stack
, Bench.buildTool = Bench.Cabal
} in
withResource Bench.setup Bench.cleanUp $ \getResource -> testGroup "benchmark experiments"
[ expectFailCabal "Requires stack" $ testCase (Bench.name e) $ do
[ testCase (Bench.name e) $ do
Bench.SetupResult{Bench.benchDir} <- getResource
res <- Bench.runBench (runInDir benchDir) e
assertBool "did not successfully complete 5 repetitions" $ Bench.success res
@ -3574,7 +3545,7 @@ benchmarkTests =
-- | checks if we use InitializeParams.rootUri for loading session
rootUriTests :: TestTree
rootUriTests = testCase "use rootUri" . withoutStackEnv . runTest "dirA" "dirB" $ \dir -> do
rootUriTests = testCase "use rootUri" . runTest "dirA" "dirB" $ \dir -> do
let bPath = dir </> "dirB/Foo.hs"
liftIO $ copyTestDataFiles dir "rootUri"
bSource <- liftIO $ readFileUtf8 bPath