Skip to content

Commit

Permalink
TEST: Test Windows getaddrinfo_stream
Browse files Browse the repository at this point in the history
  • Loading branch information
talex5 committed Nov 20, 2024
1 parent 9b939ab commit 6f2cf6c
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
7 changes: 7 additions & 0 deletions lib_eio_posix/test/test_await.ml
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
open Eio.Std

let () =
Eio_posix.run @@ fun env ->
Eio.Net.getaddrinfo_stream env#net "127.0.0.1" ~service:"7000"
|> List.iter (traceln "Got: %a" Eio.Net.Sockaddr.pp);
traceln "getaddrinfo: %d" (List.length (Unix.getaddrinfo "127.0.0.1" "7000" []));
traceln "gethostbyname: %d" (Array.length ((Unix.gethostbyname "127.0.0.1").h_addr_list))

let () =
Eio_posix.run @@ fun _ ->
let a, b = Unix.(socketpair PF_UNIX SOCK_STREAM 0) in
Expand Down
10 changes: 9 additions & 1 deletion lib_eio_windows/test/test_net.ml
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,13 @@ let test_eio_socketpair () =
let msg = Eio.Buf_read.of_flow b ~max_size:10 |> Eio.Buf_read.take_all in
Alcotest.(check string) "same messagw" "foo" msg

let test_getaddrinfo env () =
Eio.Net.getaddrinfo_stream env#net "127.0.0.1" ~service:"7000"
|> List.iter (traceln "Got: %a" Eio.Net.Sockaddr.pp);
traceln "getaddrinfo: %d" (List.length (Unix.getaddrinfo "127.0.0.1" "7000" []));
traceln "gethostbyname: %d" (Array.length ((Unix.gethostbyname "127.0.0.1").h_addr_list));
assert false

let tests env = [
"tcp-ip4", `Quick, test_client_server env (`Tcp (Eio.Net.Ipaddr.V4.loopback, 8081));
"tcp-ip6", `Quick, test_client_server env (`Tcp (Eio.Net.Ipaddr.V6.loopback, 8081));
Expand All @@ -114,5 +121,6 @@ let tests env = [
"fds", `Quick, test_fd env Eio.Net.Ipaddr.V4.loopback;
"wrap-pipe", `Quick, test_wrap_socket `Pipe;
"wrap-socketpair", `Quick, test_wrap_socket `Socketpair;
"eio-socketpair", `Quick, test_eio_socketpair
"eio-socketpair", `Quick, test_eio_socketpair;
"getaddrinfo", `Quick, test_getaddrinfo env;
]

0 comments on commit 6f2cf6c

Please sign in to comment.