Skip to content
This repository was archived by the owner on Oct 7, 2020. It is now read-only.

Commit cf025df

Browse files
authored
Enable all working test suites and add linux-cabal job in Azure (#1571)
* Enabled test-suites: * Linux, with stack or cabal, all test suites are enabled * Macos: * ghc-8.6.*: all suites enabled * ghc-8.4.*: func-test and dispatcher-test disabled * Windows * unit-test enabled * Except CabalHelper ones for ghc-8.6.4 * func-test enabled with almost all tests * cabal job: * Aadded one for linux Make progress towards #1401 Closes #1431
1 parent 3b38880 commit cf025df

10 files changed

+136
-36
lines changed

.azure/linux-cabal.bashrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export PATH=$HOME/.cabal/bin:/opt/cabal/$CABAL_VERSION/bin:/opt/ghc/$GHC_VERSION/bin:$HOME/.local/bin:$PATH

.azure/linux-cabal.yml

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
jobs:
2+
- job: Linux_Cabal
3+
timeoutInMinutes: 0
4+
pool:
5+
vmImage: ubuntu-16.04
6+
strategy:
7+
matrix:
8+
ghc-8.6.5:
9+
GHC_VERSION: "8.6.5"
10+
ghc-8.4.4:
11+
GHC_VERSION: "8.4.4"
12+
variables:
13+
CABAL_VERSION: "3.0"
14+
steps:
15+
- task: Cache@2
16+
inputs:
17+
key: '"cabal-store" | "$(Agent.OS)" | "$(CABAL_VERSION)" | "$(GHC_VERSION)" | $(Build.SourcesDirectory)/cabal.project | $(Build.SourcesDirectory)/haskell-ide-engine.cabal | $(Build.SourcesDirectory)/hie-plugin-api/hie-plugin-api.cabal'
18+
path: .azure-cache
19+
cacheHitVar: CACHE_RESTORED
20+
displayName: "Download cache"
21+
- bash: |
22+
mkdir -p $HOME/.cabal
23+
tar -vxzf .azure-cache/cabal-root.tar.gz -C /
24+
mkdir -p $HOME/.ghc
25+
tar -vxzf .azure-cache/ghc-root.tar.gz -C /
26+
mkdir -p dist-newtyle
27+
tar -vxzf .azure-cache/cabal-dist.tar.gz
28+
displayName: "Unpack cache"
29+
condition: eq(variables.CACHE_RESTORED, 'true')
30+
- bash: |
31+
git submodule sync
32+
git submodule update --init
33+
displayName: Sync submodules
34+
- bash: |
35+
source .azure/linux-cabal.bashrc
36+
cabal v2-update
37+
cabal v2-build --only-dependencies
38+
displayName: Build dependencies
39+
- bash: |
40+
source .azure/linux-cabal.bashrc
41+
cabal v2-build
42+
displayName: Build `hie`
43+
- bash: |
44+
source .azure/linux-cabal.bashrc
45+
cabal v2-install --overwrite-policy=always # `hie` binary required locally for tests
46+
displayName: Install `hie`
47+
- bash: |
48+
source .azure/linux-cabal.bashrc
49+
cabal v2-build --enable-tests --enable-benchmarks --only-dependencies
50+
displayName: Build Test-dependencies
51+
- bash: |
52+
sudo apt update
53+
sudo apt install z3
54+
displayName: "Install Runtime Test-Dependencies: z3"
55+
- bash: |
56+
source .azure/linux-cabal.bashrc
57+
# to not reinstall hie
58+
cd $(Agent.TempDirectory)
59+
cabal v2-install liquidhaskell-0.8.6.2 -w /opt/ghc/8.6.5/bin/ghc --overwrite-policy=always
60+
displayName: "Install Runtime Test-Dependencies: liquidhaskell"
61+
- bash: |
62+
source .azure/linux-cabal.bashrc
63+
cabal v2-build hoogle
64+
cabal v2-exec hoogle generate
65+
displayName: "Install Runtime Test-Dependencies: hoogle database"
66+
- bash: |
67+
source .azure/linux-cabal.bashrc
68+
# TODO: Investigate why the test suite can't be run in parallel
69+
cabal v2-test -j1
70+
displayName: Run Test
71+
- bash: |
72+
mkdir -p .azure-cache
73+
tar -vczf .azure-cache/cabal-root.tar.gz $HOME/.cabal
74+
tar -vczf .azure-cache/ghc-root.tar.gz $HOME/.ghc
75+
tar -vczf .azure-cache/cabal-dist.tar.gz dist-newstyle
76+
displayName: "Pack cache"
File renamed without changes.

.azure/linux-stack.yml

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -48,19 +48,19 @@ jobs:
4848
tar vxz --wildcards --strip-components=1 -C ~/.local/bin '*/stack'
4949
displayName: Install stack
5050
- bash: |
51-
source .azure/linux.bashrc
51+
source .azure/linux-stack.bashrc
5252
stack setup --stack-yaml $(YAML_FILE)
5353
displayName: Install GHC
5454
- bash: |
55-
source .azure/linux.bashrc
55+
source .azure/linux-stack.bashrc
5656
stack --stack-yaml $(YAML_FILE) --install-ghc build --only-dependencies
5757
displayName: Build dependencies
5858
- bash: |
59-
source .azure/linux.bashrc
59+
source .azure/linux-stack.bashrc
6060
stack build --stack-yaml $(YAML_FILE)
6161
displayName: Build `hie`
6262
- bash: |
63-
source .azure/linux.bashrc
63+
source .azure/linux-stack.bashrc
6464
stack install --stack-yaml $(YAML_FILE) # `hie` binary required locally for tests
6565
mkdir .azure-deploy
6666
stack install --stack-yaml $(YAML_FILE) --local-bin-path .azure-deploy
@@ -80,26 +80,28 @@ jobs:
8080
tar -vczf $(Build.ArtifactStagingDirectory)/$ARTIFACT_NAME.tar.xz *
8181
displayName: Install `hie`
8282
- bash: |
83-
source .azure/linux.bashrc
83+
source .azure/linux-stack.bashrc
8484
stack build --stack-yaml $(YAML_FILE) --test --bench --only-dependencies
8585
displayName: Build Test-dependencies
8686
- bash: |
8787
sudo apt update
8888
sudo apt install z3
8989
displayName: "Install Runtime Test-Dependencies: z3"
9090
- bash: |
91-
source .azure/linux.bashrc
92-
stack install --resolver=lts-11.18 liquid-fixpoint-0.7.0.7 dotgen-0.4.2 fgl-visualize-0.1.0.1 located-base-0.1.1.1 liquidhaskell-0.8.2.4
91+
source .azure/linux-stack.bashrc
92+
stack install --resolver=lts-13.20 liquid-fixpoint-0.8.0.2 liquidhaskell-0.8.6.2
9393
displayName: "Install Runtime Test-Dependencies: liquidhaskell"
9494
- bash: |
95-
source .azure/linux.bashrc
95+
source .azure/linux-stack.bashrc
9696
stack build hoogle --stack-yaml=$(YAML_FILE)
9797
stack exec hoogle generate --stack-yaml=$(YAML_FILE)
9898
displayName: "Install Runtime Test-Dependencies: hoogle database"
99-
# - bash: |
100-
# source .azure/linux.bashrc
101-
# stack test --stack-yaml $(YAML_FILE)
102-
# displayName: Run Test
99+
- bash: |
100+
source .azure/linux-stack.bashrc
101+
# cabal is also a test runtime dependency
102+
export PATH=/opt/cabal/3.0/bin:$PATH
103+
stack test --stack-yaml $(YAML_FILE)
104+
displayName: Run Test
103105
- task: PublishBuildArtifacts@1
104106
inputs:
105107
pathtoPublish: '$(Build.ArtifactStagingDirectory)'

.azure/macos-stack.yml

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -88,17 +88,27 @@ jobs:
8888
displayName: "Install Runtime Test-Dependencies: z3"
8989
- bash: |
9090
source .azure/macos.bashrc
91-
stack install --resolver=lts-11.18 liquid-fixpoint-0.7.0.7 dotgen-0.4.2 fgl-visualize-0.1.0.1 located-base-0.1.1.1 liquidhaskell-0.8.2.4
91+
stack install --resolver=lts-13.20 liquid-fixpoint-0.8.0.2 liquidhaskell-0.8.6.2
9292
displayName: "Install Runtime Test-Dependencies: liquidhaskell"
9393
- bash: |
9494
source .azure/macos.bashrc
9595
stack build hoogle --stack-yaml=$(YAML_FILE)
9696
stack exec hoogle generate --stack-yaml=$(YAML_FILE)
9797
displayName: "Install Runtime Test-Dependencies: hoogle database"
98-
# - bash: |
99-
# source .azure/macos.bashrc
100-
# stack test --stack-yaml $(YAML_FILE)
101-
# displayName: Run Test
98+
- bash: |
99+
source .azure/macos.bashrc
100+
brew install cabal-install
101+
displayName: "Install Runtime Test-Dependencies: cabal"
102+
- bash: |
103+
source .azure/macos.bashrc
104+
GHC_MAJOR_VERSION=${YAML_FILE:6:3}
105+
if [ $GHC_MAJOR_VERSION != "8.4" ]; then
106+
stack test --stack-yaml $(YAML_FILE)
107+
else
108+
#TODO Enable dispatcher-test and func-test for ghc-8.4.*
109+
stack test --stack-yaml $(YAML_FILE) :unit-test :plugin-dispatcher-test :wrapper-test
110+
fi
111+
displayName: Run Test
102112
- task: PublishBuildArtifacts@1
103113
inputs:
104114
pathtoPublish: '$(Build.ArtifactStagingDirectory)'

.azure/windows-installhs-stack.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,5 +29,6 @@ jobs:
2929
displayName: Run help of `install.hs`
3030
- bash: |
3131
source .azure/windows.bashrc
32-
stack install.hs latest
32+
# Some executions fails with spurious errors installing the exe
33+
stack install.hs latest || stack install.hs latest
3334
displayName: Run latest target of `install.hs`

.azure/windows-stack.yml

Lines changed: 21 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -90,18 +90,33 @@ jobs:
9090
displayName: "Install Runtime Test-Dependencies: z3"
9191
- bash: |
9292
source .azure/windows.bashrc
93-
stack install --resolver=lts-11.18 liquid-fixpoint-0.7.0.7 dotgen-0.4.2 fgl-visualize-0.1.0.1 located-base-0.1.1.1 liquidhaskell-0.8.2.4
94-
liquid -v
93+
stack install --resolver=lts-13.20 liquid-fixpoint-0.8.0.2 liquidhaskell-0.8.6.2
9594
displayName: "Install Runtime Test-Dependencies: liquidhaskell"
9695
- bash: |
9796
source .azure/windows.bashrc
9897
stack build hoogle --stack-yaml=$(YAML_FILE)
9998
stack exec hoogle generate --stack-yaml=$(YAML_FILE)
10099
displayName: "Install Runtime Test-Dependencies: hoogle database"
101-
# - bash: |
102-
# source .azure/windows.bashrc
103-
# stack test --stack-yaml $(YAML_FILE) :unit-test
104-
# displayName: Run Test
100+
- bash: |
101+
source .azure/windows.bashrc
102+
choco install cabal
103+
/C/ProgramData/chocolatey/bin/RefreshEnv.cmd
104+
displayName: "Install Runtime Test-Dependencies: cabal"
105+
- bash: |
106+
source .azure/windows.bashrc
107+
# TODO: Enable CabalHelper unit tests, see https://github.com/DanielG/cabal-helper/issues/91
108+
if [ $YAML_FILE = "stack-8.6.4.yaml" ]; then
109+
TEST_ARGS=--test-arguments="--skip=CabalHelper"
110+
fi
111+
# TODO: Enable rest of test suites
112+
stack test --stack-yaml $(YAML_FILE) :unit-test :plugin-dispatcher-test $TEST_ARGS # :dispatcher-test :wrapper-test
113+
# TODO: Enable failing functional test
114+
if [ $YAML_FILE != "stack-8.6.4.yaml" ]; then
115+
stack test --stack-yaml $(YAML_FILE) :func-test
116+
else
117+
stack test --stack-yaml $(YAML_FILE) :func-test --ta="--skip \"/Hover/hover/works\""
118+
fi
119+
displayName: Run Test
105120
- task: PublishBuildArtifacts@1
106121
inputs:
107122
pathtoPublish: '$(Build.ArtifactStagingDirectory)'

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636
/docs/source/__pycache__/
3737
/docs/source/plugins/
3838
/elisp/.cask/
39+
/test/testdata/*.exe
3940
/test/testdata/FuncTest.refactored.hs
4041
/test/testdata/HaReAddRmParam.refactored.hs
4142
/test/testdata/HaReCase.refactored.hs

azure-pipelines.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ pr:
2626

2727
jobs:
2828
- template: ./.azure/linux-stack.yml
29+
- template: ./.azure/linux-cabal.yml
2930
- template: ./.azure/windows-stack.yml
3031
- template: ./.azure/macos-stack.yml
3132
- template: ./.azure/linux-installhs-stack.yml

test/functional/DiagnosticsSpec.hs

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -40,25 +40,18 @@ spec = describe "diagnostics providers" $ do
4040
reduceDiag ^. LSP.source `shouldBe` Just "hlint"
4141

4242
diags2a <- waitForDiagnostics
43-
-- liftIO $ show diags2a `shouldBe` ""
43+
4444
liftIO $ length diags2a `shouldBe` 2
4545

46-
-- docItem <- getDocItem file languageId
4746
sendNotification TextDocumentDidSave (DidSaveTextDocumentParams doc)
48-
-- diags2hlint <- waitForDiagnostics
49-
-- -- liftIO $ show diags2hlint `shouldBe` ""
50-
-- liftIO $ length diags2hlint `shouldBe` 3
51-
-- diags2liquid <- waitForDiagnostics
52-
-- liftIO $ length diags2liquid `shouldBe` 3
53-
-- -- liftIO $ show diags2 `shouldBe` ""
54-
diags3@(d:_) <- waitForDiagnostics
55-
-- liftIO $ show diags3 `shouldBe` ""
47+
48+
diags3@(d:_) <- waitForDiagnosticsSource "eg2"
49+
5650
liftIO $ do
57-
length diags3 `shouldBe` 3
51+
length diags3 `shouldBe` 1
5852
d ^. LSP.range `shouldBe` Range (Position 0 0) (Position 1 0)
5953
d ^. LSP.severity `shouldBe` Nothing
6054
d ^. LSP.code `shouldBe` Nothing
61-
d ^. LSP.source `shouldBe` Just "eg2"
6255
d ^. LSP.message `shouldBe` T.pack "Example plugin diagnostic, triggered byDiagnosticOnSave"
6356

6457
describe "typed hole errors" $

0 commit comments

Comments
 (0)