From 78c95007983885fd0c7d0dd4250cb9cc209d2648 Mon Sep 17 00:00:00 2001 From: Arvid Jakobsson Date: Fri, 3 Feb 2023 15:54:49 +0100 Subject: [PATCH 1/2] alcotezt: port [src/lib_stdlib_unix/test] --- manifest/main.ml | 11 ++--- opam/tezos-stdlib-unix.opam | 4 +- opam/tezos-stdlib.opam | 4 +- src/lib_stdlib/test-unix/dune | 49 +++++++++---------- .../test-unix/test_circular_buffer.ml | 1 - src/lib_stdlib_unix/test/dune | 30 +++++++++--- .../test/test_key_value_store_fuzzy.ml | 8 ++- tezt/tests/dune | 2 + 8 files changed, 68 insertions(+), 41 deletions(-) diff --git a/manifest/main.ml b/manifest/main.ml index 1a29d2fbb15d..7df55e099b71 100644 --- a/manifest/main.ml +++ b/manifest/main.ml @@ -505,7 +505,7 @@ let _octez_stdlib_tests = ~js_compatible:true let _octez_stdlib_test_unix = - tests + tezt [ "test_lwt_pipe"; "test_circular_buffer"; @@ -517,8 +517,7 @@ let _octez_stdlib_test_unix = ~deps: [ octez_stdlib |> open_; - alcotest; - alcotest_lwt; + alcotezt; lwt_log; bigstring; lwt_unix; @@ -1037,8 +1036,8 @@ let octez_stdlib_unix = ] let _octez_stdlib_unix_test = - test - "test_key_value_store_fuzzy" + tezt + ["test_key_value_store_fuzzy"] ~path:"src/lib_stdlib_unix/test/" ~opam:"tezos-stdlib-unix" ~deps: @@ -1046,7 +1045,7 @@ let _octez_stdlib_unix_test = octez_error_monad |> open_ |> open_ ~m:"TzLwtreslib"; octez_stdlib_unix |> open_; qcheck_alcotest; - alcotest_lwt; + alcotezt; ] let octez_clic = diff --git a/opam/tezos-stdlib-unix.opam b/opam/tezos-stdlib-unix.opam index ec825979b16e..4e25077d3fe9 100644 --- a/opam/tezos-stdlib-unix.opam +++ b/opam/tezos-stdlib-unix.opam @@ -26,12 +26,14 @@ depends: [ "lwt_log" "conf-libev" "uri" { >= "3.1.0" } + "tezt" { with-test & >= "3.0.0" } "qcheck-alcotest" { with-test & >= "0.20" } - "alcotest-lwt" { with-test & >= "1.5.0" } + "octez-alcotezt" {with-test} ] build: [ ["rm" "-r" "vendors"] ["dune" "build" "-p" name "-j" jobs] ["dune" "runtest" "-p" name "-j" jobs] {with-test} + ["dune" "build" "@runtezt" "-p" name "-j" jobs] {with-test} ] synopsis: "Tezos: yet-another local-extension of the OCaml standard library (unix-specific fragment)" diff --git a/opam/tezos-stdlib.opam b/opam/tezos-stdlib.opam index 7581d2f6a3a6..2c556f94b44a 100644 --- a/opam/tezos-stdlib.opam +++ b/opam/tezos-stdlib.opam @@ -20,12 +20,14 @@ depends: [ "bigstring" {with-test} "tezos-test-helpers" {with-test} "qcheck-alcotest" { with-test & >= "0.20" } - "alcotest-lwt" { with-test & >= "1.5.0" } + "tezt" { with-test & >= "3.0.0" } + "octez-alcotezt" {with-test} "lwt_log" {with-test} ] build: [ ["rm" "-r" "vendors"] ["dune" "build" "-p" name "-j" jobs] ["dune" "runtest" "-p" name "-j" jobs] {with-test} + ["dune" "build" "@runtezt" "-p" name "-j" jobs] {with-test} ] synopsis: "Tezos: yet-another local-extension of the OCaml standard library" diff --git a/src/lib_stdlib/test-unix/dune b/src/lib_stdlib/test-unix/dune index d003644b17df..6168adb3e6a9 100644 --- a/src/lib_stdlib/test-unix/dune +++ b/src/lib_stdlib/test-unix/dune @@ -1,42 +1,41 @@ ; This file was automatically generated, do not edit. ; Edit file manifest/main.ml instead. -(executables - (names - test_lwt_pipe - test_circular_buffer - test_circular_buffer_fuzzy - test_hash_queue_lwt) +(library + (name src_lib_stdlib_test_unix_tezt_lib) + (instrumentation (backend bisect_ppx)) (libraries + tezt.core tezos-stdlib - alcotest - alcotest-lwt + octez-alcotezt lwt_log bigstring lwt.unix tezos-test-helpers qcheck-alcotest) + (library_flags (:standard -linkall)) (flags (:standard) + -open Tezt_core + -open Tezt_core.Base -open Tezos_stdlib - -open Tezos_test_helpers)) - -(rule - (alias runtest) - (package tezos-stdlib) - (action (run %{dep:./test_lwt_pipe.exe}))) + -open Octez_alcotezt + -open Tezos_test_helpers) + (modules + test_lwt_pipe + test_circular_buffer + test_circular_buffer_fuzzy + test_hash_queue_lwt)) -(rule - (alias runtest) - (package tezos-stdlib) - (action (run %{dep:./test_circular_buffer.exe}))) +(executable + (name main) + (libraries + src_lib_stdlib_test_unix_tezt_lib + tezt) + (modules main)) -(rule - (alias runtest) - (package tezos-stdlib) - (action (run %{dep:./test_circular_buffer_fuzzy.exe}))) +(rule (alias runtezt) (package tezos-stdlib) (action (run %{dep:./main.exe}))) (rule - (alias runtest) - (package tezos-stdlib) - (action (run %{dep:./test_hash_queue_lwt.exe}))) + (targets main.ml) + (action (with-stdout-to %{targets} (echo "let () = Tezt.Test.run ()")))) diff --git a/src/lib_stdlib/test-unix/test_circular_buffer.ml b/src/lib_stdlib/test-unix/test_circular_buffer.ml index f315f9260cd5..4dc3908cab9c 100644 --- a/src/lib_stdlib/test-unix/test_circular_buffer.ml +++ b/src/lib_stdlib/test-unix/test_circular_buffer.ml @@ -359,7 +359,6 @@ let wrap n f = let () = Alcotest.run - ~argv:[|""|] "tezos-stdlib" (List.map (fun (run, descr) -> diff --git a/src/lib_stdlib_unix/test/dune b/src/lib_stdlib_unix/test/dune index ed0a034ba0d7..5210e8034e4a 100644 --- a/src/lib_stdlib_unix/test/dune +++ b/src/lib_stdlib_unix/test/dune @@ -1,20 +1,38 @@ ; This file was automatically generated, do not edit. ; Edit file manifest/main.ml instead. -(executable - (name test_key_value_store_fuzzy) +(library + (name src_lib_stdlib_unix_test__tezt_lib) + (instrumentation (backend bisect_ppx)) (libraries + tezt.core tezos-error-monad tezos-stdlib-unix qcheck-alcotest - alcotest-lwt) + octez-alcotezt) + (library_flags (:standard -linkall)) (flags (:standard) + -open Tezt_core + -open Tezt_core.Base -open Tezos_error_monad -open Tezos_error_monad.TzLwtreslib - -open Tezos_stdlib_unix)) + -open Tezos_stdlib_unix + -open Octez_alcotezt) + (modules test_key_value_store_fuzzy)) + +(executable + (name main) + (libraries + src_lib_stdlib_unix_test__tezt_lib + tezt) + (modules main)) (rule - (alias runtest) + (alias runtezt) (package tezos-stdlib-unix) - (action (run %{dep:./test_key_value_store_fuzzy.exe}))) + (action (run %{dep:./main.exe}))) + +(rule + (targets main.ml) + (action (with-stdout-to %{targets} (echo "let () = Tezt.Test.run ()")))) diff --git a/src/lib_stdlib_unix/test/test_key_value_store_fuzzy.ml b/src/lib_stdlib_unix/test/test_key_value_store_fuzzy.ml index 621f9004e12c..ad778a73ca0f 100644 --- a/src/lib_stdlib_unix/test/test_key_value_store_fuzzy.ml +++ b/src/lib_stdlib_unix/test/test_key_value_store_fuzzy.ml @@ -497,4 +497,10 @@ let parallel_test = | Error err -> QCheck2.Test.fail_reportf "%a@." Error_monad.pp_print_trace err) -let () = QCheck_base_runner.run_tests_main [sequential_test; parallel_test] +let () = + Alcotest.run + "test-key-value-store-fuzzy" + [ + ("sequential", [QCheck_alcotest.to_alcotest sequential_test]); + ("parallel", [QCheck_alcotest.to_alcotest parallel_test]); + ] diff --git a/tezt/tests/dune b/tezt/tests/dune index c8bd0f1d30af..d7123a51ea85 100644 --- a/tezt/tests/dune +++ b/tezt/tests/dune @@ -16,6 +16,8 @@ src_proto_alpha_lib_protocol_test_regression_tezt_lib src_proto_016_PtMumbai_lib_protocol_test_regression_tezt_lib src_proto_015_PtLimaPt_lib_protocol_test_regression_tezt_lib + src_lib_stdlib_unix_test__tezt_lib + src_lib_stdlib_test_unix_tezt_lib src_lib_p2p_tezt_tezt_lib src_lib_lwt_result_stdlib_test_tezt_lib src_lib_error_monad_test_tezt_lib -- GitLab From 353c992526761982a46966d64d757a304eadacc3 Mon Sep 17 00:00:00 2001 From: Pietro Abate Date: Tue, 14 Feb 2023 10:08:20 +0100 Subject: [PATCH 2/2] alcotezt: port [src/lib_stdlib/test] --- manifest/main.ml | 5 +- opam/tezos-stdlib.opam | 5 +- src/lib_stdlib/test/dune | 125 +++++++++++++-------------------------- tezt/tests/dune | 1 + 4 files changed, 48 insertions(+), 88 deletions(-) diff --git a/manifest/main.ml b/manifest/main.ml index 7df55e099b71..ebfa8ee5cebb 100644 --- a/manifest/main.ml +++ b/manifest/main.ml @@ -480,7 +480,7 @@ let octez_stdlib = ~foreign_stubs:{language = C; flags = []; names = ["tzBytes_c"]} let _octez_stdlib_tests = - tests + tezt [ "test_bits"; "test_tzList"; @@ -490,6 +490,7 @@ let _octez_stdlib_tests = "test_functionalArray"; "test_hash_queue"; "test_tzBytes"; + "test_arrays"; ] ~path:"src/lib_stdlib/test" ~opam:"tezos-stdlib" @@ -497,7 +498,7 @@ let _octez_stdlib_tests = ~deps: [ octez_stdlib |> open_; - alcotest; + alcotezt; bigstring; octez_test_helpers |> open_; qcheck_alcotest; diff --git a/opam/tezos-stdlib.opam b/opam/tezos-stdlib.opam index 2c556f94b44a..f3bd79d8188e 100644 --- a/opam/tezos-stdlib.opam +++ b/opam/tezos-stdlib.opam @@ -16,12 +16,11 @@ depends: [ "zarith_stubs_js" "lwt" { >= "5.6.0" } "aches" { >= "1.0.0" } - "alcotest" { with-test & >= "1.5.0" } + "tezt" { with-test & >= "3.0.0" } + "octez-alcotezt" {with-test} "bigstring" {with-test} "tezos-test-helpers" {with-test} "qcheck-alcotest" { with-test & >= "0.20" } - "tezt" { with-test & >= "3.0.0" } - "octez-alcotezt" {with-test} "lwt_log" {with-test} ] build: [ diff --git a/src/lib_stdlib/test/dune b/src/lib_stdlib/test/dune index f5e0fa6d2268..fb6ca69fe289 100644 --- a/src/lib_stdlib/test/dune +++ b/src/lib_stdlib/test/dune @@ -1,105 +1,64 @@ ; This file was automatically generated, do not edit. ; Edit file manifest/main.ml instead. -(executables - (names - test_bits - test_tzList - test_bounded_heap - test_tzString - test_fallbackArray - test_functionalArray - test_hash_queue - test_tzBytes) - (modes native js) +(library + (name src_lib_stdlib_test_tezt_lib) + (instrumentation (backend bisect_ppx)) (libraries + tezt.core tezos-stdlib - alcotest + octez-alcotezt bigstring tezos-test-helpers qcheck-alcotest) (js_of_ocaml) + (library_flags (:standard -linkall)) (flags (:standard) + -open Tezt_core + -open Tezt_core.Base -open Tezos_stdlib - -open Tezos_test_helpers)) - -(rule - (alias runtest) - (package tezos-stdlib) - (action (run %{dep:./test_bits.exe}))) - -(rule - (alias runtest) - (package tezos-stdlib) - (action (run %{dep:./test_tzList.exe}))) - -(rule - (alias runtest) - (package tezos-stdlib) - (action (run %{dep:./test_bounded_heap.exe}))) - -(rule - (alias runtest) - (package tezos-stdlib) - (action (run %{dep:./test_tzString.exe}))) - -(rule - (alias runtest) - (package tezos-stdlib) - (action (run %{dep:./test_fallbackArray.exe}))) - -(rule - (alias runtest) - (package tezos-stdlib) - (action (run %{dep:./test_functionalArray.exe}))) - -(rule - (alias runtest) - (package tezos-stdlib) - (action (run %{dep:./test_hash_queue.exe}))) - -(rule - (alias runtest) - (package tezos-stdlib) - (action (run %{dep:./test_tzBytes.exe}))) - -(rule - (alias runtest_js) - (package tezos-stdlib) - (action (run node %{dep:./test_bits.bc.js}))) - -(rule - (alias runtest_js) - (package tezos-stdlib) - (action (run node %{dep:./test_tzList.bc.js}))) + -open Octez_alcotezt + -open Tezos_test_helpers) + (modules + test_bits + test_tzList + test_bounded_heap + test_tzString + test_fallbackArray + test_functionalArray + test_hash_queue + test_tzBytes + test_arrays)) -(rule - (alias runtest_js) - (package tezos-stdlib) - (action (run node %{dep:./test_bounded_heap.bc.js}))) +(executable + (name main) + (modes native) + (libraries + src_lib_stdlib_test_tezt_lib + tezt) + (modules main)) -(rule - (alias runtest_js) - (package tezos-stdlib) - (action (run node %{dep:./test_tzString.bc.js}))) +(rule (alias runtezt) (package tezos-stdlib) (action (run %{dep:./main.exe}))) (rule - (alias runtest_js) - (package tezos-stdlib) - (action (run node %{dep:./test_fallbackArray.bc.js}))) + (targets main.ml) + (action (with-stdout-to %{targets} (echo "let () = Tezt.Test.run ()")))) -(rule - (alias runtest_js) - (package tezos-stdlib) - (action (run node %{dep:./test_functionalArray.bc.js}))) +(executable + (name main_js) + (modes js) + (libraries + src_lib_stdlib_test_tezt_lib + tezt.js) + (js_of_ocaml) + (modules main_js)) (rule - (alias runtest_js) + (alias runtezt_js) (package tezos-stdlib) - (action (run node %{dep:./test_hash_queue.bc.js}))) + (action (run node %{dep:./main_js.bc.js}))) (rule - (alias runtest_js) - (package tezos-stdlib) - (action (run node %{dep:./test_tzBytes.bc.js}))) + (targets main_js.ml) + (action (with-stdout-to %{targets} (echo "let () = Tezt_js.Test.run ()")))) diff --git a/tezt/tests/dune b/tezt/tests/dune index d7123a51ea85..cfed44a9ad95 100644 --- a/tezt/tests/dune +++ b/tezt/tests/dune @@ -18,6 +18,7 @@ src_proto_015_PtLimaPt_lib_protocol_test_regression_tezt_lib src_lib_stdlib_unix_test__tezt_lib src_lib_stdlib_test_unix_tezt_lib + src_lib_stdlib_test_tezt_lib src_lib_p2p_tezt_tezt_lib src_lib_lwt_result_stdlib_test_tezt_lib src_lib_error_monad_test_tezt_lib -- GitLab