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

Commit

Permalink
Merge pull request #1584 from jneira/azure-stack-root
Browse files Browse the repository at this point in the history
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
  • Loading branch information
jneira authored Jan 21, 2020
2 parents f954497 + 9b37518 commit 2a2de61
Show file tree
Hide file tree
Showing 8 changed files with 22 additions and 33 deletions.
2 changes: 1 addition & 1 deletion .azure/linux-stack.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ jobs:
steps:
- task: Cache@2
inputs:
key: '"stack-root" | "$(Agent.OS)" | $(Build.SourcesDirectory)/$(YAML_FILE)'
key: '"stack" | "$(Agent.OS)" | $(Build.SourcesDirectory)/$(YAML_FILE)'
path: .azure-cache
cacheHitVar: CACHE_RESTORED
displayName: "Download cache"
Expand Down
2 changes: 1 addition & 1 deletion .azure/macos-stack.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
steps:
- task: Cache@2
inputs:
key: '"stack-root" | "$(Agent.OS)" | $(Build.SourcesDirectory)/$(YAML_FILE)'
key: '"stack" | "$(Agent.OS)" | $(Build.SourcesDirectory)/$(YAML_FILE)'
path: .azure-cache
cacheHitVar: CACHE_RESTORED
displayName: "Download cache"
Expand Down
2 changes: 1 addition & 1 deletion .azure/windows-installhs-stack.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ jobs:
vmImage: windows-2019
variables:
YAML_FILE: install/shake.yaml
STACK_ROOT: "C:\\sr"
STACK_ROOT: "D:\\sr"
steps:
- bash: |
curl -sSkL http://www.stackage.org/stack/windows-x86_64 -o /usr/bin/stack.zip
Expand Down
4 changes: 2 additions & 2 deletions .azure/windows-stack.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,12 @@ jobs:
stack-8.4.2:
YAML_FILE: stack-8.4.2.yaml
variables:
STACK_ROOT: "C:\\sr"
STACK_ROOT: "D:\\sr"

steps:
- task: Cache@2
inputs:
key: '"stack-root" | "$(Agent.OS)" | $(Build.SourcesDirectory)/$(YAML_FILE)'
key: '"stack" | "$(Agent.OS)" | $(Build.SourcesDirectory)/$(YAML_FILE)'
path: .azure-cache
cacheHitVar: CACHE_RESTORED
displayName: "Cache stack-root"
Expand Down
1 change: 0 additions & 1 deletion azure-pipelines.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
# Build master, branches starting with `azure` and tags commits
trigger:
batch: false
branches:
include:
- master
Expand Down
3 changes: 0 additions & 3 deletions test/functional/DiagnosticsSpec.hs
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,11 @@ spec = describe "diagnostics providers" $ do
describe "diagnostics triggers" $
it "runs diagnostics on save" $
runSession hieCommandExamplePlugin codeActionSupportCaps "test/testdata" $ do
-- runSessionWithConfig logConfig hieCommandExamplePlugin codeActionSupportCaps "test/testdata" $ do
logm "starting DiagnosticSpec.runs diagnostic on save"
doc <- openDoc "ApplyRefact2.hs" "haskell"

diags@(reduceDiag:_) <- waitForDiagnostics

-- liftIO $ show diags `shouldBe` ""

liftIO $ do
length diags `shouldBe` 2
reduceDiag ^. LSP.range `shouldBe` Range (Position 1 0) (Position 1 12)
Expand Down
31 changes: 8 additions & 23 deletions test/functional/FunctionalLiquidSpec.hs
Original file line number Diff line number Diff line change
Expand Up @@ -21,46 +21,31 @@ spec :: Spec
spec = describe "liquid haskell diagnostics" $ do
it "runs diagnostics on save, no liquid" $
runSession hieCommandExamplePlugin codeActionSupportCaps "test/testdata" $ do
-- runSessionWithConfig logConfig hieCommandExamplePlugin codeActionSupportCaps "test/testdata" $ do
doc <- openDoc "liquid/Evens.hs" "haskell"

diags@(reduceDiag:_) <- waitForDiagnostics

-- liftIO $ show diags `shouldBe` ""
-- liftIO $ putStrLn "a"

liftIO $ do
length diags `shouldBe` 2
reduceDiag ^. range `shouldBe` Range (Position 5 18) (Position 5 22)
reduceDiag ^. severity `shouldBe` Just DsHint
reduceDiag ^. code `shouldBe` Just (StringValue "Use negate")
reduceDiag ^. source `shouldBe` Just "hlint"

-- liftIO $ putStrLn "b"

diags2hlint <- waitForDiagnostics
-- liftIO $ putStrLn "c"
-- liftIO $ show diags2hlint `shouldBe` ""

liftIO $ length diags2hlint `shouldBe` 2

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

-- diags2liquid <- waitForDiagnostics
-- liftIO $ putStrLn "d"
-- liftIO $ length diags2liquid `shouldBe` 3
-- -- liftIO $ show diags2liquid `shouldBe` ""

diags3@(d:_) <- waitForDiagnostics
-- liftIO $ putStrLn "e"
-- liftIO $ show diags3 `shouldBe` ""
diags3@(d:_) <- waitForDiagnosticsSource "eg2"

liftIO $ do
length diags3 `shouldBe` 3
d ^. range `shouldBe` Range (Position 0 0) (Position 1 0)
d ^. severity `shouldBe` Nothing
d ^. code `shouldBe` Nothing
d ^. source `shouldBe` Just "eg2"
d ^. message `shouldBe` (T.pack "Example plugin diagnostic, triggered byDiagnosticOnSave")
length diags3 `shouldBe` 1
d ^. LSP.range `shouldBe` Range (Position 0 0) (Position 1 0)
d ^. LSP.severity `shouldBe` Nothing
d ^. LSP.code `shouldBe` Nothing
d ^. LSP.message `shouldBe` T.pack "Example plugin diagnostic, triggered byDiagnosticOnSave"

-- ---------------------------------

Expand Down
10 changes: 9 additions & 1 deletion test/unit/CabalHelperSpec.hs
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
{-# LANGUAGE OverloadedStrings #-}
module CabalHelperSpec where

import Data.Maybe (isJust)
import Haskell.Ide.Engine.Cradle
import Test.Hspec
import System.FilePath
import System.Directory (getCurrentDirectory, removeFile)
import System.Directory (findExecutable, getCurrentDirectory, removeFile)
import TestUtils

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

spec :: Spec
spec = beforeAll_ setupStackFiles $ do
describe "stack and cabal executables should be accesible" $ do
it "cabal is accesible" $ do
stack <- findExecutable "cabal"
stack `shouldSatisfy` isJust
it "stack is accesible" $ do
cabal <- findExecutable "stack"
cabal `shouldSatisfy` isJust
describe "cabal-helper spec" $ do
describe "find cabal entry point spec" findCabalHelperEntryPointSpec
describe "cradle discovery" cabalHelperCradleSpec
Expand Down

0 comments on commit 2a2de61

Please sign in to comment.