From b8ffd558c6c8eeb6c126c574c42a42aef7cdeace Mon Sep 17 00:00:00 2001 From: lykimq Date: Fri, 3 Mar 2023 12:30:50 +0100 Subject: [PATCH] Alcotezt: port [src/proto_/lib_protocol/test/integration/consensus] --- .gitlab/ci/jobs/test/unit.yml | 3 -- manifest/main.ml | 22 ++++++-- opam/tezos-protocol-015-PtLimaPt-tests.opam | 2 +- opam/tezos-protocol-016-PtMumbai-tests.opam | 2 +- opam/tezos-protocol-alpha-tests.opam | 2 +- .../test/integration/consensus/dune | 50 ++++++++++++++++--- .../consensus/{main.ml => test_main.ml} | 27 +++++----- .../test/integration/consensus/dune | 50 ++++++++++++++++--- .../consensus/{main.ml => test_main.ml} | 27 +++++----- .../test/integration/consensus/dune | 49 +++++++++++++++--- .../consensus/{main.ml => test_main.ml} | 27 +++++----- tezt/tests/dune | 3 ++ 12 files changed, 192 insertions(+), 72 deletions(-) rename src/proto_015_PtLimaPt/lib_protocol/test/integration/consensus/{main.ml => test_main.ml} (70%) rename src/proto_016_PtMumbai/lib_protocol/test/integration/consensus/{main.ml => test_main.ml} (70%) rename src/proto_alpha/lib_protocol/test/integration/consensus/{main.ml => test_main.ml} (70%) diff --git a/.gitlab/ci/jobs/test/unit.yml b/.gitlab/ci/jobs/test/unit.yml index ee8e7b02be0e..031afda5d156 100644 --- a/.gitlab/ci/jobs/test/unit.yml +++ b/.gitlab/ci/jobs/test/unit.yml @@ -50,7 +50,6 @@ unit:015_PtLimaPt: # Note the use of @ resp. @@ to select tests recursively resp. non-recursively proto_015_PtLimaPt__lib_protocol__1: > @@src/proto_015_PtLimaPt/lib_protocol/test/integration/runtest - @src/proto_015_PtLimaPt/lib_protocol/test/integration/consensus/runtest @src/proto_015_PtLimaPt/lib_protocol/test/integration/gas/runtest proto_015_PtLimaPt__lib_protocol__2: > @src/proto_015_PtLimaPt/lib_protocol/test/integration/michelson/runtest @@ -77,7 +76,6 @@ unit:016_PtMumbai: # Note the use of @ resp. @@ to select tests recursively resp. non-recursively proto_016_PtMumbai__lib_protocol__1: > @@src/proto_016_PtMumbai/lib_protocol/test/integration/runtest - @src/proto_016_PtMumbai/lib_protocol/test/integration/consensus/runtest @src/proto_016_PtMumbai/lib_protocol/test/integration/gas/runtest proto_016_PtMumbai__lib_protocol__2: > @src/proto_016_PtMumbai/lib_protocol/test/integration/michelson/runtest @@ -107,7 +105,6 @@ unit:alpha: # Note the use of @ resp. @@ to select tests recursively resp. non-recursively proto_alpha__lib_protocol__1: > @@src/proto_alpha/lib_protocol/test/integration/runtest - @src/proto_alpha/lib_protocol/test/integration/consensus/runtest @src/proto_alpha/lib_protocol/test/integration/gas/runtest proto_alpha__lib_protocol__2: > @src/proto_alpha/lib_protocol/test/integration/michelson/runtest diff --git a/manifest/main.ml b/manifest/main.ml index e3740a32d30e..f507ef3d50d7 100644 --- a/manifest/main.ml +++ b/manifest/main.ml @@ -3911,14 +3911,30 @@ end = struct let number = Name.number name in let path = Name.base_path name in let _integration_consensus = - test - "main" + tezt + [ + "test_main"; + "test_baking"; + "test_consensus_key"; + "test_deactivation"; + "test_delegation"; + "test_double_baking"; + "test_double_endorsement"; + "test_double_preendorsement"; + "test_endorsement"; + "test_frozen_deposits"; + "test_helpers_rpcs"; + "test_participation"; + "test_preendorsement_functor"; + "test_preendorsement"; + "test_seed"; + ] ~path:(path // "lib_protocol/test/integration/consensus") ~with_macos_security_framework:true ~opam:(sf "tezos-protocol-%s-tests" name_dash) ~deps: [ - alcotest_lwt; + alcotezt; octez_base |> open_ ~m:"TzPervasives" |> open_ ~m:"TzPervasives.Error_monad.Legacy_monad_globals"; main |> open_; diff --git a/opam/tezos-protocol-015-PtLimaPt-tests.opam b/opam/tezos-protocol-015-PtLimaPt-tests.opam index 99da1bf191e7..47d6a60ee662 100644 --- a/opam/tezos-protocol-015-PtLimaPt-tests.opam +++ b/opam/tezos-protocol-015-PtLimaPt-tests.opam @@ -15,12 +15,12 @@ depends: [ "tezos-protocol-015-PtLimaPt" {with-test} "tezos-015-PtLimaPt-test-helpers" {with-test} "tezos-base-test-helpers" {with-test} - "tezos-protocol-plugin-015-PtLimaPt" {with-test} "tezos-client-015-PtLimaPt" {with-test} "tezos-benchmark" {with-test} "tezos-micheline" {with-test} "tezos-benchmark-015-PtLimaPt" {with-test} "tezos-benchmark-type-inference-015-PtLimaPt" {with-test} + "tezos-protocol-plugin-015-PtLimaPt" {with-test} "qcheck-alcotest" { with-test & >= "0.20" } "tezos-test-helpers" {with-test} "tezt" { with-test & >= "3.0.0" } diff --git a/opam/tezos-protocol-016-PtMumbai-tests.opam b/opam/tezos-protocol-016-PtMumbai-tests.opam index a93eb6870996..091810f90eea 100644 --- a/opam/tezos-protocol-016-PtMumbai-tests.opam +++ b/opam/tezos-protocol-016-PtMumbai-tests.opam @@ -15,12 +15,12 @@ depends: [ "tezos-protocol-016-PtMumbai" {with-test} "tezos-016-PtMumbai-test-helpers" {with-test} "tezos-base-test-helpers" {with-test} - "tezos-protocol-plugin-016-PtMumbai" {with-test} "tezos-client-016-PtMumbai" {with-test} "tezos-benchmark" {with-test} "tezos-micheline" {with-test} "tezos-benchmark-016-PtMumbai" {with-test} "tezos-benchmark-type-inference-016-PtMumbai" {with-test} + "tezos-protocol-plugin-016-PtMumbai" {with-test} "qcheck-alcotest" { with-test & >= "0.20" } "tezos-test-helpers" {with-test} "tezt" { with-test & >= "3.0.0" } diff --git a/opam/tezos-protocol-alpha-tests.opam b/opam/tezos-protocol-alpha-tests.opam index 15d4df922b42..68772612ed84 100644 --- a/opam/tezos-protocol-alpha-tests.opam +++ b/opam/tezos-protocol-alpha-tests.opam @@ -15,12 +15,12 @@ depends: [ "tezos-protocol-alpha" {with-test} "tezos-alpha-test-helpers" {with-test} "tezos-base-test-helpers" {with-test} - "tezos-protocol-plugin-alpha" {with-test} "tezos-client-alpha" {with-test} "tezos-benchmark" {with-test} "tezos-micheline" {with-test} "tezos-benchmark-alpha" {with-test} "tezos-benchmark-type-inference-alpha" {with-test} + "tezos-protocol-plugin-alpha" {with-test} "qcheck-alcotest" { with-test & >= "0.20" } "tezos-test-helpers" {with-test} "tezt" { with-test & >= "3.0.0" } diff --git a/src/proto_015_PtLimaPt/lib_protocol/test/integration/consensus/dune b/src/proto_015_PtLimaPt/lib_protocol/test/integration/consensus/dune index 019c3ff48270..9e97bbd96524 100644 --- a/src/proto_015_PtLimaPt/lib_protocol/test/integration/consensus/dune +++ b/src/proto_015_PtLimaPt/lib_protocol/test/integration/consensus/dune @@ -1,30 +1,64 @@ ; 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_integration_consensus_tezt_lib) + (instrumentation (backend bisect_ppx)) (libraries - alcotest-lwt + tezt.core + octez-alcotezt tezos-base tezos-protocol-015-PtLimaPt tezos-015-PtLimaPt-test-helpers tezos-base-test-helpers tezos-protocol-015-PtLimaPt.parameters tezos-protocol-plugin-015-PtLimaPt) - (link_flags - (:standard) - (:include %{workspace_root}/macos-link-flags.sexp)) + (library_flags (:standard -linkall)) (flags (:standard) + -open Tezt_core + -open Tezt_core.Base + -open Octez_alcotezt -open Tezos_base.TzPervasives -open Tezos_base.TzPervasives.Error_monad.Legacy_monad_globals -open Tezos_protocol_015_PtLimaPt -open Tezos_015_PtLimaPt_test_helpers -open Tezos_base_test_helpers -open Tezos_protocol_015_PtLimaPt_parameters - -open Tezos_protocol_plugin_015_PtLimaPt)) + -open Tezos_protocol_plugin_015_PtLimaPt) + (modules + test_main + test_baking + test_consensus_key + test_deactivation + test_delegation + test_double_baking + test_double_endorsement + test_double_preendorsement + test_endorsement + test_frozen_deposits + test_helpers_rpcs + test_participation + test_preendorsement_functor + test_preendorsement + test_seed)) + +(executable + (name main) + (libraries + src_proto_015_PtLimaPt_lib_protocol_test_integration_consensus_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 %{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/integration/consensus/main.ml b/src/proto_015_PtLimaPt/lib_protocol/test/integration/consensus/test_main.ml similarity index 70% rename from src/proto_015_PtLimaPt/lib_protocol/test/integration/consensus/main.ml rename to src/proto_015_PtLimaPt/lib_protocol/test/integration/consensus/test_main.ml index 04f2209b8b9d..03d274cb26b8 100644 --- a/src/proto_015_PtLimaPt/lib_protocol/test/integration/consensus/main.ml +++ b/src/proto_015_PtLimaPt/lib_protocol/test/integration/consensus/test_main.ml @@ -34,18 +34,19 @@ let () = Alcotest_lwt.run "protocol > integration > consensus" [ - ("endorsement", Test_endorsement.tests); - ("preendorsement", Test_preendorsement.tests); - ("double endorsement", Test_double_endorsement.tests); - ("double preendorsement", Test_double_preendorsement.tests); - ("double baking", Test_double_baking.tests); - ("seed", Test_seed.tests); - ("baking", Test_baking.tests); - ("delegation", Test_delegation.tests); - ("deactivation", Test_deactivation.tests); - ("helpers rpcs", Test_helpers_rpcs.tests); - ("participation monitoring", Test_participation.tests); - ("frozen deposits", Test_frozen_deposits.tests); - ("consensus key", Test_consensus_key.tests); + (Protocol.name ^ ": endorsement", Test_endorsement.tests); + (Protocol.name ^ ": preendorsement", Test_preendorsement.tests); + (Protocol.name ^ ": double endorsement", Test_double_endorsement.tests); + ( Protocol.name ^ ": double preendorsement", + Test_double_preendorsement.tests ); + (Protocol.name ^ ": double baking", Test_double_baking.tests); + (Protocol.name ^ ": seed", Test_seed.tests); + (Protocol.name ^ ": baking", Test_baking.tests); + (Protocol.name ^ ": delegation", Test_delegation.tests); + (Protocol.name ^ ": deactivation", Test_deactivation.tests); + (Protocol.name ^ ": helpers rpcs", Test_helpers_rpcs.tests); + (Protocol.name ^ ": participation monitoring", Test_participation.tests); + (Protocol.name ^ ": frozen deposits", Test_frozen_deposits.tests); + (Protocol.name ^ ": consensus key", Test_consensus_key.tests); ] |> Lwt_main.run diff --git a/src/proto_016_PtMumbai/lib_protocol/test/integration/consensus/dune b/src/proto_016_PtMumbai/lib_protocol/test/integration/consensus/dune index cca2db9985b0..89f475287f04 100644 --- a/src/proto_016_PtMumbai/lib_protocol/test/integration/consensus/dune +++ b/src/proto_016_PtMumbai/lib_protocol/test/integration/consensus/dune @@ -1,30 +1,64 @@ ; 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_integration_consensus_tezt_lib) + (instrumentation (backend bisect_ppx)) (libraries - alcotest-lwt + tezt.core + octez-alcotezt tezos-base tezos-protocol-016-PtMumbai tezos-016-PtMumbai-test-helpers tezos-base-test-helpers tezos-protocol-016-PtMumbai.parameters tezos-protocol-plugin-016-PtMumbai) - (link_flags - (:standard) - (:include %{workspace_root}/macos-link-flags.sexp)) + (library_flags (:standard -linkall)) (flags (:standard) + -open Tezt_core + -open Tezt_core.Base + -open Octez_alcotezt -open Tezos_base.TzPervasives -open Tezos_base.TzPervasives.Error_monad.Legacy_monad_globals -open Tezos_protocol_016_PtMumbai -open Tezos_016_PtMumbai_test_helpers -open Tezos_base_test_helpers -open Tezos_protocol_016_PtMumbai_parameters - -open Tezos_protocol_plugin_016_PtMumbai)) + -open Tezos_protocol_plugin_016_PtMumbai) + (modules + test_main + test_baking + test_consensus_key + test_deactivation + test_delegation + test_double_baking + test_double_endorsement + test_double_preendorsement + test_endorsement + test_frozen_deposits + test_helpers_rpcs + test_participation + test_preendorsement_functor + test_preendorsement + test_seed)) + +(executable + (name main) + (libraries + src_proto_016_PtMumbai_lib_protocol_test_integration_consensus_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 %{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/integration/consensus/main.ml b/src/proto_016_PtMumbai/lib_protocol/test/integration/consensus/test_main.ml similarity index 70% rename from src/proto_016_PtMumbai/lib_protocol/test/integration/consensus/main.ml rename to src/proto_016_PtMumbai/lib_protocol/test/integration/consensus/test_main.ml index 04f2209b8b9d..03d274cb26b8 100644 --- a/src/proto_016_PtMumbai/lib_protocol/test/integration/consensus/main.ml +++ b/src/proto_016_PtMumbai/lib_protocol/test/integration/consensus/test_main.ml @@ -34,18 +34,19 @@ let () = Alcotest_lwt.run "protocol > integration > consensus" [ - ("endorsement", Test_endorsement.tests); - ("preendorsement", Test_preendorsement.tests); - ("double endorsement", Test_double_endorsement.tests); - ("double preendorsement", Test_double_preendorsement.tests); - ("double baking", Test_double_baking.tests); - ("seed", Test_seed.tests); - ("baking", Test_baking.tests); - ("delegation", Test_delegation.tests); - ("deactivation", Test_deactivation.tests); - ("helpers rpcs", Test_helpers_rpcs.tests); - ("participation monitoring", Test_participation.tests); - ("frozen deposits", Test_frozen_deposits.tests); - ("consensus key", Test_consensus_key.tests); + (Protocol.name ^ ": endorsement", Test_endorsement.tests); + (Protocol.name ^ ": preendorsement", Test_preendorsement.tests); + (Protocol.name ^ ": double endorsement", Test_double_endorsement.tests); + ( Protocol.name ^ ": double preendorsement", + Test_double_preendorsement.tests ); + (Protocol.name ^ ": double baking", Test_double_baking.tests); + (Protocol.name ^ ": seed", Test_seed.tests); + (Protocol.name ^ ": baking", Test_baking.tests); + (Protocol.name ^ ": delegation", Test_delegation.tests); + (Protocol.name ^ ": deactivation", Test_deactivation.tests); + (Protocol.name ^ ": helpers rpcs", Test_helpers_rpcs.tests); + (Protocol.name ^ ": participation monitoring", Test_participation.tests); + (Protocol.name ^ ": frozen deposits", Test_frozen_deposits.tests); + (Protocol.name ^ ": consensus key", Test_consensus_key.tests); ] |> Lwt_main.run diff --git a/src/proto_alpha/lib_protocol/test/integration/consensus/dune b/src/proto_alpha/lib_protocol/test/integration/consensus/dune index 7c544a7fb9e8..3326467765d4 100644 --- a/src/proto_alpha/lib_protocol/test/integration/consensus/dune +++ b/src/proto_alpha/lib_protocol/test/integration/consensus/dune @@ -1,30 +1,63 @@ ; 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_integration_consensus_tezt_lib) + (instrumentation (backend bisect_ppx)) (libraries - alcotest-lwt + tezt.core + octez-alcotezt tezos-base tezos-protocol-alpha tezos-alpha-test-helpers tezos-base-test-helpers tezos-protocol-alpha.parameters tezos-protocol-plugin-alpha) - (link_flags - (:standard) - (:include %{workspace_root}/macos-link-flags.sexp)) + (library_flags (:standard -linkall)) (flags (:standard) + -open Tezt_core + -open Tezt_core.Base + -open Octez_alcotezt -open Tezos_base.TzPervasives -open Tezos_base.TzPervasives.Error_monad.Legacy_monad_globals -open Tezos_protocol_alpha -open Tezos_alpha_test_helpers -open Tezos_base_test_helpers -open Tezos_protocol_alpha_parameters - -open Tezos_protocol_plugin_alpha)) + -open Tezos_protocol_plugin_alpha) + (modules + test_main + test_baking + test_consensus_key + test_deactivation + test_delegation + test_double_baking + test_double_endorsement + test_double_preendorsement + test_endorsement + test_frozen_deposits + test_helpers_rpcs + test_participation + test_preendorsement_functor + test_preendorsement + test_seed)) + +(executable + (name main) + (libraries + src_proto_alpha_lib_protocol_test_integration_consensus_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 %{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/integration/consensus/main.ml b/src/proto_alpha/lib_protocol/test/integration/consensus/test_main.ml similarity index 70% rename from src/proto_alpha/lib_protocol/test/integration/consensus/main.ml rename to src/proto_alpha/lib_protocol/test/integration/consensus/test_main.ml index 04f2209b8b9d..03d274cb26b8 100644 --- a/src/proto_alpha/lib_protocol/test/integration/consensus/main.ml +++ b/src/proto_alpha/lib_protocol/test/integration/consensus/test_main.ml @@ -34,18 +34,19 @@ let () = Alcotest_lwt.run "protocol > integration > consensus" [ - ("endorsement", Test_endorsement.tests); - ("preendorsement", Test_preendorsement.tests); - ("double endorsement", Test_double_endorsement.tests); - ("double preendorsement", Test_double_preendorsement.tests); - ("double baking", Test_double_baking.tests); - ("seed", Test_seed.tests); - ("baking", Test_baking.tests); - ("delegation", Test_delegation.tests); - ("deactivation", Test_deactivation.tests); - ("helpers rpcs", Test_helpers_rpcs.tests); - ("participation monitoring", Test_participation.tests); - ("frozen deposits", Test_frozen_deposits.tests); - ("consensus key", Test_consensus_key.tests); + (Protocol.name ^ ": endorsement", Test_endorsement.tests); + (Protocol.name ^ ": preendorsement", Test_preendorsement.tests); + (Protocol.name ^ ": double endorsement", Test_double_endorsement.tests); + ( Protocol.name ^ ": double preendorsement", + Test_double_preendorsement.tests ); + (Protocol.name ^ ": double baking", Test_double_baking.tests); + (Protocol.name ^ ": seed", Test_seed.tests); + (Protocol.name ^ ": baking", Test_baking.tests); + (Protocol.name ^ ": delegation", Test_delegation.tests); + (Protocol.name ^ ": deactivation", Test_deactivation.tests); + (Protocol.name ^ ": helpers rpcs", Test_helpers_rpcs.tests); + (Protocol.name ^ ": participation monitoring", Test_participation.tests); + (Protocol.name ^ ": frozen deposits", Test_frozen_deposits.tests); + (Protocol.name ^ ": consensus key", Test_consensus_key.tests); ] |> Lwt_main.run diff --git a/tezt/tests/dune b/tezt/tests/dune index 8b5861c6b66c..7395cf36dcc1 100644 --- a/tezt/tests/dune +++ b/tezt/tests/dune @@ -17,6 +17,7 @@ src_proto_alpha_lib_protocol_test_pbt_tezt_lib src_proto_alpha_lib_protocol_test_integration_operations_tezt_lib src_proto_alpha_lib_protocol_test_integration_gas_tezt_lib + src_proto_alpha_lib_protocol_test_integration_consensus_tezt_lib src_proto_alpha_lib_plugin_test_tezt_lib src_proto_alpha_lib_delegate_test_tezt_lib src_proto_alpha_lib_client_test_tezt_lib @@ -24,6 +25,7 @@ src_proto_016_PtMumbai_lib_protocol_test_pbt_tezt_lib src_proto_016_PtMumbai_lib_protocol_test_integration_operations_tezt_lib src_proto_016_PtMumbai_lib_protocol_test_integration_gas_tezt_lib + src_proto_016_PtMumbai_lib_protocol_test_integration_consensus_tezt_lib src_proto_016_PtMumbai_lib_plugin_test_tezt_lib src_proto_016_PtMumbai_lib_delegate_test_tezt_lib src_proto_016_PtMumbai_lib_client_test_tezt_lib @@ -31,6 +33,7 @@ src_proto_015_PtLimaPt_lib_protocol_test_pbt_tezt_lib src_proto_015_PtLimaPt_lib_protocol_test_integration_operations_tezt_lib src_proto_015_PtLimaPt_lib_protocol_test_integration_gas_tezt_lib + src_proto_015_PtLimaPt_lib_protocol_test_integration_consensus_tezt_lib src_proto_015_PtLimaPt_lib_plugin_test_tezt_lib src_proto_015_PtLimaPt_lib_delegate_test_tezt_lib src_proto_015_PtLimaPt_lib_client_test_tezt_lib -- GitLab