Conversation
It is the first one that doesnt terminate in windows
I have to take a look, the tests are failing or showing a stacktrace intermittently |
It seems in windows 7 (my original test env) it works fine, but in windows 10 doesnt. |
Ok, i had to use the shutdown step with its ack to break the server listener loop (sorry for the imperative jargon 😆 ) |
|
@@ -104,7 +104,7 @@ main = hspec $ do | |||
|
|||
it "don't throw when no time out" $ runSessionWithConfig (def {messageTimeout = 5}) "hie" fullCaps "test/data/renamePass" $ do | |||
loggingNotification | |||
liftIO $ threadDelay 10 | |||
liftIO $ threadDelay $ 10 * 1000000 |
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.
@bubba Not sure it it was done intencionally, but test did not terminate in my windows 7 with 10
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.
Yes, I presume I meant to write 10s not 10us!
Thanks so much for helping out with this. I’ll take a closer look at this later this week |
The test of manual js session is failing for linux cause i am trying now to decode effectively the response to examine if it is a
instead the valids for the
or
|
@@ -120,6 +120,7 @@ matchResponseMsgType req = case req of | |||
where decoded x = fromMaybe (error $ "Couldn't decode response for the request type: " | |||
++ show req ++ "\n" ++ show x) | |||
(decode x) | |||
removeNullResult x = maybe x (<> "}") (B.stripSuffix ",\"result\":null}" x) |
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.
An ugly hack to sanitize the response from the manual javascript session
Maybe we should have a generic way to remove fields with null values or change the json encoding to make field:null
= _field=Nothing
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 wouldn't worry about the javascript test too much. This looks like its caused by how haskell-lsp doesn't parse responses with null results (which should probably be fixed at some point). You can just revert this and let the javascript test fail for now
src/Language/Haskell/LSP/Test.hs
Outdated
|
||
-- | Exit the server after request its shutdown | ||
exitServer :: Session() | ||
exitServer = request_ Shutdown (Nothing :: Maybe Value) >> sendNotification Exit ExitParams |
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.
Does this need to be exposed to the API? The server should automatically be exited once the withSession closure finishes
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 had to expose it cause it is used in Language.Haskell.LSP.Test.Replay
.
I think it should be in Session
or in a module upstream, like the server listener handler (their clean up is closely related), and reduce the number of params of runSessionWithHandles
but it would need move quite code (about requests/reponses) from Test
to another module on top of Session
, due to circular dependencies.
@@ -120,6 +120,7 @@ matchResponseMsgType req = case req of | |||
where decoded x = fromMaybe (error $ "Couldn't decode response for the request type: " | |||
++ show req ++ "\n" ++ show x) | |||
(decode x) | |||
removeNullResult x = maybe x (<> "}") (B.stripSuffix ",\"result\":null}" x) |
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 wouldn't worry about the javascript test too much. This looks like its caused by how haskell-lsp doesn't parse responses with null results (which should probably be fixed at some point). You can just revert this and let the javascript test fail for now
I just cleared the windows cache on travis, I've seen that error pop up some times when using the wrong version of hie. Once there's a successful build of windows it should (hopefully) run a lot quicker |
This reverts commit 6f031f5.
I bumped up the version of hie to |
I've executed the hie tests using this pr version of Warming up HIE cache...
HIE cache is warmed up
func-test.exe: terminateProcess: permission denied (Permission denied) |
Otoh i've set up an appveyor build for In a second build i've got the same erorrs than travis one: https://ci.appveyor.com/project/jneira/lsp-test/builds/25934347 |
Although i am able to run the test suite of
|
The tests are a little bit more clear:
|
It's not needed since the captured session should contain it anyway
I've tidied up the exitServer stuff, it shouldn't be needed by the replay module since the captured file should be replaying back the exit request and notification anyway. This PR passes tests for me locally (except for the javascript one, but I've created a PR to fix that haskell/lsp#181) so I'm happy to merge this if you are? |
@bubba well, i am little bit worried for the hie tests in
The first one is easy to fix but not sure about the second, the fix in process involved changing |
I have some problems with cpp conditionals in |
I've need to add |
Ok, i think it could be the last needed change after a bit of yak shaving with I think it is not the correct solution in the general case, cause we are ignoring legitimate Running the hie func-test in azure using this version of lsp-test: https://dev.azure.com/jneira/haskell-ide-engine/_build/results?buildId=185 |
@bubba ok, i think this is done, tests in azure build have failed correctly 😆 |
As |
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.
Tested this out locally and it works great on mac, and the window stuff seems to be in a lot better of a state than it was previously. Thanks for the work on this!
@jneira Thanks a lot for cleaning up the mess that I produced and fixing it! |
Fix non terminating tests in Windows
Exit
message is sent to server process before killing its listener thread to shutdown it gracefully.killThread
call.SessionException
to avoid throwing it when server had been exited previously.IORef exitOk
hack previously in LSP.TestSessionContext
orSessionState
or using some ack mechanism with messages, but it could be done in another prHopefully this would fix haskell/haskell-ide-engine#713