Skip to content
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

chore: revert incorrect changes to Makefile #1331

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,7 @@ bench: ##

.PHONY: test-ocaml
test-ocaml: ## Run the unit tests
# FIXME: Find another approach to prevent competing test runs from causing errors
dune build -j 1 @lsp/test/runtest @lsp-fiber/runtest @jsonrpc-fiber/runtest @ocaml-lsp-server/runtest
dune build @lsp/test/runtest @lsp-fiber/runtest @jsonrpc-fiber/runtest @ocaml-lsp-server/runtest

.PHONY: promote
promote:
Expand Down Expand Up @@ -106,6 +105,5 @@ coverage-deps:

.PHONY: test-coverage
test-coverage:
# FIXME: Find another approach to prevent competing test runs from causing errors
dune build -j 1 --instrument-with bisect_ppx --force @lsp/test/runtest @lsp-fiber/runtest @jsonrpc-fiber/runtest @ocaml-lsp-server/runtest
dune build --instrument-with bisect_ppx --force @lsp/test/runtest @lsp-fiber/runtest @jsonrpc-fiber/runtest @ocaml-lsp-server/runtest
bisect-ppx-report send-to Coveralls
10 changes: 3 additions & 7 deletions ocaml-lsp-server/test/e2e-new/helpers.ml
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,8 @@ let client_capabilities = ClientCapabilities.create ()
let uri = DocumentUri.of_path "test.ml"

let test ?extra_env text req =
let handler =
Client.Handler.make
~on_notification:(fun client _notification ->
Client.state client;
Fiber.return ())
()
in
let on_notification, diagnostics = Test.drain_diagnostics () in
let handler = Client.Handler.make ~on_notification () in
Test.run ~handler ?extra_env (fun client ->
let run_client () =
Client.start
Expand All @@ -31,6 +26,7 @@ let test ?extra_env text req =
in
let* () = req client in
let* () = Client.request client Shutdown in
let* () = Fiber.Ivar.read diagnostics in
Client.stop client
in
Fiber.fork_and_join_unit run_client run)
24 changes: 13 additions & 11 deletions ocaml-lsp-server/test/e2e-new/test.ml
Original file line number Diff line number Diff line change
Expand Up @@ -168,19 +168,21 @@ end

include T

let run_request ?(prep = fun _ -> Fiber.return ()) ?settings request =
let drain_diagnostics () =
let diagnostics = Fiber.Ivar.create () in
let handler =
Client.Handler.make
~on_notification:(fun _ -> function
| PublishDiagnostics _ -> (
let* diag = Fiber.Ivar.peek diagnostics in
match diag with
| Some _ -> Fiber.return ()
| None -> Fiber.Ivar.fill diagnostics ())
| _ -> Fiber.return ())
()
let on_notification _ = function
| Lsp.Server_notification.PublishDiagnostics _ -> (
let* diag = Fiber.Ivar.peek diagnostics in
match diag with
| Some _ -> Fiber.return ()
| None -> Fiber.Ivar.fill diagnostics ())
| _ -> Fiber.return ()
in
(on_notification, diagnostics)

let run_request ?(prep = fun _ -> Fiber.return ()) ?settings request =
let on_notification, diagnostics = drain_diagnostics () in
let handler = Client.Handler.make ~on_notification () in
run ~handler @@ fun client ->
let run_client () =
let capabilities =
Expand Down
Loading