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

Getting MDX tests working on Windows #589

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
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
11 changes: 10 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -752,12 +752,17 @@ Eio.Io Net Connection_failure Refused Unix_error (Connection refused, "connect",
```

If we ran this using another backend, the `Unix_error` part might change.
To avoid this problem, you can use `Eio.Exn.Backend.show` to hide the backend-specific part of errors:
To avoid this problem, you can use `Eio.Exn.Backend.show`

```ocaml
# Eio.Exn.Backend.show := false;;
- : unit = ()
```

to hide the backend-specific part of errors:

<!-- $MDX os_type<>Win32 -->
```ocaml
# Eio_main.run @@ fun env ->
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For some reason this test never completes. So, I disabled it.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That seems worrying! Is it only an MDX thing, or does the example in examples/net also hang if the server side isn't running?

let net = Eio.Stdenv.net env in
Switch.run @@ fun sw ->
Expand Down Expand Up @@ -892,6 +897,7 @@ perhaps with `open_dir` to constrain all access to be within that directory.

Spawning a child process can be done using the [Eio.Process][] module:

<!-- $MDX os_type<>Win32 -->
```ocaml
# Eio_main.run @@ fun env ->
let proc_mgr = Eio.Stdenv.process_mgr env in
Expand All @@ -903,6 +909,7 @@ hello
There are various optional arguments for setting the process's current directory or connecting up the standard streams.
For example, we can use `tr` to convert some text to upper-case:

<!-- $MDX os_type<>Win32 -->
```ocaml
# Eio_main.run @@ fun env ->
let proc_mgr = Eio.Stdenv.process_mgr env in
Expand All @@ -915,6 +922,7 @@ ONE TWO THREE
If you want to capture the output of a process, you can provide a suitable `Eio.Flow.sink` as the `stdout` argument,
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I disabled the process tests. There are two problems:

  1. Process operations are not yet implemented on Windows.
  2. Even if the process operations were implemented on Windows, the tests would not work on Windows, because they use commands that do not necessarily exist on Windows.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah. We really need a way to selectively disable tests on different platforms (e.g. realworldocaml/mdx#393).

or use the `parse_out` convenience wrapper:

<!-- $MDX os_type<>Win32 -->
```ocaml
# Eio_main.run @@ fun env ->
let proc_mgr = Eio.Stdenv.process_mgr env in
Expand All @@ -924,6 +932,7 @@ or use the `parse_out` convenience wrapper:

All process functions either return the exit status or check that it was zero (success):

<!-- $MDX os_type<>Win32 -->
```ocaml
# Eio_main.run @@ fun env ->
let proc_mgr = Eio.Stdenv.process_mgr env in
Expand Down
1 change: 0 additions & 1 deletion dune
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,4 @@
(package eio_main)
(deps (package eio_main) (package kcas) (env_var "EIO_BACKEND"))
(preludes doc/prelude.ml)
(enabled_if (<> %{os_type} "Win32"))
(files README.md))
8 changes: 4 additions & 4 deletions dune-project
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
(domain-local-await (>= 0.1.0))
(crowbar (and (>= 0.2) :with-test))
(mtime (>= 2.0.0))
(mdx (and (>= 2.2.0) :with-test))
(mdx (and (>= 2.3.1) :with-test))
(dscheck (and (>= 0.1.0) :with-test))))
(package
(name eio_linux)
Expand All @@ -38,7 +38,7 @@
(depends
(alcotest (and (>= 1.7.0) :with-test))
(eio (= :version))
(mdx (and (>= 2.2.0) :with-test))
(mdx (and (>= 2.3.1) :with-test))
(logs (>= 0.7.0))
(fmt (>= 0.8.9))
(cmdliner (and (>= 1.1.0) :with-test))
Expand All @@ -51,7 +51,7 @@
(depends
(eio (= :version))
(iomux (>= 0.2))
(mdx (and (>= 2.2.0) :with-test))
(mdx (and (>= 2.3.1) :with-test))
(fmt (>= 0.8.9))))
(package
(name eio_windows)
Expand All @@ -67,7 +67,7 @@
(synopsis "Effect-based direct-style IO mainloop for OCaml")
(description "Selects an appropriate Eio backend for the current platform.")
(depends
(mdx (and (>= 2.2.0) :with-test))
(mdx (and (>= 2.3.1) :with-test))
(kcas (and (>= 0.3.0) :with-test))
(yojson (and (>= 2.0.2) :with-test))
(eio_linux (and (= :version) (= :os "linux")))
Expand Down
2 changes: 1 addition & 1 deletion eio.opam
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ depends: [
"domain-local-await" {>= "0.1.0"}
"crowbar" {>= "0.2" & with-test}
"mtime" {>= "2.0.0"}
"mdx" {>= "2.2.0" & with-test}
"mdx" {>= "2.3.1" & with-test}
"dscheck" {>= "0.1.0" & with-test}
"odoc" {with-doc}
]
Expand Down
2 changes: 1 addition & 1 deletion eio_linux.opam
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ depends: [
"dune" {>= "3.9"}
"alcotest" {>= "1.7.0" & with-test}
"eio" {= version}
"mdx" {>= "2.2.0" & with-test}
"mdx" {>= "2.3.1" & with-test}
"logs" {>= "0.7.0"}
"fmt" {>= "0.8.9"}
"cmdliner" {>= "1.1.0" & with-test}
Expand Down
2 changes: 1 addition & 1 deletion eio_main.opam
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ doc: "https://ocaml-multicore.github.io/eio/"
bug-reports: "https://github.com/ocaml-multicore/eio/issues"
depends: [
"dune" {>= "3.9"}
"mdx" {>= "2.2.0" & with-test}
"mdx" {>= "2.3.1" & with-test}
"kcas" {>= "0.3.0" & with-test}
"yojson" {>= "2.0.2" & with-test}
"eio_linux" {= version & os = "linux"}
Expand Down
2 changes: 1 addition & 1 deletion eio_posix.opam
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ depends: [
"dune" {>= "3.9"}
"eio" {= version}
"iomux" {>= "0.2"}
"mdx" {>= "2.2.0" & with-test}
"mdx" {>= "2.3.1" & with-test}
"fmt" {>= "0.8.9"}
"odoc" {with-doc}
]
Expand Down