Skip to content

Commit

Permalink
testing
Browse files Browse the repository at this point in the history
  • Loading branch information
edwintorok committed Jan 30, 2024
1 parent 33d89aa commit bc2d39b
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
11 changes: 7 additions & 4 deletions lib/xapi-fd-test/observations.ml
Original file line number Diff line number Diff line change
Expand Up @@ -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 =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit bc2d39b

Please sign in to comment.