diff --git a/.gitlab/ci/jobs/packaging/opam_package.yml b/.gitlab/ci/jobs/packaging/opam_package.yml index 4648dcf53981d3aa8d80262cadd4ad37e8f332bc..60726a8f6ca64a632d7c14f8f67eda3ecc8b619c 100644 --- a/.gitlab/ci/jobs/packaging/opam_package.yml +++ b/.gitlab/ci/jobs/packaging/opam_package.yml @@ -1343,7 +1343,7 @@ opam:tezos-rpc-http-server: opam:tezos-sapling: extends: - .opam_template - - .rules_template__trigger_opam_batch_6 + - .rules_template__trigger_opam_batch_7 variables: package: tezos-sapling @@ -1540,7 +1540,7 @@ opam:tezos-webassembly-interpreter-extra: opam:tezos-workers: extends: - .opam_template - - .rules_template__trigger_opam_batch_7 + - .rules_template__trigger_opam_batch_6 variables: package: tezos-workers diff --git a/manifest/main.ml b/manifest/main.ml index 04af7760ab071bbbcd3fdc898e8912b7a3c48cf7..510f5d27cf8a989a2907569ef4b2aa07daa1b726 100644 --- a/manifest/main.ml +++ b/manifest/main.ml @@ -2081,8 +2081,16 @@ let octez_sapling = ] let _octez_sapling_tests = - tests - ["test_rustzcash"; "test_keys"; "test_merkle"; "test_roots"; "test_sapling"] + tezt + [ + "test_rustzcash"; + "test_keys"; + "test_merkle"; + "test_roots"; + "test_sapling"; + "keys"; + "example"; + ] ~path:"src/lib_sapling/test" ~with_macos_security_framework:true ~opam:"tezos-sapling" @@ -2098,9 +2106,8 @@ let _octez_sapling_tests = octez_stdlib_unix; data_encoding |> open_; octez_base_test_helpers |> open_; - alcotest_lwt; + alcotezt; ] - ~all_modules_except:["test_js"] ~opam_with_test:Never let _octez_sapling_js_tests = diff --git a/opam/tezos-sapling.opam b/opam/tezos-sapling.opam index 71b1e987b942695c26edb0163f3221218363f3b3..4fc76db484572cfe0bae8eaf78ba7432f773228e 100644 --- a/opam/tezos-sapling.opam +++ b/opam/tezos-sapling.opam @@ -21,11 +21,12 @@ depends: [ "tezos-error-monad" "tezos-rust-libs" { = "1.5" } "tezos-lwt-result-stdlib" + "tezos-hacl" {with-test} + "tezt" { with-test & >= "3.0.0" } "tezos-base" {with-test} "tezos-stdlib-unix" {with-test} "tezos-base-test-helpers" {with-test} - "alcotest-lwt" { with-test & >= "1.5.0" } - "tezos-hacl" {with-test} + "octez-alcotezt" {with-test} ] x-opam-monorepo-opam-provided: [ "tezos-rust-libs" diff --git a/src/lib_sapling/test/dune b/src/lib_sapling/test/dune index 660c750941556025d0658782ccc162d30cc12214..7f285d96f8f719330c6373459d7ae0fe5c880ec0 100644 --- a/src/lib_sapling/test/dune +++ b/src/lib_sapling/test/dune @@ -3,9 +3,28 @@ (env (_ (env-vars (NODE_PRELOAD hacl-wasm,ocaml-bls12-381,secp256k1-wasm)))) -(executables - (names test_rustzcash test_keys test_merkle test_roots test_sapling) +(executable + (name test_js) + (modes js) (libraries + tezos-sapling + tezos-hacl) + (js_of_ocaml) + (link_flags + (:standard) + (-linkall)) + (modules test_js)) + +(rule + (alias runtest_js) + (package tezos-sapling) + (action (run node %{dep:./test_js.bc.js}))) + +(library + (name src_lib_sapling_test_tezt_lib) + (instrumentation (backend bisect_ppx)) + (libraries + tezt.core tezos-sapling tezos-crypto str @@ -15,61 +34,42 @@ tezos-stdlib-unix data-encoding tezos-base-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_sapling -open Tezos_stdlib -open Data_encoding - -open Tezos_base_test_helpers) - (modules (:standard \ test_js))) - -(rule - (alias runtest) - (package tezos-sapling) - (deps vectors.csv vectors-zip32.csv) - (action (run %{dep:./test_rustzcash.exe}))) - -(rule - (alias runtest) - (package tezos-sapling) - (deps vectors.csv vectors-zip32.csv) - (action (run %{dep:./test_keys.exe}))) - -(rule - (alias runtest) - (package tezos-sapling) - (deps vectors.csv vectors-zip32.csv) - (action (run %{dep:./test_merkle.exe}))) - -(rule - (alias runtest) - (package tezos-sapling) - (deps vectors.csv vectors-zip32.csv) - (action (run %{dep:./test_roots.exe}))) - -(rule - (alias runtest) - (package tezos-sapling) - (deps vectors.csv vectors-zip32.csv) - (action (run %{dep:./test_sapling.exe}))) + -open Tezos_base_test_helpers + -open Octez_alcotezt) + (modules + test_rustzcash + test_keys + test_merkle + test_roots + test_sapling + keys + example)) (executable - (name test_js) - (modes js) + (name main) (libraries - tezos-sapling - tezos-hacl) - (js_of_ocaml) + src_lib_sapling_test_tezt_lib + tezt) (link_flags (:standard) - (-linkall)) - (modules test_js)) + (:include %{workspace_root}/macos-link-flags.sexp)) + (modules main)) (rule - (alias runtest_js) + (alias runtezt) (package tezos-sapling) - (action (run node %{dep:./test_js.bc.js}))) + (deps vectors.csv vectors-zip32.csv) + (action (run %{dep:./main.exe}))) + +(rule + (targets main.ml) + (action (with-stdout-to %{targets} (echo "let () = Tezt.Test.run ()")))) diff --git a/src/lib_sapling/test/keys.ml b/src/lib_sapling/test/keys.ml index 6dfbf7d5742d70f35b6988e83d6ce924540d378d..533b538b7e0b46cd0a8cadca65762dcd78b0614f 100644 --- a/src/lib_sapling/test/keys.ml +++ b/src/lib_sapling/test/keys.ml @@ -6,6 +6,8 @@ module Vk = Core.Raw.Viewing_key let ba_of_hex h = Hex.to_bytes_exn (`Hex h) +let path filename = project_root // Filename.dirname __FILE__ // filename + module Vector = struct type test_vector = { sk : Bytes.t; @@ -55,7 +57,7 @@ module Vector = struct } in (* read file in memory skipping lines with # *) - let file = "vectors.csv" in + let file = path "vectors.csv" in let ic = open_in file in let rec read_lines ls = try @@ -118,7 +120,7 @@ let vectors_zip32 = } in (* read file in memory skipping lines with # *) - let file = "vectors-zip32.csv" in + let file = path "vectors-zip32.csv" in let ic = open_in file in let rec read_lines ls = try diff --git a/tezt/tests/dune b/tezt/tests/dune index 27b6ca20d56b773e9b7e412acbfeb315d8ee7a23..9a75882cbfe34d6e34578415939e6ff37656c518 100644 --- a/tezt/tests/dune +++ b/tezt/tests/dune @@ -42,6 +42,7 @@ src_lib_signer_backends_unix_test_tezt_lib src_lib_signer_backends_test_tezt_lib src_lib_shell_test_tezt_lib + src_lib_sapling_test_tezt_lib src_lib_p2p_tezt_tezt_lib src_lib_mockup_test_tezt_lib src_lib_lwt_result_stdlib_test_tezt_lib