Skip to content

Commit fb5c66c

Browse files
author
Marcello Seri
committed
test: update to use the new interface
Signed-off-by: Marcello Seri <[email protected]>
1 parent e13df5a commit fb5c66c

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

test/test.ml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,13 @@ let t_receivefd fd =
77
let nb_read, remote_saddr, fd_recv = recv_fd fd buf 0 2 [] in
88
Printf.printf "[receiver] Received %d bytes, received fd = %d\n%!" nb_read (int_of_fd fd_recv);
99
let message = "[receiver] I'm the receiver, and I'm writing into the fd you passed to me :p\n" in
10-
let nb_written = write fd_recv (Bytes.unsafe_of_string message) 0 (String.length message) in
10+
let nb_written = write_substring fd_recv message 0 (String.length message) in
1111
assert (nb_written = String.length message)
1212

1313
let t_sendfd fd =
1414
let fd_to_send = stdout in
15-
let buf = Bytes.of_string " " in
16-
let nb_sent = send_fd fd buf 0 2 [] fd_to_send in
15+
let buf = " " in
16+
let nb_sent = send_fd_substring fd buf 0 2 [] fd_to_send in
1717
Printf.printf "[sender] sent %d bytes, sent fd = %d\n%!" nb_sent (int_of_fd fd_to_send)
1818

1919
let main () =

test/test_fork.ml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,13 @@ let t_receivefd fd =
77
let nb_read, remote_saddr, fd_recv = recv_fd fd buf 0 2 [] in
88
Printf.printf "[receiver] Received %d bytes, received fd = %d\n%!" nb_read (int_of_fd fd_recv);
99
let message = "[receiver] I'm the receiver, and I'm writing into the fd you passed to me :p\n" in
10-
let nb_written = write fd_recv (Bytes.unsafe_of_string message) 0 (String.length message) in
10+
let nb_written = write_substring fd_recv message 0 (String.length message) in
1111
assert (nb_written = String.length message)
1212

1313
let t_sendfd fd =
1414
let fd_to_send = stdout in
15-
let buf = Bytes.of_string " " in
16-
let nb_sent = send_fd fd buf 0 2 [] fd_to_send in
15+
let buf = " " in
16+
let nb_sent = send_fd_substring fd buf 0 2 [] fd_to_send in
1717
Printf.printf "[sender] sent %d bytes, sent fd = %d\n%!" nb_sent (int_of_fd fd_to_send)
1818

1919
let main () =

0 commit comments

Comments
 (0)