diff --git a/lib/xapi-fd-test/observations.ml b/lib/xapi-fd-test/observations.ml index d52c6a3071..d81431fd28 100644 --- a/lib/xapi-fd-test/observations.ml +++ b/lib/xapi-fd-test/observations.ml @@ -288,13 +288,16 @@ let observe_rw read write ~f ~size kind expected = let written = Buffer.create 0 in let rd_buf = Buffer.create 0 in let gw fd = - let r = do_write write written expected 0 (as_writable_opt fd) in - close fd; - r + do_write write written expected 0 (as_writable_opt fd) and gr fd = do_read ~size read rd_buf (as_readable_opt fd) in - let res, thread_result = concurrently (wrap_measure f, concurrently (gr, gw)) (rw1, (rw2,rw2)) in + let g fd = + let r = concurrently (gr, gw) (fd, fd) in + close fd; + r + in + let res, thread_result = concurrently (wrap_measure f, g) (rw1, rw2) in let elapsed, res = unwrap_exn res in let read, write = unwrap_exn thread_result in let read = diff --git a/ocaml/libs/xapi-stdext/lib/xapi-stdext-unix/test/unixext_test.ml b/ocaml/libs/xapi-stdext/lib/xapi-stdext-unix/test/unixext_test.ml index 973cdb8b14..dc35a4f76b 100644 --- a/ocaml/libs/xapi-stdext/lib/xapi-stdext-unix/test/unixext_test.ml +++ b/ocaml/libs/xapi-stdext/lib/xapi-stdext-unix/test/unixext_test.ml @@ -168,11 +168,12 @@ let test_proxy = let fd2 = Xapi_fdcaps.Operations.For_test.unsafe_fd_exn wrapped_fd2 in Unixext.proxy (Unix.dup fd) (Unix.dup fd2) in - match Generate.run_ro behaviour buf ~f:test2 with + match Generate.run_rw behaviour buf ~f:test2 with | _, Error (`Exn_trap (e, bt)) -> Printexc.raise_with_backtrace e bt | obs, Ok () -> obs in - match Generate.run_wo behaviour ~f:test with + let buf' = String.init behaviour.size (fun i -> Char.chr ((30+i) mod 255)) in + match Generate.run_rw behaviour buf' ~f:test with | _, Error (`Exn_trap (e, bt)) -> Printexc.raise_with_backtrace e bt | {read=None;_}, Ok _ -> false | _, Ok {write=None;_} -> false