Skip to content

Commit

Permalink
CP-50448: run the QuickCheck tests in QuickTest
Browse files Browse the repository at this point in the history
Quicktest runs in Dom0, and the existing quickcheck tests run in the CI.
Some of these test as much the OCaml code, as its interaction with the system (e.g. behaviour of system calls).
So it is better to run these tests both in the CI and in Dom0.

We run these in long mode, to explore more randomly generated scenarios.

The seed can be controlled with QCHECK_SEED environment variable.
Similar to @StressTest it uses a random seed, instead of a fixed seed.

Signed-off-by: Edwin Török <[email protected]>
  • Loading branch information
edwintorok committed Jul 29, 2024
1 parent eb58c7d commit efcb7af
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 1 deletion.
4 changes: 3 additions & 1 deletion ocaml/quicktest/dune
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,21 @@
(libraries
alcotest
astring

ezxenstore
ezxenstore.watch
fmt
forkexec
http_lib
mtime
mtime.clock.os
qcheck-alcotest
result
rresult
rpclib.core
rrdd_libs
stunnel
bufio_test
test_timer
threads.posix
unix
uuid
Expand Down
10 changes: 10 additions & 0 deletions ocaml/quicktest/quicktest.ml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,11 @@

(** The main entry point of the quicktest executable *)

let qchecks =
[("bufio", Bufio_test.tests); ("Timer", Test_timer.tests)]
|> List.map @@ fun (name, test) ->
(name, List.map QCheck_alcotest.(to_alcotest ~long:true) test)

let () =
Quicktest_args.parse () ;
Qt_filter.wrap (fun () ->
Expand Down Expand Up @@ -43,6 +48,11 @@ let () =
[("http", Quicktest_http.tests)]
else
[]
@
if not !Quicktest_args.skip_stress then
qchecks
else
[]
in
(* Only list tests if asked, without running them *)
if !Quicktest_args.list_tests then
Expand Down
3 changes: 3 additions & 0 deletions ocaml/quicktest/quicktest_args.ml
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ let set_alcotest_args l = alcotest_args := Array.of_list l

let skip_xapi = ref false

let skip_stress = ref false

(** Parse the legacy quicktest command line args. This is used instead of
invoking Alcotest directly, for backwards-compatibility with clients who
run the quicktest binary. *)
Expand All @@ -67,6 +69,7 @@ let parse () =
-default-sr"
)
; ("-skip-xapi", Arg.Set skip_xapi, "SKIP tests that require XAPI")
; ("-skip-stress", Arg.Set skip_stress, "SKIP randomized stress tests")
; ("--", Arg.Rest_all set_alcotest_args, "Supply alcotest arguments")
; ( "-run-only"
, Arg.String (fun x -> run_only := Some x)
Expand Down

0 comments on commit efcb7af

Please sign in to comment.