-
Notifications
You must be signed in to change notification settings - Fork 61
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add cradle tests #91
Add cradle tests #91
Conversation
What's the best way to setup CI for windows? @jneira ? |
Mmm if travis is already being used i would use it for win too, like lsp-test: https://github.com/bubba/lsp-test/blob/master/.travis.yml |
In the meanwhile i've run the tests locally: PS D:\dev\ws\haskell\hie-bios> cabal test
Resolving dependencies...
Build profile: -w ghc-8.6.5 -O1
In order, the following will be built (use -v for more details):
- hie-bios-0.3.0 (lib) (configuration changed)
- hie-bios-0.3.0 (test:parser-tests) (configuration changed)
- hie-bios-0.3.0 (test:bios-tests) (first run)
Configuring library for hie-bios-0.3.0..
Preprocessing library for hie-bios-0.3.0..
Building library for hie-bios-0.3.0..
[11 of 16] Compiling HIE.Bios.Ghc.Api ( src\HIE\Bios\Ghc\Api.hs, D:\dev\ws\haskell\hie-bios\dist-newstyle\build\x86_64-windows\ghc-8.6.5\hie-bios-0.3.0\build\HIE\Bios\Ghc\Api.o )
[14 of 16] Compiling HIE.Bios.Ghc.Check ( src\HIE\Bios\Ghc\Check.hs, D:\dev\ws\haskell\hie-bios\dist-newstyle\build\x86_64-windows\ghc-8.6.5\hie-bios-0.3.0\build\HIE\Bios\Ghc\Check.o )
[15 of 16] Compiling HIE.Bios.Cradle ( src\HIE\Bios\Cradle.hs, D:\dev\ws\haskell\hie-bios\dist-newstyle\build\x86_64-windows\ghc-8.6.5\hie-bios-0.3.0\build\HIE\Bios\Cradle.o )
[16 of 16] Compiling HIE.Bios ( src\HIE\Bios.hs, D:\dev\ws\haskell\hie-bios\dist-newstyle\build\x86_64-windows\ghc-8.6.5\hie-bios-0.3.0\build\HIE\Bios.o )
Configuring test suite 'parser-tests' for hie-bios-0.3.0..
Configuring test suite 'bios-tests' for hie-bios-0.3.0..
Preprocessing test suite 'parser-tests' for hie-bios-0.3.0..
Building test suite 'parser-tests' for hie-bios-0.3.0..
Preprocessing test suite 'bios-tests' for hie-bios-0.3.0..
Building test suite 'bios-tests' for hie-bios-0.3.0..
[1 of 1] Compiling Main ( tests\BiosTests.hs, D:\dev\ws\haskell\hie-bios\dist-newstyle\build\x86_64-windows\ghc-8.6.5\hie-bios-0.3.0\t\bios-tests\build\bios-tests\bios-tests-tmp\Main.o )
Linking D:\dev\ws\haskell\hie-bios\dist-newstyle\build\x86_64-windows\ghc-8.6.5\hie-bios-0.3.0\t\parser-tests\build\parser-tests\parser-tests.exe ...
Linking D:\dev\ws\haskell\hie-bios\dist-newstyle\build\x86_64-windows\ghc-8.6.5\hie-bios-0.3.0\t\bios-tests\build\bios-tests\bios-tests.exe ...
Running 1 test suites...
Test suite parser-tests: RUNNING...
Test suite parser-tests: PASS
Test suite logged to:
D:\dev\ws\haskell\hie-bios\dist-newstyle\build\x86_64-windows\ghc-8.6.5\hie-bios-0.3.0\t\parser-tests\test\hie-bios-0.3.0-parser-tests.log
1 of 1 test suites (1 of 1 test cases) passed.
Running 1 test suites...
Test suite bios-tests: RUNNING...
Loading tests
simple-cabal: OK (12.20s)
Finding Cradle
Loading Cradle
Initialise Flags (11.56s)
Initial module load (0.57s)
(1,2) (0.05s)
(2,2) (0.02s)
simple-stack: FAIL (2.83s)
Finding Cradle
Loading Cradle
Initialise Flags (2.82s)
Initial module load
bios-tests.exe: can't find a package database at D:\bin\stack\x86_64-windows\ghc-8.6.5\lib\package.conf.d
simple-direct: OK (0.22s)
Finding Cradle
Loading Cradle
Initialise Flags (0.10s)
Initial module load (0.03s)
(1,2) (0.07s)
(2,2) (0.02s)
simple-bios: FAIL (0.15s)
Finding Cradle
Loading Cradle
D:\dev\ws\haskell\hie-bios\tests\projects\simple-bios\hie-bios: streamingProcess: invalid argument (Exec format error)
2 out of 4 tests failed (15.39s)
Test suite bios-tests: FAIL
Test suite logged to:
D:\dev\ws\haskell\hie-bios\dist-newstyle\build\x86_64-windows\ghc-8.6.5\hie-bios-0.3.0\t\bios-tests\test\hie-bios-0.3.0-bios-tests.log
0 of 1 test suites (0 of 1 test cases) passed.
cabal.exe: Tests failed for test:bios-tests from hie-bios-0.3.0. It is catching the same error that #90 (comment) so the test suite works 👍 |
I am trying to add windows support to travis, taking as reference lsp-test. It would be great update haskell-ci to take in account the new travis feature ( |
6084098
to
17c48ed
Compare
380cd74
to
b9d3a1f
Compare
@@ -1,21 +1,27 @@ | |||
Cabal-Version: 2.4 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I might be wrong, but doesnt this force us to build this package with cabal 2.4 at least?
This will break old stack lts snapshots, since they got shipped with older cabal versions. Iirc, it would force hie to drop stack support for GHC versions older than 8.6
.
At least lower the Cabal-Version
to 2.2. What was the problem with 1.1
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You need Cabal-2.4
for tests/projects/**/*.hs
syntax.
# Revision history for simple-cabal | ||
|
||
## 0.1.0.0 -- YYYY-mm-dd | ||
|
||
* First version. Released on an unsuspecting world. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is probably noise and could be removed from the .cabal file and the repo
@@ -0,0 +1,66 @@ | |||
# This file was automatically generated by 'stack init' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this seems like a lonely stack.yaml
does it not have any friends, e.g. source files?
src/HIE/Bios/Cradle.hs
Outdated
@@ -373,7 +373,7 @@ stackAction work_dir l fp = do | |||
-- Same wrapper works as with cabal | |||
wrapper_fp <- getCabalWrapperTool | |||
(ex1, _stdo, stde, args) <- | |||
readProcessWithExitCodeInDirectory l work_dir "stack" ["repl", "--no-load", "--with-ghc", wrapper_fp, fp ] | |||
readProcessWithExitCodeInDirectory l work_dir "stack" ["repl", "--no-nix-pure", "--no-load", "--with-ghc", wrapper_fp, fp ] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
--no-nix-pure
has no impact when nix is not enabled right?
Maybe add a comment that it does not?
@@ -11,6 +11,7 @@ module HIE.Bios ( | |||
-- * Find and load a Cradle | |||
Cradle(..) | |||
, CradleLoadResult(..) | |||
, CradleError(..) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess this fixes the build error in #90?
If I want to add tests, should I open a PR to your PR or push directly to this branch? |
@fendor You can push directly to this branch. I'll make sure not to force push. |
Now all the cradles communicate by reading the value of HIE_BIOS_OUTPUT which is a filepath, and writing the arguments to that temporary file. This makes all the cradles more robust about the build tools spurting things to stdout.
Other changes * Pass `--no-nix-pure` to stack, otherwise it runs the nix-shell with `--pure` which unsets all env vars. * Expose `CradleError` from `HIE.Bios` module * Return the success flag from the initialisation action.
Other changes
--no-nix-pure
to stack, otherwise it runs the nix-shell with--pure
which unsets all env vars.CradleError
fromHIE.Bios
module