Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Miscellaneous Unixext minor updates #6132

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 19 additions & 1 deletion ocaml/libs/xapi-stdext/lib/xapi-stdext-unix/test/unixext_test.ml
Original file line number Diff line number Diff line change
Expand Up @@ -281,8 +281,26 @@ let test_select =
in
true

let test_direct =
let gen = Gen.unit in
Test.make ~count:1 ~name:__FUNCTION__ gen @@ fun _ ->
let fn = "test_file_direct" in
let buf = Bytes.make 10000 'x' in
Unixext.Direct.with_openfile fn [Unix.O_RDWR; Unix.O_CREAT] 0o600 (fun f ->
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you plan on using this module in a future PR?

There is a lot of dead code in XAPI unfortunately, and in this case the entire Unixext.Direct module appears to be dead code. If I drop the entire module from the interface and impl, then XAPI still builds.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The optimizations and this testcase looks correct, but if this is dead code we could also simplify things and delete the unused C stubs, and modules.

let res = Unixext.Direct.write f buf 0 4096 in
QCheck2.assume (res = 4096)
) ;
Unix.unlink fn ;
true

let tests =
[test_select; test_proxy; test_time_limited_write; test_time_limited_read]
[
test_select
; test_proxy
; test_time_limited_write
; test_time_limited_read
; test_direct
]

let () =
(* avoid SIGPIPE *)
Expand Down
Loading