From db4f04b50c24f2f5eacd6336e4535b0f640741e5 Mon Sep 17 00:00:00 2001 From: Arvid Jakobsson Date: Tue, 28 Feb 2023 11:17:55 +0100 Subject: [PATCH] [lib_shell/test]: port to alcotezt --- manifest/main.ml | 20 ++++++--- opam/tezos-shell.opam | 4 +- src/lib_shell/test/dune | 90 ++++++++++++++++++----------------------- tezt/tests/dune | 1 + 4 files changed, 57 insertions(+), 58 deletions(-) diff --git a/manifest/main.ml b/manifest/main.ml index 828eac2db99e..60789fb0f69b 100644 --- a/manifest/main.ml +++ b/manifest/main.ml @@ -5683,16 +5683,24 @@ let _octez_store_tests = ] let _octez_shell_tests = - tests + tezt [ - "test_shell"; - "test_synchronisation_heuristic_fuzzy"; - "test_shell_operation"; + "generators"; + "generators_tree"; + "shell_test_helpers"; + "test_consensus_heuristic"; + "test_node"; + "test_peer_validator"; "test_prevalidation"; "test_prevalidator_classification"; "test_prevalidator_classification_operations"; "test_prevalidator_pending_operations"; - "test_peer_validator"; + "test_protocol_validator"; + "test_shell"; + "test_shell_operation"; + "test_synchronisation_heuristic"; + "test_synchronisation_heuristic_fuzzy"; + "test_validator"; ] ~path:"src/lib_shell/test" ~with_macos_security_framework:true @@ -5717,7 +5725,7 @@ let _octez_shell_tests = octez_validation |> open_; octez_event_logging_test_helpers |> open_; octez_test_helpers |> open_; - alcotest_lwt; + alcotezt; ] (* INTERNAL EXES *) diff --git a/opam/tezos-shell.opam b/opam/tezos-shell.opam index 9271dc436739..cd6a912a83c8 100644 --- a/opam/tezos-shell.opam +++ b/opam/tezos-shell.opam @@ -31,15 +31,17 @@ depends: [ "tezos-validation" "tezos-version" "lwt-exit" + "tezt" { with-test & >= "3.0.0" } "tezos-base-test-helpers" {with-test} "tezos-embedded-protocol-demo-noops" {with-test} "tezos-event-logging-test-helpers" {with-test} "tezos-test-helpers" {with-test} - "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: core of `octez-node` (gossip, validation scheduling, mempool, ...)" diff --git a/src/lib_shell/test/dune b/src/lib_shell/test/dune index e6b64d56587c..2aec3b2c0fe0 100644 --- a/src/lib_shell/test/dune +++ b/src/lib_shell/test/dune @@ -1,17 +1,11 @@ ; This file was automatically generated, do not edit. ; Edit file manifest/main.ml instead. -(executables - (names - test_shell - test_synchronisation_heuristic_fuzzy - test_shell_operation - test_prevalidation - test_prevalidator_classification - test_prevalidator_classification_operations - test_prevalidator_pending_operations - test_peer_validator) +(library + (name src_lib_shell_test_tezt_lib) + (instrumentation (backend bisect_ppx)) (libraries + tezt.core tezos-base tezos-base-test-helpers tezos-store @@ -30,12 +24,12 @@ tezos-validation tezos-event-logging-test-helpers tezos-test-helpers - alcotest-lwt) - (link_flags - (:standard) - (:include %{workspace_root}/macos-link-flags.sexp)) + octez-alcotezt) + (library_flags (:standard -linkall)) (flags (:standard) + -open Tezt_core + -open Tezt_core.Base -open Tezos_base.TzPervasives -open Tezos_base_test_helpers -open Tezos_store @@ -51,44 +45,38 @@ -open Tezos_stdlib_unix -open Tezos_validation -open Tezos_event_logging_test_helpers - -open Tezos_test_helpers)) - -(rule - (alias runtest) - (package tezos-shell) - (action (run %{dep:./test_shell.exe}))) - -(rule - (alias runtest) - (package tezos-shell) - (action (run %{dep:./test_synchronisation_heuristic_fuzzy.exe}))) - -(rule - (alias runtest) - (package tezos-shell) - (action (run %{dep:./test_shell_operation.exe}))) - -(rule - (alias runtest) - (package tezos-shell) - (action (run %{dep:./test_prevalidation.exe}))) - -(rule - (alias runtest) - (package tezos-shell) - (action (run %{dep:./test_prevalidator_classification.exe}))) + -open Tezos_test_helpers + -open Octez_alcotezt) + (modules + generators + generators_tree + shell_test_helpers + test_consensus_heuristic + test_node + test_peer_validator + test_prevalidation + test_prevalidator_classification + test_prevalidator_classification_operations + test_prevalidator_pending_operations + test_protocol_validator + test_shell + test_shell_operation + test_synchronisation_heuristic + test_synchronisation_heuristic_fuzzy + test_validator)) -(rule - (alias runtest) - (package tezos-shell) - (action (run %{dep:./test_prevalidator_classification_operations.exe}))) +(executable + (name main) + (libraries + src_lib_shell_test_tezt_lib + tezt) + (link_flags + (:standard) + (:include %{workspace_root}/macos-link-flags.sexp)) + (modules main)) -(rule - (alias runtest) - (package tezos-shell) - (action (run %{dep:./test_prevalidator_pending_operations.exe}))) +(rule (alias runtezt) (package tezos-shell) (action (run %{dep:./main.exe}))) (rule - (alias runtest) - (package tezos-shell) - (action (run %{dep:./test_peer_validator.exe}))) + (targets main.ml) + (action (with-stdout-to %{targets} (echo "let () = Tezt.Test.run ()")))) diff --git a/tezt/tests/dune b/tezt/tests/dune index 8c2501b36dbd..f6f74957819c 100644 --- a/tezt/tests/dune +++ b/tezt/tests/dune @@ -25,6 +25,7 @@ src_lib_stdlib_test_tezt_lib src_lib_signer_backends_unix_test_tezt_lib src_lib_signer_backends_test_tezt_lib + src_lib_shell_test_tezt_lib src_lib_p2p_tezt_tezt_lib src_lib_mockup_test_tezt_lib src_lib_lwt_result_stdlib_test_tezt_lib -- GitLab