From ea78c8b251b81cadc2e4cef8beb6a590f1d249d0 Mon Sep 17 00:00:00 2001 From: Jan Midtgaard Date: Thu, 12 Dec 2024 18:29:43 +0100 Subject: [PATCH 1/6] Bump qcheck-core lower bound to 0.23 --- dune-project | 8 ++++---- multicoretests.opam | 2 +- qcheck-lin.opam | 2 +- qcheck-multicoretests-util.opam | 2 +- qcheck-stm.opam | 2 +- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/dune-project b/dune-project index e67fb7a20..32bfe659d 100644 --- a/dune-project +++ b/dune-project @@ -17,7 +17,7 @@ the multicore run-time of OCaml 5.0.") (tags ("test" "test suite" "property" "qcheck" "quickcheck" "multicore" "non-determinism")) (depends base-domains - (qcheck-core (>= "0.20")) + (qcheck-core (>= "0.23")) (qcheck-lin (= :version)) (qcheck-stm (= :version)))) @@ -31,7 +31,7 @@ sequential and parallel tests against a declarative model.") (depopts base-domains) (depends (ocaml (>= 4.12)) - (qcheck-core (>= "0.20")) + (qcheck-core (>= "0.23")) (qcheck-multicoretests-util (= :version)))) (package @@ -46,7 +46,7 @@ and explained by some sequential interleaving.") (depopts base-domains) (depends (ocaml (>= 4.12)) - (qcheck-core (>= "0.20")) + (qcheck-core (>= "0.23")) (qcheck-multicoretests-util (= :version)))) (package @@ -57,4 +57,4 @@ multicore programs.") (tags ("test" "property" "qcheck" "quickcheck" "multicore" "non-determinism")) (depends (ocaml (>= 4.12)) - (qcheck-core (>= "0.20")))) + (qcheck-core (>= "0.23")))) diff --git a/multicoretests.opam b/multicoretests.opam index eb855b671..8bb5bcf09 100644 --- a/multicoretests.opam +++ b/multicoretests.opam @@ -22,7 +22,7 @@ bug-reports: "https://github.com/ocaml-multicore/multicoretests/issues" depends: [ "dune" {>= "3.0"} "base-domains" - "qcheck-core" {>= "0.20"} + "qcheck-core" {>= "0.23"} "qcheck-lin" {= version} "qcheck-stm" {= version} "odoc" {with-doc} diff --git a/qcheck-lin.opam b/qcheck-lin.opam index d8dc3e5ef..c7775d37e 100644 --- a/qcheck-lin.opam +++ b/qcheck-lin.opam @@ -23,7 +23,7 @@ bug-reports: "https://github.com/ocaml-multicore/multicoretests/issues" depends: [ "dune" {>= "3.0"} "ocaml" {>= "4.12"} - "qcheck-core" {>= "0.20"} + "qcheck-core" {>= "0.23"} "qcheck-multicoretests-util" {= version} "odoc" {with-doc} ] diff --git a/qcheck-multicoretests-util.opam b/qcheck-multicoretests-util.opam index 1314820cb..793ba8950 100644 --- a/qcheck-multicoretests-util.opam +++ b/qcheck-multicoretests-util.opam @@ -15,7 +15,7 @@ bug-reports: "https://github.com/ocaml-multicore/multicoretests/issues" depends: [ "dune" {>= "3.0"} "ocaml" {>= "4.12"} - "qcheck-core" {>= "0.20"} + "qcheck-core" {>= "0.23"} "odoc" {with-doc} ] build: [ diff --git a/qcheck-stm.opam b/qcheck-stm.opam index f92058a97..697f21f0a 100644 --- a/qcheck-stm.opam +++ b/qcheck-stm.opam @@ -23,7 +23,7 @@ bug-reports: "https://github.com/ocaml-multicore/multicoretests/issues" depends: [ "dune" {>= "3.0"} "ocaml" {>= "4.12"} - "qcheck-core" {>= "0.20"} + "qcheck-core" {>= "0.23"} "qcheck-multicoretests-util" {= version} "odoc" {with-doc} ] From ff8e618546938b4c78e1286cfc06256b0df00515 Mon Sep 17 00:00:00 2001 From: Jan Midtgaard Date: Thu, 12 Dec 2024 18:52:18 +0100 Subject: [PATCH 2/6] Update STM show functions to use QCheck.0.23 definitions --- lib/STM.ml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/lib/STM.ml b/lib/STM.ml index 03441c8ed..4c5d520b7 100644 --- a/lib/STM.ml +++ b/lib/STM.ml @@ -23,15 +23,15 @@ type _ ty += type 'a ty_show = 'a ty * ('a -> string) -let unit = (Unit, fun () -> "()") -let bool = (Bool, string_of_bool) -let char = (Char, fun c -> Printf.sprintf "%C" c) -let int = (Int, string_of_int) +let unit = (Unit, QCheck.Print.unit) +let bool = (Bool, QCheck.Print.bool) +let char = (Char, QCheck.Print.char) +let int = (Int, QCheck.Print.int) let int32 = (Int32, Int32.to_string) let int64 = (Int64, Int64.to_string) -let float = (Float, Float.to_string) -let string = (String, fun s -> Printf.sprintf "%S" s) -let bytes = (Bytes, fun b -> Printf.sprintf "%S" (Bytes.to_string b)) +let float = (Float, QCheck.Print.float) +let string = (String, QCheck.Print.string) +let bytes = (Bytes, QCheck.Print.bytes) let option spec = let (ty,show) = spec in (Option ty, QCheck.Print.option show) From 6e7ca7af2e7d1907d9a1ef305ef379748bba0c8e Mon Sep 17 00:00:00 2001 From: Jan Midtgaard Date: Thu, 12 Dec 2024 18:56:05 +0100 Subject: [PATCH 3/6] Update Lin show functions to use QCheck.0.23 definitions --- lib/lin.ml | 22 +++++++++------------- 1 file changed, 9 insertions(+), 13 deletions(-) diff --git a/lib/lin.ml b/lib/lin.ml index 8751100fe..4285b14ac 100644 --- a/lib/lin.ml +++ b/lib/lin.ml @@ -155,16 +155,12 @@ let gen_deconstructible gen print eq = GenDeconstr (gen,print,eq) let qcheck_nat64_small = QCheck.(map Int64.of_int small_nat) -let print_char c = Printf.sprintf "%C" c -let print_string s = Printf.sprintf "%S" s -let print_bytes b = print_string (Bytes.to_string b) - let bytes_small_printable = QCheck.bytes_small_of QCheck.Gen.printable let unit = GenDeconstr (QCheck.unit, QCheck.Print.unit, (=)) let bool = GenDeconstr (QCheck.bool, QCheck.Print.bool, (=)) -let char = GenDeconstr (QCheck.char, print_char, (=)) -let char_printable = GenDeconstr (QCheck.printable_char, print_char, (=)) +let char = GenDeconstr (QCheck.char, QCheck.Print.char, (=)) +let char_printable = GenDeconstr (QCheck.printable_char, QCheck.Print.char, (=)) let nat_small = GenDeconstr (QCheck.small_nat, QCheck.Print.int, (=)) let int = GenDeconstr (QCheck.int, QCheck.Print.int, (=)) let int_small = GenDeconstr (QCheck.small_int, QCheck.Print.int, (=)) @@ -173,13 +169,13 @@ let int_bound b = GenDeconstr (QCheck.int_bound b, QCheck.Print.int, (=)) let int32 = GenDeconstr (QCheck.int32, Int32.to_string, Int32.equal) let int64 = GenDeconstr (QCheck.int64, Int64.to_string, Int64.equal) let nat64_small = GenDeconstr (qcheck_nat64_small, Int64.to_string, Int64.equal) -let float = GenDeconstr (QCheck.float, Float.to_string, Float.equal) -let string = GenDeconstr (QCheck.string, print_string, String.equal) -let string_small = GenDeconstr (QCheck.small_string, print_string, String.equal) -let string_small_printable = GenDeconstr (QCheck.small_printable_string, print_string, String.equal) -let bytes = GenDeconstr (QCheck.bytes, print_bytes, Bytes.equal) -let bytes_small = GenDeconstr (QCheck.bytes_small, print_bytes, Bytes.equal) -let bytes_small_printable = GenDeconstr (bytes_small_printable, print_bytes, Bytes.equal) +let float = GenDeconstr (QCheck.float, QCheck.Print.float, Float.equal) +let string = GenDeconstr (QCheck.string, QCheck.Print.string, String.equal) +let string_small = GenDeconstr (QCheck.small_string, QCheck.Print.string, String.equal) +let string_small_printable = GenDeconstr (QCheck.small_printable_string, QCheck.Print.string, String.equal) +let bytes = GenDeconstr (QCheck.bytes, QCheck.Print.bytes, Bytes.equal) +let bytes_small = GenDeconstr (QCheck.bytes_small, QCheck.Print.bytes, Bytes.equal) +let bytes_small_printable = GenDeconstr (bytes_small_printable, QCheck.Print.bytes, Bytes.equal) let option : type a c s. ?ratio:float -> (a, c, s, combinable) ty -> (a option, c, s, combinable) ty = fun ?ratio ty -> From ef6c00672228970fb43f41f9deca7e4a65679112 Mon Sep 17 00:00:00 2001 From: Jan Midtgaard Date: Fri, 13 Dec 2024 15:50:14 +0100 Subject: [PATCH 4/6] Update expected output for test/util_pp.ml --- test/util_pp.expected | 2 +- test/util_pp_trunc150.expected | 2 +- test/util_pp_trunc79.expected | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/test/util_pp.expected b/test/util_pp.expected index 4493eaaab..82513cca3 100644 --- a/test/util_pp.expected +++ b/test/util_pp.expected @@ -74,5 +74,5 @@ Test of pp_record: { key = 123; value = "content" } Test of pp_fun_: -{(Some (-123456), a, xyz) -> true; (None, b, ) -> true; _ -> true} +{(Some (-123456), 'a', "xyz") -> true; (None, 'b', "") -> true; _ -> true} diff --git a/test/util_pp_trunc150.expected b/test/util_pp_trunc150.expected index c0b74a125..ff710328d 100644 --- a/test/util_pp_trunc150.expected +++ b/test/util_pp_trunc150.expected @@ -74,5 +74,5 @@ Test of pp_record: { key = 123; value = "content" } Test of pp_fun_: -{(Some (-123456), a, xyz) -> true; (None, b, ) -> true; _ -> true} +{(Some (-123456), 'a', "xyz") -> true; (None, 'b', "") -> true; _ -> true} diff --git a/test/util_pp_trunc79.expected b/test/util_pp_trunc79.expected index 178f44fec..411256e95 100644 --- a/test/util_pp_trunc79.expected +++ b/test/util_pp_trunc79.expected @@ -74,5 +74,5 @@ Test of pp_record: { key = 123; value = "content" } Test of pp_fun_: -{(Some (-123456), a, xyz) -> true; (None, b, ) -> true; _ -> true} +{(Some (-123456), 'a', "xyz") -> true; (None, 'b', "") -> true; _ -> true} From 7bdd17d05f9e8eb846333ed01b2f981a850f948e Mon Sep 17 00:00:00 2001 From: Jan Midtgaard Date: Fri, 13 Dec 2024 15:58:52 +0100 Subject: [PATCH 5/6] Add a CHANGES entry --- CHANGES.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGES.md b/CHANGES.md index ef84607d4..c35e7dd34 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -2,6 +2,8 @@ ## Next release +- #491: Require `qcheck.0.23`, simplify show functions by utilizing it, and update + expect outputs accordingly - #486: Add `Util.Pp.pp_fun_` printer for generated `QCheck.fun_` functions ## 0.4 From 2684c1b382fa1c70f79a229859510fdc41d7cafd Mon Sep 17 00:00:00 2001 From: Jan Midtgaard Date: Fri, 13 Dec 2024 18:05:34 +0100 Subject: [PATCH 6/6] Bump qcheck checkout to 0.23 too --- .github/workflows/common.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/common.yml b/.github/workflows/common.yml index 915e4bfc9..f888255cb 100644 --- a/.github/workflows/common.yml +++ b/.github/workflows/common.yml @@ -87,7 +87,7 @@ jobs: uses: actions/checkout@v4 with: repository: c-cube/qcheck - ref: v0.22 + ref: v0.23 path: multicoretests/qcheck - name: Pre-Setup