haskell / haskell-ide-engine

The engine for haskell ide-integration. Not an IDE
BSD 3-Clause "New" or "Revised" License
2.38k stars 210 forks source link

HaRe plugin tests fail without cabal-install in PATH #425

Closed shlevy closed 5 years ago

shlevy commented 6 years ago

This causes tests to fail during the build in nixpkgs, where we compile Setup.hs directly instead of using cabal-install in the generic haskell builder.

$ ls ./bin
cabal

$ PATH=$PATH:$PWD/bin ./dist/build/haskell-ide-test/haskell-ide-test --match "(new plugin api), finds" --fail-fast

HaRePlugin
  hare plugin
    hare plugin commands(new plugin api)
      finds definition across components
      finds definition in the same component
      finds local definitions

Finished in 1.6293 seconds
3 examples, 0 failures

$ ./dist/build/haskell-ide-test/haskell-ide-test --match "(new plugin api), finds" 

HaRePlugin
  hare plugin
    hare plugin commands(new plugin api)
      finds definition across components FAILED [1]
      finds definition in the same component FAILED [2]
      finds local definitions FAILED [3]

Failures:

  test/HaRePluginSpec.hs:334: 
  1) HaRePlugin, hare plugin, hare plugin commands(new plugin api), finds definition across components
       expected: Right [Location {_uri = Uri {getUri = "file:///home-persistent/shlevy/src/haskell-ide-engine/test/testdata/gototest/src/Lib.hs"}, _range = Range {_start = Position {_line = 5, _character = 0}, _end = Position {_line = 5, _character = 8}}}]
        but got: Left (IdeRFail (IdeError {ideCode = PluginError, ideMessage = "hare:findDef: \"module not loaded\"", ideInfo = Null}))

  test/HaRePluginSpec.hs:345: 
  2) HaRePlugin, hare plugin, hare plugin commands(new plugin api), finds definition in the same component
       expected: Right [Location {_uri = Uri {getUri = "file:///home-persistent/shlevy/src/haskell-ide-engine/test/testdata/gototest/src/Lib.hs"}, _range = Range {_start = Position {_line = 5, _character = 0}, _end = Position {_line = 5, _character = 8}}}]
        but got: Left (IdeRFail (IdeError {ideCode = PluginError, ideMessage = "hare:findDef: \"module not loaded\"", ideInfo = Null}))

  test/HaRePluginSpec.hs:352: 
  3) HaRePlugin, hare plugin, hare plugin commands(new plugin api), finds local definitions
       expected: Right [Location {_uri = Uri {getUri = "file:///home-persistent/shlevy/src/haskell-ide-engine/test/testdata/gototest/src/Lib2.hs"}, _range = Range {_start = Position {_line = 9, _character = 8}, _end = Position {_line = 9, _character = 9}}}]
        but got: Left (IdeRFail (IdeError {ideCode = PluginError, ideMessage = "hare:findDef: \"module not loaded\"", ideInfo = Null}))

Randomized with seed 778704494

Finished in 0.6071 seconds
3 examples, 3 failures
shlevy commented 6 years ago

Also, while debugging this I noticed a PATH search for stack as well, so presumably the test suite could behave differently depending on if I have stack installed or not.

alanz commented 5 years ago

The current install process via makefile ensures that cabal is available.