From ebcfa503cc494fc6f454eb57cb515737b2fb5641 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Edwin=20T=C3=B6r=C3=B6k?= Date: Thu, 21 Dec 2023 17:11:46 +0000 Subject: [PATCH] fixup! CP-47001: [xapi-fdcaps]: wrap more Unix operations --- lib/xapi-fdcaps/test/test_operations.ml | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/lib/xapi-fdcaps/test/test_operations.ml b/lib/xapi-fdcaps/test/test_operations.ml index 4cd6a0e7..fa60e5f6 100644 --- a/lib/xapi-fdcaps/test/test_operations.ml +++ b/lib/xapi-fdcaps/test/test_operations.ml @@ -233,15 +233,18 @@ let test_repeat_read () = let available = String.length buf - off in let len = Int.min len 11 in let len = Int.min len available in - Bytes.blit_string buf off dst off len; + Bytes.blit_string buf off dst off len ; len in let dst = Bytes.make 300 '_' in let@ placeholder = with_fd @@ dev_zero () in (* not actually used, just to make the types work, we simulate the read using string ops *) let actual = repeat_read read placeholder dst 0 (Bytes.length dst) in - Alcotest.(check' int) ~msg:"amount read" ~actual ~expected:(String.length buf); - Alcotest.(check' string) ~msg:"contents" ~actual:(Bytes.sub_string dst 0 actual) ~expected:buf + Alcotest.(check' int) ~msg:"amount read" ~actual ~expected:(String.length buf) ; + Alcotest.(check' string) + ~msg:"contents" + ~actual:(Bytes.sub_string dst 0 actual) + ~expected:buf let test_repeat_write () = let buf = Bytes.make 255 '_' in @@ -249,15 +252,19 @@ let test_repeat_write () = let available = Bytes.length buf - off in let len = Int.min len 11 in let len = Int.min len available in - Bytes.blit_string src off buf off len; + Bytes.blit_string src off buf off len ; len in let src = String.init 255 Char.chr in let@ placeholder = with_fd @@ dev_zero () in (* not actually used, just to make the types work, we simulate the read using string ops *) let actual = repeat_write write placeholder src 0 (String.length src) in - Alcotest.(check' int) ~msg:"amount written" ~actual ~expected:(Bytes.length buf); - Alcotest.(check' string) ~msg:"contents" ~actual:(Bytes.sub_string buf 0 actual) ~expected:src + Alcotest.(check' int) + ~msg:"amount written" ~actual ~expected:(Bytes.length buf) ; + Alcotest.(check' string) + ~msg:"contents" + ~actual:(Bytes.sub_string buf 0 actual) + ~expected:src let tests = Alcotest.