From 363ac48cc5c387a2384d255a9c4e3ff422fccc22 Mon Sep 17 00:00:00 2001 From: Romain Date: Wed, 29 Oct 2025 11:12:23 +0100 Subject: [PATCH 1/4] add s390x case to fixed seed test --- test/common/tests.ml | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/test/common/tests.ml b/test/common/tests.ml index f5aec671..cac1594e 100644 --- a/test/common/tests.ml +++ b/test/common/tests.ml @@ -61,10 +61,16 @@ let () = Check.((Test.current_test_seed () = 1234) int) ~error_msg:"expected seed = %R, got %L" ; let x = Random.int64 Int64.max_int in - (* 7949467250670036511 is for OCaml 5, 3284848139645624427 is for earlier versions. *) - if x <> 3284848139645624427L && x <> 7949467250670036511L then + (* 7949467250670036511 is for OCaml 5, + 3284848139645624427 is for earlier versions, + 3999246909259713298 is for s390x. *) + if + x <> 3284848139645624427L && x <> 7949467250670036511L + && x <> 3999246909259713298L + then Test.fail - "expected x = 3284848139645624427 or 7949467250670036511, got %Ld" + "expected x = 3284848139645624427, 7949467250670036511 or \ + 3999246909259713298, got %Ld" x ; unit -- GitLab From 86c5ea1c47c9ba4132ee3c21587ed39124aee0f8 Mon Sep 17 00:00:00 2001 From: Romain Date: Wed, 29 Oct 2025 11:56:09 +0100 Subject: [PATCH 2/4] fix TSL tests for OCaml 5 --- test/common/test_tsl.ml | 81 ++++++++++++++++++++++++++++++++++++++--- 1 file changed, 75 insertions(+), 6 deletions(-) diff --git a/test/common/test_tsl.ml b/test/common/test_tsl.ml index 99afc13b..4aaacd98 100644 --- a/test/common/test_tsl.ml +++ b/test/common/test_tsl.ml @@ -13,6 +13,74 @@ let parse string = | None -> Test.fail "%S does not parse" string | Some tsl -> tsl +(* Cannot compare the [rex] type with [Stdlib.compare] in OCaml 5. + So we define comparison functions. *) + +let equal_tsl_string_var (a : TSL_AST.string_var) (b : TSL_AST.string_var) = + match (a, b) with + | File, File -> true + | File, _ -> false + | Title, Title -> true + | Title, _ -> false + +let equal_tsl_string_operator (a : TSL_AST.string_operator) + (b : TSL_AST.string_operator) = + match (a, b) with + | Is a1, Is a2 -> String.equal a1 a2 + | Is _, _ -> false + | Matches a1, Matches a2 -> String.equal (show_rex a1) (show_rex a2) + | Matches _, _ -> false + +let equal_tsl_int_var (a : TSL_AST.int_var) (b : TSL_AST.int_var) = + match (a, b) with Memory, Memory -> true + +let equal_tsl_float_var (a : TSL_AST.float_var) (b : TSL_AST.float_var) = + match (a, b) with Duration, Duration -> true + +let equal_tsl_numeric_operator (a : TSL_AST.numeric_operator) + (b : TSL_AST.numeric_operator) = + match (a, b) with + | EQ, EQ -> true + | EQ, _ -> false + | NE, NE -> true + | NE, _ -> false + | GT, GT -> true + | GT, _ -> false + | GE, GE -> true + | GE, _ -> false + | LT, LT -> true + | LT, _ -> false + | LE, LE -> true + | LE, _ -> false + +let rec equal_tsl (a : TSL_AST.t) (b : TSL_AST.t) = + match (a, b) with + | True, True -> true + | True, _ -> false + | False, False -> true + | False, _ -> false + | String_predicate (v1, op1), String_predicate (v2, op2) -> + equal_tsl_string_var v1 v2 && equal_tsl_string_operator op1 op2 + | String_predicate _, _ -> false + | Int_predicate (v1, op1, n1), Int_predicate (v2, op2, n2) -> + equal_tsl_int_var v1 v2 + && equal_tsl_numeric_operator op1 op2 + && Int.equal n1 n2 + | Int_predicate _, _ -> false + | Float_predicate (v1, op1, n1), Float_predicate (v2, op2, n2) -> + equal_tsl_float_var v1 v2 + && equal_tsl_numeric_operator op1 op2 + && Float.equal n1 n2 + | Float_predicate _, _ -> false + | Has_tag t1, Has_tag t2 -> String.equal t1 t2 + | Has_tag _, _ -> false + | Not a1, Not a2 -> equal_tsl a1 a2 + | Not _, _ -> false + | And (a1, b1), And (a2, b2) -> equal_tsl a1 a2 && equal_tsl b1 b2 + | And _, _ -> false + | Or (a1, b1), Or (a2, b2) -> equal_tsl a1 a2 && equal_tsl b1 b2 + | Or _, _ -> false + let () = Test.register ~__FILE__ @@ -21,7 +89,7 @@ let () = @@ fun () -> let check string expected = let result = parse string in - if result <> expected then + if not (equal_tsl result expected) then Test.fail "%S does not parse as expected but as: %s" string @@ -131,7 +199,8 @@ let () = let check string = let tsl = parse string in let shown = TSL.show tsl in - if shown <> string then Test.fail "%S is shown as %S" string shown + if not (String.equal shown string) then + Test.fail "%S is shown as %S" string shown in (* Base expressions. *) check "true" ; @@ -188,7 +257,7 @@ let () = let check string expected = let tsl = parse string in let result = TSL.eval env tsl in - if result <> expected then + if not (Bool.equal result expected) then Test.fail "%S evaluates to %b instead of %b" string result expected in (* Base expressions. *) @@ -316,7 +385,7 @@ let () = let tsl = random (Random.int 5) in let string = TSL.show ~always_parenthesize:true tsl in let result = parse string in - if result <> tsl then + if not (equal_tsl result tsl) then Test.fail "%S does not parse as expected but as: %s" string @@ -332,7 +401,7 @@ let () = @@ fun () -> let check items expected = let tsl = TSL.conjunction items in - if tsl <> expected then + if not (equal_tsl tsl expected) then Test.fail "expected %s, got %s" (TSL.show expected) (TSL.show tsl) in check [] True ; @@ -350,7 +419,7 @@ let () = @@ fun () -> let check tag expected = let result = TSL.is_valid_tag tag in - if result <> expected then + if not (Bool.equal result expected) then Test.fail "expected is_valid_tag %S = %b, got %b" tag expected result in (* Some tags are in fact valid. *) -- GitLab From 243c76afea7bca0eecc73c7dac73b464a83d3717 Mon Sep 17 00:00:00 2001 From: Romain Date: Wed, 29 Oct 2025 11:27:06 +0100 Subject: [PATCH 3/4] disable tests unless on linux x86_64 Although Tezt mostly works with other architectures, tests are too flaky and we can't spend too many resources to support them. --- tezt.opam | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tezt.opam b/tezt.opam index 2cd3a358..e3ca09b1 100644 --- a/tezt.opam +++ b/tezt.opam @@ -18,6 +18,7 @@ depends: [ "js_of_ocaml-lwt" { with-test } "ocamlformat" { with-test & = "0.27.0" } ] +x-ci-accept-failures: ["debian-11" "ubuntu-22.04"] depopts: [ "js_of_ocaml" "js_of_ocaml-lwt" @@ -28,6 +29,6 @@ conflicts: [ ] build: [ ["dune" "build" "-p" name "-j" jobs] - ["dune" "runtest" "-p" name "-j" jobs] {with-test} + ["dune" "runtest" "-p" name "-j" jobs] {with-test & arch = "x86_64" & os = "linux"} ] synopsis: "Test framework for unit tests, integration tests, and regression tests" -- GitLab From c11d9e6ad7db1fe909e303844fd5868aedd759a1 Mon Sep 17 00:00:00 2001 From: Romain Date: Wed, 29 Oct 2025 11:32:01 +0100 Subject: [PATCH 4/4] set version to 4.3.0 --- CHANGES.md | 2 +- lib_core/version.ml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index bd34316e..59d05f7e 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,6 +1,6 @@ # Changelog -## Development Version +## Version 4.3.0 ### New Features diff --git a/lib_core/version.ml b/lib_core/version.ml index 294a5809..0a314c35 100644 --- a/lib_core/version.ml +++ b/lib_core/version.ml @@ -23,4 +23,4 @@ (* *) (*****************************************************************************) -let full = "4.2.0+dev" +let full = "4.3.0" -- GitLab