From 9a5e4bae4a6533d5fa60e76c1758f144ed6403f0 Mon Sep 17 00:00:00 2001 From: lykimq Date: Mon, 27 Feb 2023 14:46:07 +0100 Subject: [PATCH] Alcotezt: port [src/proto_/lib_protocol/test/unit] --- .gitlab/ci/jobs/coverage/coverage.yml | 1 - .gitlab/ci/jobs/test/unit.yml | 9 -- manifest/main.ml | 52 +++++++--- opam/tezos-protocol-015-PtLimaPt-tests.opam | 8 +- opam/tezos-protocol-016-PtMumbai-tests.opam | 12 +-- opam/tezos-protocol-alpha-tests.opam | 12 +-- .../lib_protocol/test/unit/dune | 59 +++++++++-- .../test/unit/{main.ml => test_main.ml} | 67 ++++++++----- .../lib_protocol/test/unit/dune | 68 +++++++++++-- .../lib_protocol/test/unit/test_main.ml} | 99 ++++++++++++------- src/proto_alpha/lib_protocol/test/unit/dune | 66 +++++++++++-- .../lib_protocol/test/unit/test_main.ml} | 97 +++++++++++------- tezt/lib_alcotezt/alcotest.ml | 2 + tezt/lib_alcotezt/alcotest.mli | 3 + tezt/tests/dune | 3 + 15 files changed, 400 insertions(+), 158 deletions(-) rename src/proto_015_PtLimaPt/lib_protocol/test/unit/{main.ml => test_main.ml} (60%) rename src/{proto_alpha/lib_protocol/test/unit/main.ml => proto_016_PtMumbai/lib_protocol/test/unit/test_main.ml} (52%) rename src/{proto_016_PtMumbai/lib_protocol/test/unit/main.ml => proto_alpha/lib_protocol/test/unit/test_main.ml} (54%) diff --git a/.gitlab/ci/jobs/coverage/coverage.yml b/.gitlab/ci/jobs/coverage/coverage.yml index 03d0d7440961..0ae3295e0ba0 100644 --- a/.gitlab/ci/jobs/coverage/coverage.yml +++ b/.gitlab/ci/jobs/coverage/coverage.yml @@ -57,7 +57,6 @@ unified_coverage: - "tezt 40/40" - "unit:alpha: [proto_alpha]" - "unit:alpha: [proto_alpha__lib_protocol__2]" - - "unit:alpha: [proto_alpha__lib_protocol__3]" - "unit:non-proto-x86_64" script: diff --git a/.gitlab/ci/jobs/test/unit.yml b/.gitlab/ci/jobs/test/unit.yml index 002aa28394fc..8f5eaa8a3cec 100644 --- a/.gitlab/ci/jobs/test/unit.yml +++ b/.gitlab/ci/jobs/test/unit.yml @@ -51,13 +51,10 @@ unit:015_PtLimaPt: proto_015_PtLimaPt__lib_protocol__2: > @src/proto_015_PtLimaPt/lib_protocol/test/integration/michelson/runtest @src/proto_015_PtLimaPt/lib_protocol/test/integration/validate/runtest - proto_015_PtLimaPt__lib_protocol__3: > - @src/proto_015_PtLimaPt/lib_protocol/test/unit/runtest parallel: matrix: - TEST_TARGETS: - proto_015_PtLimaPt__lib_protocol__2 - - proto_015_PtLimaPt__lib_protocol__3 script: - scripts/test_wrapper.sh $TEST_TARGETS ${!TEST_TARGETS} - ./scripts/ci/merge_coverage.sh @@ -72,15 +69,12 @@ unit:016_PtMumbai: proto_016_PtMumbai__lib_protocol__2: > @src/proto_016_PtMumbai/lib_protocol/test/integration/michelson/runtest @src/proto_016_PtMumbai/lib_protocol/test/integration/validate/runtest - proto_016_PtMumbai__lib_protocol__3: > - @src/proto_016_PtMumbai/lib_protocol/test/unit/runtest proto_016_PtMumbai: > @src/proto_016_PtMumbai/lib_dal/runtest parallel: matrix: - TEST_TARGETS: - proto_016_PtMumbai__lib_protocol__2 - - proto_016_PtMumbai__lib_protocol__3 - proto_016_PtMumbai script: - scripts/test_wrapper.sh $TEST_TARGETS ${!TEST_TARGETS} @@ -96,15 +90,12 @@ unit:alpha: proto_alpha__lib_protocol__2: > @src/proto_alpha/lib_protocol/test/integration/michelson/runtest @src/proto_alpha/lib_protocol/test/integration/validate/runtest - proto_alpha__lib_protocol__3: > - @src/proto_alpha/lib_protocol/test/unit/runtest proto_alpha: > @src/proto_alpha/lib_dal/runtest parallel: matrix: - TEST_TARGETS: - proto_alpha__lib_protocol__2 - - proto_alpha__lib_protocol__3 - proto_alpha script: - scripts/test_wrapper.sh $TEST_TARGETS ${!TEST_TARGETS} diff --git a/manifest/main.ml b/manifest/main.ml index 00e63a8f4f62..8346214a4798 100644 --- a/manifest/main.ml +++ b/manifest/main.ml @@ -4103,11 +4103,47 @@ end = struct ] in let _unit = - test - "main" + let modules = + [ + ("test_main", true); + ("test_bond_id_repr", true); + ("test_consensus_key", true); + ("test_contract_repr", true); + ("test_destination_repr", true); + ("test_fitness", true); + ("test_fixed_point", true); + ("test_gas_monad", true); + ("test_global_constants_storage", true); + ("test_level_module", true); + ("test_liquidity_baking_repr", true); + ("test_merkle_list", true); + ("test_operation_repr", true); + ("test_qty", true); + ("test_receipt", true); + ("test_round_repr", true); + ("test_saturation", true); + ("test_sc_rollup_arith", N.(number >= 016)); + ("test_sc_rollup_game", N.(number >= 016)); + ("test_sc_rollup_inbox", N.(number >= 016)); + ("test_sc_rollup_management_protocol", N.(number >= 016)); + ("test_sc_rollup_storage", N.(number >= 016)); + ("test_skip_list_repr", true); + ("test_tez_repr", true); + ("test_time_repr", true); + ("test_zk_rollup_storage", true); + ("test_sc_rollup_inbox_legacy", N.(number >= 016)); + ("test_sc_rollup_wasm", N.(number >= 016)); + ("test_local_contexts", N.(number >= 016)); + ("test_dal_slot_proof", N.(number >= 016)); + ("test_tx_rollup_l2_apply", N.(number >= 015 && number <= 016)); + ("test_tx_rollup_l2", N.(number >= 015 && number <= 016)); + ] + |> List.filter_map (fun (n, b) -> if b then Some n else None) + in + tezt + modules ~path:(path // "lib_protocol/test/unit") ~opam:(sf "tezos-protocol-%s-tests" name_dash) - ~alias:"" ~with_macos_security_framework:true ~deps: [ @@ -4123,7 +4159,7 @@ end = struct main |> open_; octez_test_helpers |> open_; test_helpers |> if_some |> open_; - alcotest_lwt; + alcotezt; octez_scoru_wasm_helpers |> if_ N.(number >= 016) |> open_; octez_stdlib |> if_ N.(number >= 013) |> open_; octez_crypto_dal |> if_ N.(number >= 016) |> open_; @@ -4132,14 +4168,6 @@ end = struct |> if_ N.(number >= 016) |> open_; ] - ~dune: - Dune. - [ - alias_rule - "runtest" - ~package:(sf "tezos-protocol-%s-tests" name_dash) - ~action:(run_exe "main" ["test"; "Unit"]); - ] in let _regresssion = if N.(number >= 014) then diff --git a/opam/tezos-protocol-015-PtLimaPt-tests.opam b/opam/tezos-protocol-015-PtLimaPt-tests.opam index c53e0d69dd87..1253b62d9866 100644 --- a/opam/tezos-protocol-015-PtLimaPt-tests.opam +++ b/opam/tezos-protocol-015-PtLimaPt-tests.opam @@ -23,15 +23,15 @@ depends: [ "tezos-protocol-plugin-015-PtLimaPt" {with-test} "qcheck-alcotest" { with-test & >= "0.20" } "tezos-test-helpers" {with-test} + "tezt" { with-test & >= "3.0.0" } + "tezos-context" {with-test} + "octez-alcotezt" {with-test} + "tezt-tezos" {with-test} "tezos-client-base" {with-test} "tezos-protocol-environment" {with-test} "tezos-stdlib-unix" {with-test} "tezos-stdlib" {with-test} "tezos-scoru-wasm" {with-test} - "tezt" { with-test & >= "3.0.0" } - "tezos-context" {with-test} - "octez-alcotezt" {with-test} - "tezt-tezos" {with-test} ] build: [ ["rm" "-r" "vendors"] diff --git a/opam/tezos-protocol-016-PtMumbai-tests.opam b/opam/tezos-protocol-016-PtMumbai-tests.opam index d303807be635..fd9444820898 100644 --- a/opam/tezos-protocol-016-PtMumbai-tests.opam +++ b/opam/tezos-protocol-016-PtMumbai-tests.opam @@ -23,19 +23,19 @@ depends: [ "tezos-protocol-plugin-016-PtMumbai" {with-test} "qcheck-alcotest" { with-test & >= "0.20" } "tezos-test-helpers" {with-test} + "tezt" { with-test & >= "3.0.0" } + "tezos-context" {with-test} + "octez-alcotezt" {with-test} + "tezos-smart-rollup-016-PtMumbai" {with-test} + "tezos-crypto-dal" {with-test} + "tezt-tezos" {with-test} "tezos-client-base" {with-test} "tezos-protocol-environment" {with-test} "tezos-stdlib-unix" {with-test} "tezos-scoru-wasm-helpers" {with-test} "tezos-stdlib" {with-test} - "tezos-crypto-dal" {with-test} "tezos-scoru-wasm" {with-test} "tezos-webassembly-interpreter-extra" {with-test} - "tezt" { with-test & >= "3.0.0" } - "tezos-context" {with-test} - "octez-alcotezt" {with-test} - "tezos-smart-rollup-016-PtMumbai" {with-test} - "tezt-tezos" {with-test} ] build: [ ["rm" "-r" "vendors"] diff --git a/opam/tezos-protocol-alpha-tests.opam b/opam/tezos-protocol-alpha-tests.opam index 707dafbd5347..9a73fc63fd20 100644 --- a/opam/tezos-protocol-alpha-tests.opam +++ b/opam/tezos-protocol-alpha-tests.opam @@ -23,19 +23,19 @@ depends: [ "tezos-protocol-plugin-alpha" {with-test} "qcheck-alcotest" { with-test & >= "0.20" } "tezos-test-helpers" {with-test} + "tezt" { with-test & >= "3.0.0" } + "tezos-context" {with-test} + "octez-alcotezt" {with-test} + "tezos-smart-rollup-alpha" {with-test} + "tezos-crypto-dal" {with-test} + "tezt-tezos" {with-test} "tezos-client-base" {with-test} "tezos-protocol-environment" {with-test} "tezos-stdlib-unix" {with-test} "tezos-scoru-wasm-helpers" {with-test} "tezos-stdlib" {with-test} - "tezos-crypto-dal" {with-test} "tezos-scoru-wasm" {with-test} "tezos-webassembly-interpreter-extra" {with-test} - "tezt" { with-test & >= "3.0.0" } - "tezos-context" {with-test} - "octez-alcotezt" {with-test} - "tezos-smart-rollup-alpha" {with-test} - "tezt-tezos" {with-test} ] build: [ ["rm" "-r" "vendors"] diff --git a/src/proto_015_PtLimaPt/lib_protocol/test/unit/dune b/src/proto_015_PtLimaPt/lib_protocol/test/unit/dune index beab42e994f8..1bf65b18017f 100644 --- a/src/proto_015_PtLimaPt/lib_protocol/test/unit/dune +++ b/src/proto_015_PtLimaPt/lib_protocol/test/unit/dune @@ -1,9 +1,11 @@ ; This file was automatically generated, do not edit. ; Edit file manifest/main.ml instead. -(executable - (name main) +(library + (name src_proto_015_PtLimaPt_lib_protocol_test_unit_tezt_lib) + (instrumentation (backend bisect_ppx)) (libraries + tezt.core tezos-base tezos-base-test-helpers tezos-micheline @@ -15,14 +17,14 @@ tezos-protocol-015-PtLimaPt tezos-test-helpers tezos-015-PtLimaPt-test-helpers - alcotest-lwt + octez-alcotezt tezos-stdlib tezos-scoru-wasm) - (link_flags - (:standard) - (:include %{workspace_root}/macos-link-flags.sexp)) + (library_flags (:standard -linkall)) (flags (:standard) + -open Tezt_core + -open Tezt_core.Base -open Tezos_base.TzPervasives -open Tezos_base.TzPervasives.Error_monad.Legacy_monad_globals -open Tezos_base_test_helpers @@ -31,9 +33,48 @@ -open Tezos_protocol_015_PtLimaPt -open Tezos_test_helpers -open Tezos_015_PtLimaPt_test_helpers - -open Tezos_stdlib)) + -open Octez_alcotezt + -open Tezos_stdlib) + (modules + test_main + test_bond_id_repr + test_consensus_key + test_contract_repr + test_destination_repr + test_fitness + test_fixed_point + test_gas_monad + test_global_constants_storage + test_level_module + test_liquidity_baking_repr + test_merkle_list + test_operation_repr + test_qty + test_receipt + test_round_repr + test_saturation + test_skip_list_repr + test_tez_repr + test_time_repr + test_zk_rollup_storage + test_tx_rollup_l2_apply + test_tx_rollup_l2)) + +(executable + (name main) + (libraries + src_proto_015_PtLimaPt_lib_protocol_test_unit_tezt_lib + tezt) + (link_flags + (:standard) + (:include %{workspace_root}/macos-link-flags.sexp)) + (modules main)) (rule - (alias runtest) + (alias runtezt) (package tezos-protocol-015-PtLimaPt-tests) - (action (run %{exe:main.exe} test Unit))) + (action (run %{dep:./main.exe}))) + +(rule + (targets main.ml) + (action (with-stdout-to %{targets} (echo "let () = Tezt.Test.run ()")))) diff --git a/src/proto_015_PtLimaPt/lib_protocol/test/unit/main.ml b/src/proto_015_PtLimaPt/lib_protocol/test/unit/test_main.ml similarity index 60% rename from src/proto_015_PtLimaPt/lib_protocol/test/unit/main.ml rename to src/proto_015_PtLimaPt/lib_protocol/test/unit/test_main.ml index 12b3701f9241..eb3ebe1bfc76 100644 --- a/src/proto_015_PtLimaPt/lib_protocol/test/unit/main.ml +++ b/src/proto_015_PtLimaPt/lib_protocol/test/unit/test_main.ml @@ -49,32 +49,49 @@ let () = Alcotest_lwt.run "protocol > unit" [ - Unit_test.spec "Alpha_context.ml" Test_alpha_context.tests; - Unit_test.spec "Raw_level_repr.ml" Test_raw_level_repr.tests; - Unit_test.skip "Raw_level_repr.ml" Test_raw_level_repr.skipped_tests; - Unit_test.spec "Tez_repr.ml" Test_tez_repr.tests; - Unit_test.spec "Contract_repr.ml" Test_contract_repr.tests; - Unit_test.spec "Destination_repr.ml" Test_destination_repr.tests; - Unit_test.spec "Operation_repr.ml" Test_operation_repr.tests; + Unit_test.spec (Protocol.name ^ ": Tez_repr.ml") Test_tez_repr.tests; Unit_test.spec - "Global_constants_storage.ml" + (Protocol.name ^ ": Contract_repr.ml") + Test_contract_repr.tests; + Unit_test.spec + (Protocol.name ^ ": Destination_repr.ml") + Test_destination_repr.tests; + Unit_test.spec + (Protocol.name ^ ": Operation_repr.ml") + Test_operation_repr.tests; + Unit_test.spec + (Protocol.name ^ ": Global_constants_storage.ml") Test_global_constants_storage.tests; - Unit_test.spec "fitness" Test_fitness.tests; - Unit_test.spec "fixed point computation" Test_fixed_point.tests; - Unit_test.spec "level module" Test_level_module.tests; - Unit_test.spec "qty" Test_qty.tests; - Unit_test.spec "round" Test_round_repr.tests; - Unit_test.spec "time" Test_time_repr.tests; - Unit_test.spec "receipt encodings" Test_receipt.tests; - Unit_test.spec "saturation arithmetic" Test_saturation.tests; - Unit_test.spec "gas monad" Test_gas_monad.tests; - Unit_test.spec "tx rollup l2" Test_tx_rollup_l2.tests; - Unit_test.spec "tx rollup l2 apply" Test_tx_rollup_l2_apply.tests; - Unit_test.spec "liquidity baking" Test_liquidity_baking_repr.tests; - Unit_test.spec "merkle list" Test_merkle_list.tests; - Unit_test.spec "skip list" Test_skip_list_repr.tests; - Unit_test.spec "Bond_id_repr.ml" Test_bond_id_repr.tests; - Unit_test.spec "zk rollup storage" Test_zk_rollup_storage.tests; - Unit_test.spec "Delegate_consensus_key.ml" Test_consensus_key.tests; + Unit_test.spec (Protocol.name ^ ": fitness") Test_fitness.tests; + Unit_test.spec + (Protocol.name ^ ": fixed point computation") + Test_fixed_point.tests; + Unit_test.spec (Protocol.name ^ ": level module") Test_level_module.tests; + Unit_test.spec (Protocol.name ^ ": qty") Test_qty.tests; + Unit_test.spec (Protocol.name ^ ": round") Test_round_repr.tests; + Unit_test.spec (Protocol.name ^ ": time") Test_time_repr.tests; + Unit_test.spec (Protocol.name ^ ": receipt encodings") Test_receipt.tests; + Unit_test.spec + (Protocol.name ^ ": saturation arithmetic") + Test_saturation.tests; + Unit_test.spec (Protocol.name ^ ": gas monad") Test_gas_monad.tests; + Unit_test.spec (Protocol.name ^ ": tx rollup l2") Test_tx_rollup_l2.tests; + Unit_test.spec + (Protocol.name ^ ": tx rollup l2 apply") + Test_tx_rollup_l2_apply.tests; + Unit_test.spec + (Protocol.name ^ ": liquidity baking") + Test_liquidity_baking_repr.tests; + Unit_test.spec (Protocol.name ^ ": merkle list") Test_merkle_list.tests; + Unit_test.spec (Protocol.name ^ ": skip list") Test_skip_list_repr.tests; + Unit_test.spec + (Protocol.name ^ ": Bond_id_repr.ml") + Test_bond_id_repr.tests; + Unit_test.spec + (Protocol.name ^ ": zk rollup storage") + Test_zk_rollup_storage.tests; + Unit_test.spec + (Protocol.name ^ ": Delegate_consensus_key.ml") + Test_consensus_key.tests; ] |> Lwt_main.run diff --git a/src/proto_016_PtMumbai/lib_protocol/test/unit/dune b/src/proto_016_PtMumbai/lib_protocol/test/unit/dune index 8c380725b8b1..a2d5b10c93c6 100644 --- a/src/proto_016_PtMumbai/lib_protocol/test/unit/dune +++ b/src/proto_016_PtMumbai/lib_protocol/test/unit/dune @@ -1,9 +1,11 @@ ; This file was automatically generated, do not edit. ; Edit file manifest/main.ml instead. -(executable - (name main) +(library + (name src_proto_016_PtMumbai_lib_protocol_test_unit_tezt_lib) + (instrumentation (backend bisect_ppx)) (libraries + tezt.core tezos-base tezos-base-test-helpers tezos-micheline @@ -15,17 +17,17 @@ tezos-protocol-016-PtMumbai tezos-test-helpers tezos-016-PtMumbai-test-helpers - alcotest-lwt + octez-alcotezt tezos-scoru-wasm-helpers tezos-stdlib tezos-crypto-dal tezos-scoru-wasm tezos-webassembly-interpreter-extra) - (link_flags - (:standard) - (:include %{workspace_root}/macos-link-flags.sexp)) + (library_flags (:standard -linkall)) (flags (:standard) + -open Tezt_core + -open Tezt_core.Base -open Tezos_base.TzPervasives -open Tezos_base.TzPervasives.Error_monad.Legacy_monad_globals -open Tezos_base_test_helpers @@ -35,12 +37,60 @@ -open Tezos_protocol_016_PtMumbai -open Tezos_test_helpers -open Tezos_016_PtMumbai_test_helpers + -open Octez_alcotezt -open Tezos_scoru_wasm_helpers -open Tezos_stdlib -open Tezos_crypto_dal - -open Tezos_webassembly_interpreter_extra)) + -open Tezos_webassembly_interpreter_extra) + (modules + test_main + test_bond_id_repr + test_consensus_key + test_contract_repr + test_destination_repr + test_fitness + test_fixed_point + test_gas_monad + test_global_constants_storage + test_level_module + test_liquidity_baking_repr + test_merkle_list + test_operation_repr + test_qty + test_receipt + test_round_repr + test_saturation + test_sc_rollup_arith + test_sc_rollup_game + test_sc_rollup_inbox + test_sc_rollup_management_protocol + test_sc_rollup_storage + test_skip_list_repr + test_tez_repr + test_time_repr + test_zk_rollup_storage + test_sc_rollup_inbox_legacy + test_sc_rollup_wasm + test_local_contexts + test_dal_slot_proof + test_tx_rollup_l2_apply + test_tx_rollup_l2)) + +(executable + (name main) + (libraries + src_proto_016_PtMumbai_lib_protocol_test_unit_tezt_lib + tezt) + (link_flags + (:standard) + (:include %{workspace_root}/macos-link-flags.sexp)) + (modules main)) (rule - (alias runtest) + (alias runtezt) (package tezos-protocol-016-PtMumbai-tests) - (action (run %{exe:main.exe} test Unit))) + (action (run %{dep:./main.exe}))) + +(rule + (targets main.ml) + (action (with-stdout-to %{targets} (echo "let () = Tezt.Test.run ()")))) diff --git a/src/proto_alpha/lib_protocol/test/unit/main.ml b/src/proto_016_PtMumbai/lib_protocol/test/unit/test_main.ml similarity index 52% rename from src/proto_alpha/lib_protocol/test/unit/main.ml rename to src/proto_016_PtMumbai/lib_protocol/test/unit/test_main.ml index e1bc03e93e34..c1119bef75aa 100644 --- a/src/proto_alpha/lib_protocol/test/unit/main.ml +++ b/src/proto_016_PtMumbai/lib_protocol/test/unit/test_main.ml @@ -49,40 +49,73 @@ let () = Alcotest_lwt.run "protocol > unit" [ - Unit_test.spec "Alpha_context.ml" Test_alpha_context.tests; - Unit_test.spec "Raw_level_repr.ml" Test_raw_level_repr.tests; - Unit_test.skip "Raw_level_repr.ml" Test_raw_level_repr.skipped_tests; - Unit_test.spec "Tez_repr.ml" Test_tez_repr.tests; - Unit_test.spec "Contract_repr.ml" Test_contract_repr.tests; - Unit_test.spec "Destination_repr.ml" Test_destination_repr.tests; - Unit_test.spec "Operation_repr.ml" Test_operation_repr.tests; - Unit_test.spec - "Global_constants_storage.ml" + Unit_test.spec (Protocol.name ^ ": Tez_repr.ml") Test_tez_repr.tests; + Unit_test.spec + (Protocol.name ^ ": Contract_repr.ml") + Test_contract_repr.tests; + Unit_test.spec + (Protocol.name ^ ": Destination_repr.ml") + Test_destination_repr.tests; + Unit_test.spec + (Protocol.name ^ ": Operation_repr.ml") + Test_operation_repr.tests; + Unit_test.spec + (Protocol.name ^ ": Global_constants_storage.ml") Test_global_constants_storage.tests; - Unit_test.spec "fitness" Test_fitness.tests; - Unit_test.spec "fixed point computation" Test_fixed_point.tests; - Unit_test.spec "level module" Test_level_module.tests; - Unit_test.spec "qty" Test_qty.tests; - Unit_test.spec "round" Test_round_repr.tests; - Unit_test.spec "time" Test_time_repr.tests; - Unit_test.spec "receipt encodings" Test_receipt.tests; - Unit_test.spec "saturation arithmetic" Test_saturation.tests; - Unit_test.spec "gas monad" Test_gas_monad.tests; - Unit_test.spec "sc rollup storage" Test_sc_rollup_storage.tests; - Unit_test.spec "sc rollup game" Test_sc_rollup_game.tests; - Unit_test.spec "liquidity baking" Test_liquidity_baking_repr.tests; - Unit_test.spec "sc rollup wasm" Test_sc_rollup_wasm.tests; - Unit_test.spec "sc rollup arith" Test_sc_rollup_arith.tests; - Unit_test.spec "merkle list" Test_merkle_list.tests; - Unit_test.spec "sc rollup inbox" Test_sc_rollup_inbox.tests; - Unit_test.spec "skip list" Test_skip_list_repr.tests; - Unit_test.spec - "sc rollup management protocol" + Unit_test.spec (Protocol.name ^ ": fitness") Test_fitness.tests; + Unit_test.spec + (Protocol.name ^ ": fixed point computation") + Test_fixed_point.tests; + Unit_test.spec (Protocol.name ^ ": level module") Test_level_module.tests; + Unit_test.spec (Protocol.name ^ ": qty") Test_qty.tests; + Unit_test.spec (Protocol.name ^ ": round") Test_round_repr.tests; + Unit_test.spec (Protocol.name ^ ": time") Test_time_repr.tests; + Unit_test.spec (Protocol.name ^ ": receipt encodings") Test_receipt.tests; + Unit_test.spec + (Protocol.name ^ ": saturation arithmetic") + Test_saturation.tests; + Unit_test.spec (Protocol.name ^ ": gas monad") Test_gas_monad.tests; + Unit_test.spec + (Protocol.name ^ ": sc rollup storage") + Test_sc_rollup_storage.tests; + Unit_test.spec + (Protocol.name ^ ": sc rollup game") + Test_sc_rollup_game.tests; + Unit_test.spec (Protocol.name ^ ": tx rollup l2") Test_tx_rollup_l2.tests; + Unit_test.spec + (Protocol.name ^ ": tx rollup l2 apply") + Test_tx_rollup_l2_apply.tests; + Unit_test.spec + (Protocol.name ^ ": liquidity baking") + Test_liquidity_baking_repr.tests; + Unit_test.spec + (Protocol.name ^ ": sc rollup wasm") + Test_sc_rollup_wasm.tests; + Unit_test.spec + (Protocol.name ^ ": sc rollup arith") + Test_sc_rollup_arith.tests; + Unit_test.spec (Protocol.name ^ ": merkle list") Test_merkle_list.tests; + Unit_test.spec + (Protocol.name ^ ": sc rollup inbox") + Test_sc_rollup_inbox.tests; + Unit_test.spec (Protocol.name ^ ": skip list") Test_skip_list_repr.tests; + Unit_test.spec + (Protocol.name ^ ": sc rollup management protocol") Test_sc_rollup_management_protocol.tests; - Unit_test.spec "Bond_id_repr.ml" Test_bond_id_repr.tests; - Unit_test.spec "zk rollup storage" Test_zk_rollup_storage.tests; - Unit_test.spec "Delegate_consensus_key.ml" Test_consensus_key.tests; - Unit_test.spec "local_contexts" Test_local_contexts.tests; - Unit_test.spec "dal slot proof" Test_dal_slot_proof.tests; + Unit_test.spec + (Protocol.name ^ ": Bond_id_repr.ml") + Test_bond_id_repr.tests; + Unit_test.spec + (Protocol.name ^ ": zk rollup storage") + Test_zk_rollup_storage.tests; + Unit_test.spec + (Protocol.name ^ ": Delegate_consensus_key.ml") + Test_consensus_key.tests; + Unit_test.spec + (Protocol.name ^ ": local_contexts") + Test_local_contexts.tests; + Unit_test.spec + (Protocol.name ^ ": dal slot proof") + Test_dal_slot_proof.tests; ] |> Lwt_main.run diff --git a/src/proto_alpha/lib_protocol/test/unit/dune b/src/proto_alpha/lib_protocol/test/unit/dune index 977ac85da2d1..c05a839b6ff4 100644 --- a/src/proto_alpha/lib_protocol/test/unit/dune +++ b/src/proto_alpha/lib_protocol/test/unit/dune @@ -1,9 +1,11 @@ ; This file was automatically generated, do not edit. ; Edit file manifest/main.ml instead. -(executable - (name main) +(library + (name src_proto_alpha_lib_protocol_test_unit_tezt_lib) + (instrumentation (backend bisect_ppx)) (libraries + tezt.core tezos-base tezos-base-test-helpers tezos-micheline @@ -15,17 +17,17 @@ tezos-protocol-alpha tezos-test-helpers tezos-alpha-test-helpers - alcotest-lwt + octez-alcotezt tezos-scoru-wasm-helpers tezos-stdlib tezos-crypto-dal tezos-scoru-wasm tezos-webassembly-interpreter-extra) - (link_flags - (:standard) - (:include %{workspace_root}/macos-link-flags.sexp)) + (library_flags (:standard -linkall)) (flags (:standard) + -open Tezt_core + -open Tezt_core.Base -open Tezos_base.TzPervasives -open Tezos_base.TzPervasives.Error_monad.Legacy_monad_globals -open Tezos_base_test_helpers @@ -35,12 +37,58 @@ -open Tezos_protocol_alpha -open Tezos_test_helpers -open Tezos_alpha_test_helpers + -open Octez_alcotezt -open Tezos_scoru_wasm_helpers -open Tezos_stdlib -open Tezos_crypto_dal - -open Tezos_webassembly_interpreter_extra)) + -open Tezos_webassembly_interpreter_extra) + (modules + test_main + test_bond_id_repr + test_consensus_key + test_contract_repr + test_destination_repr + test_fitness + test_fixed_point + test_gas_monad + test_global_constants_storage + test_level_module + test_liquidity_baking_repr + test_merkle_list + test_operation_repr + test_qty + test_receipt + test_round_repr + test_saturation + test_sc_rollup_arith + test_sc_rollup_game + test_sc_rollup_inbox + test_sc_rollup_management_protocol + test_sc_rollup_storage + test_skip_list_repr + test_tez_repr + test_time_repr + test_zk_rollup_storage + test_sc_rollup_inbox_legacy + test_sc_rollup_wasm + test_local_contexts + test_dal_slot_proof)) + +(executable + (name main) + (libraries + src_proto_alpha_lib_protocol_test_unit_tezt_lib + tezt) + (link_flags + (:standard) + (:include %{workspace_root}/macos-link-flags.sexp)) + (modules main)) (rule - (alias runtest) + (alias runtezt) (package tezos-protocol-alpha-tests) - (action (run %{exe:main.exe} test Unit))) + (action (run %{dep:./main.exe}))) + +(rule + (targets main.ml) + (action (with-stdout-to %{targets} (echo "let () = Tezt.Test.run ()")))) diff --git a/src/proto_016_PtMumbai/lib_protocol/test/unit/main.ml b/src/proto_alpha/lib_protocol/test/unit/test_main.ml similarity index 54% rename from src/proto_016_PtMumbai/lib_protocol/test/unit/main.ml rename to src/proto_alpha/lib_protocol/test/unit/test_main.ml index f16000774d7c..c37b2ace40cc 100644 --- a/src/proto_016_PtMumbai/lib_protocol/test/unit/main.ml +++ b/src/proto_alpha/lib_protocol/test/unit/test_main.ml @@ -49,42 +49,69 @@ let () = Alcotest_lwt.run "protocol > unit" [ - Unit_test.spec "Alpha_context.ml" Test_alpha_context.tests; - Unit_test.spec "Raw_level_repr.ml" Test_raw_level_repr.tests; - Unit_test.skip "Raw_level_repr.ml" Test_raw_level_repr.skipped_tests; - Unit_test.spec "Tez_repr.ml" Test_tez_repr.tests; - Unit_test.spec "Contract_repr.ml" Test_contract_repr.tests; - Unit_test.spec "Destination_repr.ml" Test_destination_repr.tests; - Unit_test.spec "Operation_repr.ml" Test_operation_repr.tests; - Unit_test.spec - "Global_constants_storage.ml" + Unit_test.spec (Protocol.name ^ ": Tez_repr.ml") Test_tez_repr.tests; + Unit_test.spec + (Protocol.name ^ ": Contract_repr.ml") + Test_contract_repr.tests; + Unit_test.spec + (Protocol.name ^ ": Destination_repr.ml") + Test_destination_repr.tests; + Unit_test.spec + (Protocol.name ^ ": Operation_repr.ml") + Test_operation_repr.tests; + Unit_test.spec + (Protocol.name ^ ": Global_constants_storage.ml") Test_global_constants_storage.tests; - Unit_test.spec "fitness" Test_fitness.tests; - Unit_test.spec "fixed point computation" Test_fixed_point.tests; - Unit_test.spec "level module" Test_level_module.tests; - Unit_test.spec "qty" Test_qty.tests; - Unit_test.spec "round" Test_round_repr.tests; - Unit_test.spec "time" Test_time_repr.tests; - Unit_test.spec "receipt encodings" Test_receipt.tests; - Unit_test.spec "saturation arithmetic" Test_saturation.tests; - Unit_test.spec "gas monad" Test_gas_monad.tests; - Unit_test.spec "sc rollup storage" Test_sc_rollup_storage.tests; - Unit_test.spec "sc rollup game" Test_sc_rollup_game.tests; - Unit_test.spec "tx rollup l2" Test_tx_rollup_l2.tests; - Unit_test.spec "tx rollup l2 apply" Test_tx_rollup_l2_apply.tests; - Unit_test.spec "liquidity baking" Test_liquidity_baking_repr.tests; - Unit_test.spec "sc rollup wasm" Test_sc_rollup_wasm.tests; - Unit_test.spec "sc rollup arith" Test_sc_rollup_arith.tests; - Unit_test.spec "merkle list" Test_merkle_list.tests; - Unit_test.spec "sc rollup inbox" Test_sc_rollup_inbox.tests; - Unit_test.spec "skip list" Test_skip_list_repr.tests; - Unit_test.spec - "sc rollup management protocol" + Unit_test.spec (Protocol.name ^ ": fitness") Test_fitness.tests; + Unit_test.spec + (Protocol.name ^ ": fixed point computation") + Test_fixed_point.tests; + Unit_test.spec (Protocol.name ^ ": level module") Test_level_module.tests; + Unit_test.spec (Protocol.name ^ ": qty") Test_qty.tests; + Unit_test.spec (Protocol.name ^ ": round") Test_round_repr.tests; + Unit_test.spec (Protocol.name ^ ": time") Test_time_repr.tests; + Unit_test.spec (Protocol.name ^ ": receipt encodings") Test_receipt.tests; + Unit_test.spec + (Protocol.name ^ ": saturation arithmetic") + Test_saturation.tests; + Unit_test.spec (Protocol.name ^ ": gas monad") Test_gas_monad.tests; + Unit_test.spec + (Protocol.name ^ ": sc rollup storage") + Test_sc_rollup_storage.tests; + Unit_test.spec + (Protocol.name ^ ": sc rollup game") + Test_sc_rollup_game.tests; + Unit_test.spec + (Protocol.name ^ ": liquidity baking") + Test_liquidity_baking_repr.tests; + Unit_test.spec + (Protocol.name ^ ": sc rollup wasm") + Test_sc_rollup_wasm.tests; + Unit_test.spec + (Protocol.name ^ ": sc rollup arith") + Test_sc_rollup_arith.tests; + Unit_test.spec (Protocol.name ^ ": merkle list") Test_merkle_list.tests; + Unit_test.spec + (Protocol.name ^ ": sc rollup inbox") + Test_sc_rollup_inbox.tests; + Unit_test.spec (Protocol.name ^ ": skip list") Test_skip_list_repr.tests; + Unit_test.spec + (Protocol.name ^ ": sc rollup management protocol") Test_sc_rollup_management_protocol.tests; - Unit_test.spec "Bond_id_repr.ml" Test_bond_id_repr.tests; - Unit_test.spec "zk rollup storage" Test_zk_rollup_storage.tests; - Unit_test.spec "Delegate_consensus_key.ml" Test_consensus_key.tests; - Unit_test.spec "local_contexts" Test_local_contexts.tests; - Unit_test.spec "dal slot proof" Test_dal_slot_proof.tests; + Unit_test.spec + (Protocol.name ^ ": Bond_id_repr.ml") + Test_bond_id_repr.tests; + Unit_test.spec + (Protocol.name ^ ": zk rollup storage") + Test_zk_rollup_storage.tests; + Unit_test.spec + (Protocol.name ^ ": Delegate_consensus_key.ml") + Test_consensus_key.tests; + Unit_test.spec + (Protocol.name ^ ": local_contexts") + Test_local_contexts.tests; + Unit_test.spec + (Protocol.name ^ ": dal slot proof") + Test_dal_slot_proof.tests; ] |> Lwt_main.run diff --git a/tezt/lib_alcotezt/alcotest.ml b/tezt/lib_alcotezt/alcotest.ml index b7789ee10525..17654731c758 100644 --- a/tezt/lib_alcotezt/alcotest.ml +++ b/tezt/lib_alcotezt/alcotest.ml @@ -71,6 +71,8 @@ let pp (type a) (t : a testable) = let module T = (val t) in T.pp +let of_pp pp = testable pp ( = ) + let equal (type a) (t : a testable) = let module T = (val t) in T.equal diff --git a/tezt/lib_alcotezt/alcotest.mli b/tezt/lib_alcotezt/alcotest.mli index 5b4462969f8d..d58207d50e7e 100644 --- a/tezt/lib_alcotezt/alcotest.mli +++ b/tezt/lib_alcotezt/alcotest.mli @@ -82,6 +82,9 @@ val testable : (** [pp t] is [t]'s pretty-printer. *) val pp : 'a testable -> Format.formatter -> 'a -> return +(** [of_pp pp] tests values which can be printed using [pp] and compared using {!Stdlib.compare} *) +val of_pp : (Format.formatter -> 'a -> return) -> 'a testable + (** [equal t] is [t]'s equality. *) val equal : 'a testable -> 'a -> 'a -> bool diff --git a/tezt/tests/dune b/tezt/tests/dune index 8231e60b1a9c..343df28cd513 100644 --- a/tezt/tests/dune +++ b/tezt/tests/dune @@ -13,6 +13,7 @@ tezos-base.unix tezos-stdlib-unix tezos-protocol-alpha + src_proto_alpha_lib_protocol_test_unit_tezt_lib src_proto_alpha_lib_protocol_test_regression_tezt_lib src_proto_alpha_lib_protocol_test_pbt_tezt_lib src_proto_alpha_lib_protocol_test_integration_operations_tezt_lib @@ -23,6 +24,7 @@ src_proto_alpha_lib_delegate_test_tezt_lib src_proto_alpha_lib_dal_test_tezt_lib src_proto_alpha_lib_client_test_tezt_lib + src_proto_016_PtMumbai_lib_protocol_test_unit_tezt_lib src_proto_016_PtMumbai_lib_protocol_test_regression_tezt_lib src_proto_016_PtMumbai_lib_protocol_test_pbt_tezt_lib src_proto_016_PtMumbai_lib_protocol_test_integration_operations_tezt_lib @@ -33,6 +35,7 @@ src_proto_016_PtMumbai_lib_delegate_test_tezt_lib src_proto_016_PtMumbai_lib_dal_test_tezt_lib src_proto_016_PtMumbai_lib_client_test_tezt_lib + src_proto_015_PtLimaPt_lib_protocol_test_unit_tezt_lib src_proto_015_PtLimaPt_lib_protocol_test_regression_tezt_lib src_proto_015_PtLimaPt_lib_protocol_test_pbt_tezt_lib src_proto_015_PtLimaPt_lib_protocol_test_integration_operations_tezt_lib -- GitLab