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

Commit 2a2de61

Browse files
authored
Merge pull request #1584 from jneira/azure-stack-root
Azure builds improvements: * Tests * Fix a intermittent failing test in FunctionalLiquidSpec due to interleaved diagnostics responses from the server * Add to CabalHelperSpec a test to check explicitly that stackand cabal are in $PATH * Azure * Change stack-root to D: cause it seems the C: drive of azure agents is almost full
2 parents f954497 + 9b37518 commit 2a2de61

8 files changed

+22
-33
lines changed

.azure/linux-stack.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ jobs:
3030
steps:
3131
- task: Cache@2
3232
inputs:
33-
key: '"stack-root" | "$(Agent.OS)" | $(Build.SourcesDirectory)/$(YAML_FILE)'
33+
key: '"stack" | "$(Agent.OS)" | $(Build.SourcesDirectory)/$(YAML_FILE)'
3434
path: .azure-cache
3535
cacheHitVar: CACHE_RESTORED
3636
displayName: "Download cache"

.azure/macos-stack.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ jobs:
2626
steps:
2727
- task: Cache@2
2828
inputs:
29-
key: '"stack-root" | "$(Agent.OS)" | $(Build.SourcesDirectory)/$(YAML_FILE)'
29+
key: '"stack" | "$(Agent.OS)" | $(Build.SourcesDirectory)/$(YAML_FILE)'
3030
path: .azure-cache
3131
cacheHitVar: CACHE_RESTORED
3232
displayName: "Download cache"

.azure/windows-installhs-stack.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ jobs:
55
vmImage: windows-2019
66
variables:
77
YAML_FILE: install/shake.yaml
8-
STACK_ROOT: "C:\\sr"
8+
STACK_ROOT: "D:\\sr"
99
steps:
1010
- bash: |
1111
curl -sSkL http://www.stackage.org/stack/windows-x86_64 -o /usr/bin/stack.zip

.azure/windows-stack.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,12 @@ jobs:
2323
stack-8.4.2:
2424
YAML_FILE: stack-8.4.2.yaml
2525
variables:
26-
STACK_ROOT: "C:\\sr"
26+
STACK_ROOT: "D:\\sr"
2727

2828
steps:
2929
- task: Cache@2
3030
inputs:
31-
key: '"stack-root" | "$(Agent.OS)" | $(Build.SourcesDirectory)/$(YAML_FILE)'
31+
key: '"stack" | "$(Agent.OS)" | $(Build.SourcesDirectory)/$(YAML_FILE)'
3232
path: .azure-cache
3333
cacheHitVar: CACHE_RESTORED
3434
displayName: "Cache stack-root"

azure-pipelines.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
# Build master, branches starting with `azure` and tags commits
22
trigger:
3-
batch: false
43
branches:
54
include:
65
- master

test/functional/DiagnosticsSpec.hs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,14 +24,11 @@ spec = describe "diagnostics providers" $ do
2424
describe "diagnostics triggers" $
2525
it "runs diagnostics on save" $
2626
runSession hieCommandExamplePlugin codeActionSupportCaps "test/testdata" $ do
27-
-- runSessionWithConfig logConfig hieCommandExamplePlugin codeActionSupportCaps "test/testdata" $ do
2827
logm "starting DiagnosticSpec.runs diagnostic on save"
2928
doc <- openDoc "ApplyRefact2.hs" "haskell"
3029

3130
diags@(reduceDiag:_) <- waitForDiagnostics
3231

33-
-- liftIO $ show diags `shouldBe` ""
34-
3532
liftIO $ do
3633
length diags `shouldBe` 2
3734
reduceDiag ^. LSP.range `shouldBe` Range (Position 1 0) (Position 1 12)

test/functional/FunctionalLiquidSpec.hs

Lines changed: 8 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -21,46 +21,31 @@ spec :: Spec
2121
spec = describe "liquid haskell diagnostics" $ do
2222
it "runs diagnostics on save, no liquid" $
2323
runSession hieCommandExamplePlugin codeActionSupportCaps "test/testdata" $ do
24-
-- runSessionWithConfig logConfig hieCommandExamplePlugin codeActionSupportCaps "test/testdata" $ do
2524
doc <- openDoc "liquid/Evens.hs" "haskell"
2625

2726
diags@(reduceDiag:_) <- waitForDiagnostics
2827

29-
-- liftIO $ show diags `shouldBe` ""
30-
-- liftIO $ putStrLn "a"
31-
3228
liftIO $ do
3329
length diags `shouldBe` 2
3430
reduceDiag ^. range `shouldBe` Range (Position 5 18) (Position 5 22)
3531
reduceDiag ^. severity `shouldBe` Just DsHint
3632
reduceDiag ^. code `shouldBe` Just (StringValue "Use negate")
3733
reduceDiag ^. source `shouldBe` Just "hlint"
3834

39-
-- liftIO $ putStrLn "b"
40-
4135
diags2hlint <- waitForDiagnostics
42-
-- liftIO $ putStrLn "c"
43-
-- liftIO $ show diags2hlint `shouldBe` ""
36+
4437
liftIO $ length diags2hlint `shouldBe` 2
4538

46-
-- docItem <- getDocItem file languageId
4739
sendNotification TextDocumentDidSave (DidSaveTextDocumentParams doc)
4840

49-
-- diags2liquid <- waitForDiagnostics
50-
-- liftIO $ putStrLn "d"
51-
-- liftIO $ length diags2liquid `shouldBe` 3
52-
-- -- liftIO $ show diags2liquid `shouldBe` ""
53-
54-
diags3@(d:_) <- waitForDiagnostics
55-
-- liftIO $ putStrLn "e"
56-
-- liftIO $ show diags3 `shouldBe` ""
41+
diags3@(d:_) <- waitForDiagnosticsSource "eg2"
42+
5743
liftIO $ do
58-
length diags3 `shouldBe` 3
59-
d ^. range `shouldBe` Range (Position 0 0) (Position 1 0)
60-
d ^. severity `shouldBe` Nothing
61-
d ^. code `shouldBe` Nothing
62-
d ^. source `shouldBe` Just "eg2"
63-
d ^. message `shouldBe` (T.pack "Example plugin diagnostic, triggered byDiagnosticOnSave")
44+
length diags3 `shouldBe` 1
45+
d ^. LSP.range `shouldBe` Range (Position 0 0) (Position 1 0)
46+
d ^. LSP.severity `shouldBe` Nothing
47+
d ^. LSP.code `shouldBe` Nothing
48+
d ^. LSP.message `shouldBe` T.pack "Example plugin diagnostic, triggered byDiagnosticOnSave"
6449

6550
-- ---------------------------------
6651

test/unit/CabalHelperSpec.hs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
{-# LANGUAGE OverloadedStrings #-}
22
module CabalHelperSpec where
33

4+
import Data.Maybe (isJust)
45
import Haskell.Ide.Engine.Cradle
56
import Test.Hspec
67
import System.FilePath
7-
import System.Directory (getCurrentDirectory, removeFile)
8+
import System.Directory (findExecutable, getCurrentDirectory, removeFile)
89
import TestUtils
910

1011
rootPath :: FilePath -> FilePath
@@ -27,6 +28,13 @@ simpleStackPath cwd = rootPath cwd </> "simple-stack"
2728

2829
spec :: Spec
2930
spec = beforeAll_ setupStackFiles $ do
31+
describe "stack and cabal executables should be accesible" $ do
32+
it "cabal is accesible" $ do
33+
stack <- findExecutable "cabal"
34+
stack `shouldSatisfy` isJust
35+
it "stack is accesible" $ do
36+
cabal <- findExecutable "stack"
37+
cabal `shouldSatisfy` isJust
3038
describe "cabal-helper spec" $ do
3139
describe "find cabal entry point spec" findCabalHelperEntryPointSpec
3240
describe "cradle discovery" cabalHelperCradleSpec

0 commit comments

Comments
 (0)