summaryrefslogtreecommitdiff
path: root/testsuite/tests/lib-unix/unix-socket/recvfrom_unix.ml
blob: e584ff17a32df5b6f9271c51e36a3a1db8b709ad (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
(* TEST
include unix
modules = "recvfrom.ml"
* hasunix
** not-windows
*** bytecode
*** native
*)
open Recvfrom

let () =
  let server_path = "ocaml-test-socket-unix" in
  ensure_no_file server_path;
  at_exit (fun () -> ensure_no_file server_path);
  with_bound_socket server_path (fun server_addr server_socket ->
    (* path socket, just reuse server addr *)
    test_sender ~client_socket:server_socket ~server_socket ~server_addr ~client_addr:server_addr;

    (* unnamed socket *)
    with_socket (fun client_socket ->
      (* unbound socket should be treated as empty path *)
      test_sender ~client_socket ~server_socket ~server_addr ~client_addr:(ADDR_UNIX "")
    )
  )