-
Notifications
You must be signed in to change notification settings - Fork 285
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #5824 from BengangY/private/bengangy/merge-master-…
…to-non-cdn-update Merge master to feature/non-cdn-update
- Loading branch information
Showing
142 changed files
with
5,907 additions
and
574 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,6 +2,7 @@ _build/ | |
*.bak | ||
*.native | ||
.merlin | ||
_coverage/ | ||
*.install | ||
*.swp | ||
compile_flags.txt | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,6 +7,7 @@ | |
fd-send-recv | ||
rpclib.core | ||
rpclib.json | ||
rpclib.xml | ||
uuid | ||
xapi-backtrace | ||
xapi-log | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,5 +4,8 @@ | |
(wrapped false) | ||
(libraries | ||
ezxenstore_core | ||
xenctrl) | ||
xenctrl | ||
uuidm | ||
threads.posix | ||
) | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
open QCheck2 | ||
open Xapi_fd_test | ||
|
||
let print_timeout = string_of_float | ||
|
||
let expect_string ~expected ~actual = | ||
if not (String.equal expected actual) then | ||
Test.fail_reportf "Data sent and observed do not match: %S <> %S" expected | ||
actual | ||
|
||
let expect_amount ~expected observation = | ||
let open Observations in | ||
let actual = String.length observation.data in | ||
if expected <> actual then | ||
Test.fail_reportf | ||
"Amount of data available and transferred does not match: %d <> %d;@,%a" | ||
expected actual pp observation | ||
|
||
let test_buf_io = | ||
let timeouts = Generate.timeouts in | ||
let gen = Gen.tup2 Generate.t timeouts | ||
and print = Print.tup2 Generate.print print_timeout in | ||
Test.make ~name:__FUNCTION__ ~print gen @@ fun (behaviour, timeout) -> | ||
let timeout_span = Mtime.Span.of_float_ns (timeout *. 1e9) |> Option.get in | ||
(* Format.eprintf "Testing %s@." (print (behaviour, timeout)); *) | ||
if behaviour.kind <> Unix.S_SOCK then | ||
QCheck2.assume_fail () ; | ||
(* we only support sockets for this function *) | ||
let test_elapsed = ref Mtime.Span.zero in | ||
let test wrapped_fd = | ||
let fd = Xapi_fdcaps.Operations.For_test.unsafe_fd_exn wrapped_fd in | ||
let bio = Buf_io.of_fd fd in | ||
let dt = Mtime_clock.counter () in | ||
let finally () = test_elapsed := Mtime_clock.count dt in | ||
Fun.protect ~finally (fun () -> | ||
Buf_io.really_input_buf bio behaviour.size ~timeout | ||
) | ||
in | ||
(*Printf.eprintf "testing: %s\n%!" (print (behaviour, timeout)) ;*) | ||
let observations, result = | ||
let buf = String.init behaviour.size (fun i -> Char.chr (i mod 255)) in | ||
Generate.run_ro behaviour buf ~f:test | ||
in | ||
let () = | ||
let open Observations in | ||
let elapsed = !test_elapsed in | ||
let timeout_extra = | ||
Mtime.Span.(add (timeout_span :> Mtime.Span.t) @@ (500 * ms)) | ||
in | ||
if Mtime.Span.compare elapsed timeout_extra > 0 then | ||
Test.fail_reportf | ||
"Function duration significantly exceeds timeout: %a > %.6f; %s" | ||
Mtime.Span.pp elapsed timeout | ||
(Fmt.to_to_string Fmt.(option pp) observations.Observations.write) ; | ||
(* Format.eprintf "Result: %a@." (Fmt.option Observations.pp) observations.write;*) | ||
match (observations, result) with | ||
| {write= Some write; _}, Ok actual -> | ||
expect_amount ~expected:(String.length actual) write ; | ||
expect_string ~expected:write.data ~actual | ||
| {write= Some _; _}, Error (`Exn_trap (Buf_io.Timeout, _)) -> | ||
let elapsed = !test_elapsed in | ||
if Mtime.Span.compare elapsed timeout_span < 0 then | ||
Test.fail_reportf "Timed out earlier than requested: %a < %a" | ||
Mtime.Span.pp elapsed Mtime.Span.pp timeout_span | ||
| ( {write= Some write; _} | ||
, Error (`Exn_trap (Unix.Unix_error (Unix.EPIPE, _, _), _)) ) -> | ||
if String.length write.data = behaviour.size then | ||
Test.fail_reportf | ||
"Transferred exact amount, shouldn't have tried to send more: %d" | ||
behaviour.size | ||
| {write= None; _}, _ -> | ||
() | ||
| _, Error (`Exn_trap (e, bt)) -> | ||
Printexc.raise_with_backtrace e bt | ||
in | ||
true | ||
|
||
let () = | ||
(* avoid SIGPIPE *) | ||
let (_ : Sys.signal_behavior) = Sys.signal Sys.sigpipe Sys.Signal_ignore in | ||
QCheck_base_runner.run_tests_main [test_buf_io] |
Empty file.
Oops, something went wrong.