Skip to content

Commit c9fc4da

Browse files
authored
Merge pull request #504 from ocaml-multicore/opam-less-version-check
Opam-free version check in Dynarray test
2 parents 61252c2 + d89d51a commit c9fc4da

File tree

1 file changed

+27
-5
lines changed

1 file changed

+27
-5
lines changed

src/dynarray/dune

Lines changed: 27 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,41 @@
1-
;; Tests of the Dynarray library - added in 5.2
1+
(* -*- tuareg -*- *)
22

3+
(* We generate an appropriate dune stanza to avoid Dynarray tests build failures
4+
on 5.0 and 5.1 with the opam-less CI GitHub action setup *)
5+
6+
(* Use ocaml_version instead of ocaml_release (from 4.14) to support 4.12 opam install *)
7+
let ocaml_version_pair =
8+
let (major,minor) = match String.split_on_char '.' Sys.ocaml_version with
9+
| major::minor::_ -> (major,minor)
10+
| _ -> failwith "Unable to extract OCaml version" in
11+
try (int_of_string major, int_of_string minor)
12+
with Failure _ -> failwith "Failed to parse OCaml version"
13+
14+
let dune =
15+
if ocaml_version_pair >= (5,2)
16+
then Printf.sprintf {|
317
(test
418
(name lin_tests)
519
(modules lin_tests)
620
(package multicoretests)
721
(libraries qcheck-lin.domain)
8-
(action (run %{test} --verbose))
9-
(enabled_if (>= %{ocaml_version} 5.2))
22+
(action (run %%{test} --verbose))
1023
)
1124

1225
(test
1326
(name stm_tests)
1427
(modules stm_tests)
1528
(package multicoretests)
1629
(libraries qcheck-stm.sequential qcheck-stm.domain)
17-
(action (run %{test} --verbose))
18-
(enabled_if (>= %{ocaml_version} 5.2))
30+
(action (run %%{test} --verbose))
1931
)
32+
|}
33+
else
34+
Printf.sprintf {|
35+
(rule
36+
(alias runtest)
37+
(package multicoretests)
38+
(action (echo "Dynarray tests disabled as Dynarray is not available\n")))
39+
|}
40+
41+
let () = Jbuild_plugin.V1.send dune

0 commit comments

Comments
 (0)