Skip to content

Commit

Permalink
Merge pull request ocaml-multicore#782 from talex5/openbsd
Browse files Browse the repository at this point in the history
Fix tests on OpenBSD
  • Loading branch information
talex5 authored Nov 21, 2024
2 parents 681400c + ae0eaa2 commit 2d9e24a
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 6 deletions.
1 change: 1 addition & 0 deletions dune-project
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
(eio (= :version))
(iomux (>= 0.2))
(mdx (and (>= 2.4.1) :with-test))
(conf-bash :with-test)
(fmt (>= 0.8.9))))
(package
(name eio_windows)
Expand Down
1 change: 1 addition & 0 deletions eio_posix.opam
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ depends: [
"eio" {= version}
"iomux" {>= "0.2"}
"mdx" {>= "2.4.1" & with-test}
"conf-bash" {with-test}
"fmt" {>= "0.8.9"}
"odoc" {with-doc}
]
Expand Down
4 changes: 3 additions & 1 deletion tests/network.md
Original file line number Diff line number Diff line change
Expand Up @@ -620,7 +620,9 @@ Exception: Eio.Io Fs Not_found _,
```ocaml
# Eio_main.run @@ fun env ->
let sockaddr = `Tcp (Eio.Net.Ipaddr.V4.loopback, 80) in
Eio.Net.getnameinfo env#net sockaddr;;
let (host, service) = Eio.Net.getnameinfo env#net sockaddr in
let service = if service = "www" then "http" else service in (* OpenBSD *)
(host, service)
- : string * string = ("localhost", "http")
```

Expand Down
10 changes: 5 additions & 5 deletions tests/process.md
Original file line number Diff line number Diff line change
Expand Up @@ -145,24 +145,24 @@ If a command fails, we get shown the arguments (quoted if necessary):

```ocaml
# run @@ fun mgr env ->
Process.run mgr ["bash"; "-c"; "exit 3"; ""; "foo"; "\"bar\""];;
Process.run mgr ["sh"; "-c"; "exit 3"; ""; "foo"; "\"bar\""];;
Exception:
Eio.Io Process Child_error Exited (code 3),
running command: bash -c "exit 3" "" foo "\"bar\""
running command: sh -c "exit 3" "" foo "\"bar\""
```

Exit code success can be determined by is_success (Process.run):

```ocaml
# run @@ fun mgr env ->
Process.run ~is_success:(Int.equal 3) mgr ["bash"; "-c"; "exit 3"];;
Process.run ~is_success:(Int.equal 3) mgr ["sh"; "-c"; "exit 3"];;
- : unit = ()
# run @@ fun mgr env ->
Process.run ~is_success:(Int.equal 3) mgr ["bash"; "-c"; "exit 0"];;
Process.run ~is_success:(Int.equal 3) mgr ["sh"; "-c"; "exit 0"];;
Exception:
Eio.Io Process Child_error Exited (code 0),
running command: bash -c "exit 0"
running command: sh -c "exit 0"
```

Exit code success can be determined by is_success (Process.parse_out):
Expand Down

0 comments on commit 2d9e24a

Please sign in to comment.