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

Get tests working on windows #713

Closed
lukel97 opened this issue Jul 24, 2018 · 16 comments · Fixed by lukel97/lsp-test#44
Closed

Get tests working on windows #713

lukel97 opened this issue Jul 24, 2018 · 16 comments · Fixed by lukel97/lsp-test#44

Comments

@lukel97
Copy link
Collaborator

lukel97 commented Jul 24, 2018

Currently stack test fails on windows due to a plethora of errors, so it has been turned off in our AppVeyor builds. (haskell-lsp-test will probably need to be fixed for it)

@fendor
Copy link
Collaborator

fendor commented Jan 11, 2019

Do the tests explicitly fail or not terminate? Because currently they do not terminate.

@lukel97
Copy link
Collaborator Author

lukel97 commented Jan 11, 2019

I am not sure. As far as I'm aware lsp-test builds but doesn't work at runtime on Windows lukel97/lsp-test#28

@jneira
Copy link
Member

jneira commented Jun 21, 2019

I am taking a look at this, in both local and appveyor env (with this branch: https://github.com/jneira/haskell-ide-engine/blob/appveyor/appveyor.yml).

@alanz
Copy link
Collaborator

alanz commented Jun 21, 2019

@jneira There is also an effort to get this working in Azure, which may be the preferred long-term CI.

See #1238

@jneira
Copy link
Member

jneira commented Jun 21, 2019

@alanz thanks for pointed it out!

@jneira
Copy link
Member

jneira commented Jun 25, 2019

Hi, i am starting to analyze the tests in windows, and the unit ones are failing for me:

Failures:

  test/unit\LiquidSpec.hs:50:7:
  1) Liquid, liquid haskell plugin, gets annot file paths
       expected: "D:\\dev\\ws\\haskell\\haskell-ide-engine\\test/testdata/liquid/.liquid/Evens.hs.vim.annot"
        but got: "D:\\dev\\ws\\haskell\\haskell-ide-engine\\test\\testdata\\liquid\\.liquid\\Evens.hs.vim.annot"

  To rerun use: --match "/Liquid/liquid haskell plugin/gets annot file paths/"

  test/unit\LiquidSpec.hs:55:5:
  2) Liquid, liquid haskell plugin, reads errors from json file
       uncaught exception: IOException of type NoSuchThing
       D:\dev\ws\haskell\haskell-ide-engine\test\testdata\liquid\.liquid\Evens.hs.json: openBinaryFile: does not exist (No such file or directory)

  To rerun use: --match "/Liquid/liquid haskell plugin/reads errors from json file/"

  test/unit\LiquidSpec.hs:94:5:
  3) Liquid, liquid haskell plugin, reads types from vim.annot file
       uncaught exception: IOException of type NoSuchThing
       D:\dev\ws\haskell\haskell-ide-engine\test\testdata\liquid\.liquid\Evens.hs.vim.annot: openFile: does not exist (No such file or directory)

  To rerun use: --match "/Liquid/liquid haskell plugin/reads types from vim.annot file/"

  test\unit\LiquidSpec.hs:111:7:
  4) Liquid, liquid haskell plugin, reads types from vim.annot file 2
       uncaught exception: IOException of type UserError
       user error (Pattern match failure in do expression at test\unit\LiquidSpec.hs:111:7-13)

  To rerun use: --match "/Liquid/liquid haskell plugin/reads types from vim.annot file 2/"

I have liquid and z3 installed and i exeuted the test in mingw64

@jneira
Copy link
Member

jneira commented Jun 26, 2019

Not sure if it is related but liquid test/testdata/liquid/Even.hs fails with

realgcc.exe: fatal error: no input files
compilation terminated.
LiquidHaskell Version 0.8.2.4
Copyright 2013-18 Regents of the University of California. All Rights Reserved.

liquid.exe: `gcc.exe' failed in phase `gcc'. (Exit code: 1)

@jneira
Copy link
Member

jneira commented Jun 26, 2019

I've tried to build liquidhaskell from source but i've got another error, opened ucsd-progsys/liquidhaskell#1527

@jneira
Copy link
Member

jneira commented Jun 26, 2019

In the bright side, wrapper-test, dispatcher-test and plugin-dispatcher-test suites pass all tests

@jneira
Copy link
Member

jneira commented Jun 26, 2019

After installing z3 from https://github.com/Z3Prover/z3/releases/download/Z3-4.8.5/z3-4.8.5-x64-win.zip
liquidhaskell is able to generate its files under .liquid and the failures of unit-test have change to:

Failures:

  test/unit\LiquidSpec.hs:50:7:
  1) Liquid, liquid haskell plugin, gets annot file paths
       expected: "D:\\ws\\haskell\\haskell-ide-engine\\test/testdata/liquid/.liquid/Evens.hs.vim.annot"
        but got: "D:\\ws\\haskell\\haskell-ide-engine\\test\\testdata\\liquid\\.liquid\\Evens.hs.vim.annot"

  To rerun use: --match "/Liquid/liquid haskell plugin/gets annot file paths/"

  test/unit\LiquidSpec.hs:63:7:
  2) Liquid, liquid haskell plugin, reads errors from json file
       expected: LP {line = 9, column = 8}
        but got: LP {line = 9, column = 12}

  To rerun use: --match "/Liquid/liquid haskell plugin/reads errors from json file/"

  test/unit\LiquidSpec.hs:100:7:
  3) Liquid, liquid haskell plugin, reads types from vim.annot file
       expected: [LE {start = LP {line = 1, column = 1}, stop = LP {line = 1, column = 1}, message = "GHC.Types.Module"},LE {start = LP {line = 6, column = 1}, stop = LP {line = 6, column = 10}, message = "[{v : GHC.Types.Int | v mod 2 == 0}]"}]
        but got: [LE {start = LP {line = 1, column = 1}, stop = LP {line = 1, column = 1}, message = "GHC.Types.Module"},LE {start = LP {line = 6, column = 1}, stop = LP {line = 6, column = 10}, message = "[{VV : GHC.Types.Int | VV mod 2 == 0}]"}]

  To rerun use: --match "/Liquid/liquid haskell plugin/reads types from vim.annot file/"

  test/unit\LiquidSpec.hs:112:7:
  4) Liquid, liquid haskell plugin, reads types from vim.annot file 2
       expected: [LE {start = LP {line = 1, column = 1}, stop = LP {line = 1, column = 1}, message = "GHC.Types.Module"},LE {start = LP {line = 6, column = 1}, stop = LP {line = 6, column = 10}, message = "[{v : GHC.Types.Int | v mod 2 == 0}]"}]
        but got: [LE {start = LP {line = 1, column = 1}, stop = LP {line = 1, column = 1}, message = "GHC.Types.Module"},LE {start = LP {line = 6, column = 1}, stop = LP {line = 6, column = 10}, message = "[{VV : GHC.Types.Int | VV mod 2 == 0}]"}]

  To rerun use: --match "/Liquid/liquid haskell plugin/reads types from vim.annot file 2/"

The results are very close and the first one seems to be easily fixed normalizing paths.

@jneira
Copy link
Member

jneira commented Jun 26, 2019

The other errors maybe are caused by the liquidhaskell version i had to use in windows (built from master), the actual version used by hie is the lastest one in hackage (0.8.2.4) and it fails for me with ucsd-progsys/liquidhaskell#1177

@jneira
Copy link
Member

jneira commented Jun 28, 2019

Well, the hard part is the func-test suite, that doesn't terminate. I've executed it killing the hie proccess each time it stalled. The output is here.
The resume is that all failing tests makes the hie proccess hang (or the other way around?).
Some of them logs an uncaught exception but all reach the predicate being tested:

  • Failing test
    • [1] FunctionalCodeActions > rename suggestions > works
    • [2] FunctionalCodeActions > rename suggestions > doesn't give both documentChanges and changes
    • [3,4,5,6,7,8,9] FunctionalCodeActions > import suggestions > formats with brittany
    • [10,11,12,13,14,15,16] FunctionalCodeActions > import suggestions > formats with floskell
    • [17,18,19] FunctionalCodeActions > add package suggestions
    • [20,21] FunctionalCodeActions > redundant import code actions
    • [22] FunctionalCodeActions > typed hole code actions > works
    • [23] FunctionalCodeActions > unused term code actions > Prefixes with '_'
    • [24] FunctionalLiquid > liquid haskell diagnostics > runs diagnostics on save, with liquid haskell
  • Failing test with explicit exceptions:
    • [5,6,8,9] FunctionalCodeActions, code actions, import suggestions, formats with brittany
    • [10,12,13,15,16] FunctionalCodeActions > import suggestions > formats with floskell

So next steps could be:

  • Investigate and fix the hie hangs
  • Maybe check if the failing test features really work in windows using a editor
  • Fix the bugs!

@jneira
Copy link
Member

jneira commented Jun 28, 2019

I've got to run succesfully the unit-test suite, installing liquidhaskell-0.8.2.4 and z3-4.8.5-x64-win in windows 10. I had to to make ghc-8.2.1 use gcc of ghc-8.4.2 to get it working (see ucsd-progsys/liquidhaskell#1177 (comment)). I am afraid it will be difficult to apply in ci.
So only left func-test!

image

@jneira
Copy link
Member

jneira commented Jul 5, 2019

I've tested manually in vscode some of the func-test fails and i am afraid they are legitimate bugs in hie itself (and no errors caused by the hang or internal error of the test suite):

  • Rename suggestion deletes the actual symbol but no replaces it with the correct one
  • Import suggestion adds Import module Control.Monad (<0>when) instead Import module Control.Monad (when)
  • ...

I'll try first to avoid the hang and then i'll fill issues for each bug (or one for all of them)

@fendor
Copy link
Collaborator

fendor commented Jul 5, 2019

The second should be easy to fix, I think I can provide a bug fix for it soon.

@jneira
Copy link
Member

jneira commented Jul 9, 2019

I've get to avoid no termination on failing tests changing lsp-test: lukel97/lsp-test#44

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants