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

Opam-free version check in Dynarray test #504

Merged
merged 2 commits into from
Jan 6, 2025
Merged
Changes from all commits
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
32 changes: 27 additions & 5 deletions src/dynarray/dune
Original file line number Diff line number Diff line change
@@ -1,19 +1,41 @@
;; Tests of the Dynarray library - added in 5.2
(* -*- tuareg -*- *)

(* We generate an appropriate dune stanza to avoid Dynarray tests build failures
on 5.0 and 5.1 with the opam-less CI GitHub action setup *)

(* Use ocaml_version instead of ocaml_release (from 4.14) to support 4.12 opam install *)
let ocaml_version_pair =
let (major,minor) = match String.split_on_char '.' Sys.ocaml_version with
| major::minor::_ -> (major,minor)
| _ -> failwith "Unable to extract OCaml version" in
try (int_of_string major, int_of_string minor)
with Failure _ -> failwith "Failed to parse OCaml version"

let dune =
if ocaml_version_pair >= (5,2)
then Printf.sprintf {|
(test
(name lin_tests)
(modules lin_tests)
(package multicoretests)
(libraries qcheck-lin.domain)
(action (run %{test} --verbose))
(enabled_if (>= %{ocaml_version} 5.2))
(action (run %%{test} --verbose))
)

(test
(name stm_tests)
(modules stm_tests)
(package multicoretests)
(libraries qcheck-stm.sequential qcheck-stm.domain)
(action (run %{test} --verbose))
(enabled_if (>= %{ocaml_version} 5.2))
(action (run %%{test} --verbose))
)
|}
else
Printf.sprintf {|
(rule
(alias runtest)
(package multicoretests)
(action (echo "Dynarray tests disabled as Dynarray is not available\n")))
|}

let () = Jbuild_plugin.V1.send dune
Loading