diff --git a/manifest/main.ml b/manifest/main.ml index 9918396a9af7a9cd91122ecff28e9b0f7eef8a56..cb8877795195473d50f052b34d8fe58581268b6f 100644 --- a/manifest/main.ml +++ b/manifest/main.ml @@ -941,13 +941,22 @@ let octez_bls12_381_polynomial_internal = } let _octez_bls12_381_polynomial_tests = - tests - ["main"] + tezt + [ + "test_main"; + "helpers"; + "test_coefficients"; + "test_domains"; + "test_evaluations"; + "test_pbt"; + "test_polynomial"; + "test_srs"; + ] ~path:"src/lib_bls12_381_polynomial/test" ~opam:"tezos-bls12-381-polynomial-internal" ~deps: [ - alcotest; + alcotezt; qcheck_alcotest; polynomial; bisect_ppx; diff --git a/opam/tezos-bls12-381-polynomial-internal.opam b/opam/tezos-bls12-381-polynomial-internal.opam index 2a5e92765871e2d5b6a8619c142cae7f1b8395d7..f0f91de7f0318078864b2bdf1ad9eb8ae2143247 100644 --- a/opam/tezos-bls12-381-polynomial-internal.opam +++ b/opam/tezos-bls12-381-polynomial-internal.opam @@ -13,7 +13,8 @@ depends: [ "ppx_repr" { >= "0.6.0" } "bls12-381" { >= "6.0.1" & < "6.1.0" } "bigstringaf" { >= "0.5.0" } - "alcotest" { with-test & >= "1.5.0" } + "tezt" { with-test & >= "3.0.0" } + "octez-alcotezt" {with-test} "qcheck-alcotest" { with-test & >= "0.20" } "polynomial" { with-test & >= "0.4.0" & < "0.5.0" } "bisect_ppx" { with-test & >= "2.7.0" } @@ -22,5 +23,6 @@ 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: "Polynomials over BLS12-381 finite field - Temporary vendored version of Octez" diff --git a/src/lib_bls12_381_polynomial/test/dune b/src/lib_bls12_381_polynomial/test/dune index 9e557fcb010f4b50c149d47872ef156088010970..495ef546db4c2f003e1d0d787d631560a778c4ec 100644 --- a/src/lib_bls12_381_polynomial/test/dune +++ b/src/lib_bls12_381_polynomial/test/dune @@ -1,17 +1,46 @@ ; This file was automatically generated, do not edit. ; Edit file manifest/main.ml instead. -(executable - (name main) +(library + (name src_lib_bls12_381_polynomial_test_tezt_lib) + (instrumentation (backend bisect_ppx)) (libraries - alcotest + tezt.core + octez-alcotezt qcheck-alcotest polynomial bls12-381 - tezos-bls12-381-polynomial-internal)) + tezos-bls12-381-polynomial-internal) + (library_flags (:standard -linkall)) + (flags + (:standard) + -open Tezt_core + -open Tezt_core.Base + -open Octez_alcotezt) + (modules + test_main + helpers + test_coefficients + test_domains + test_evaluations + test_pbt + test_polynomial + test_srs)) + +(executable + (name main) + (instrumentation (backend bisect_ppx --bisect-sigterm)) + (libraries + src_lib_bls12_381_polynomial_test_tezt_lib + tezt) + (modules main)) (rule - (alias runtest) + (alias runtezt) (package tezos-bls12-381-polynomial-internal) (deps srs_zcash_g1_5) (action (run %{dep:./main.exe}))) + +(rule + (targets main.ml) + (action (with-stdout-to %{targets} (echo "let () = Tezt.Test.run ()")))) diff --git a/src/lib_bls12_381_polynomial/test/main.ml b/src/lib_bls12_381_polynomial/test/test_main.ml similarity index 94% rename from src/lib_bls12_381_polynomial/test/main.ml rename to src/lib_bls12_381_polynomial/test/test_main.ml index ec9853b47ccd451588a6680b7da89d0a53a0e52e..c5408f34e9fcb7724f862842888c9420172ebaa3 100644 --- a/src/lib_bls12_381_polynomial/test/main.ml +++ b/src/lib_bls12_381_polynomial/test/test_main.ml @@ -23,6 +23,13 @@ (* *) (*****************************************************************************) +(** Testing + ------- + Component: Lib_bls12_381_polynomial + Invocation: dune exec src/lib_bls12_381_polynomial/test/main.exe + Subject: Test for bls12_381 polynomial +*) + let () = (* Seed for deterministic pseudo-randomness: If the environment variable RANDOM_SEED is set, then its value is used as @@ -46,7 +53,6 @@ let () = Printf.printf "Random seed: %d\n" seed ; Random.init seed ; Alcotest.run - ~verbose:false "PlonK" [ ("Domains", Test_domains.tests); diff --git a/src/lib_bls12_381_polynomial/test/test_srs.ml b/src/lib_bls12_381_polynomial/test/test_srs.ml index 3f9d53f8561ae7f131c49df7733198ca07e75511..3ae1b0e3430a887a2576451c25758cb0aa078f55 100644 --- a/src/lib_bls12_381_polynomial/test/test_srs.ml +++ b/src/lib_bls12_381_polynomial/test/test_srs.ml @@ -163,8 +163,10 @@ let bigstring_of_file filename = false [|(* [-1] means read the whole file *) -1|] +let path = project_root // Filename.dirname __FILE__ + let test_load_from_file () = - let bs = bigstring_of_file "srs_zcash_g1_5" in + let bs = bigstring_of_file (path // "srs_zcash_g1_5") in let max_size = 1 lsl 5 in let srs = Srs.of_bigstring bs ~len:max_size |> Result.get_ok in assert (Srs.size srs = max_size) ; @@ -173,7 +175,7 @@ let test_load_from_file () = | _ -> assert false let test_load_from_file_vector () = - let bs = bigstring_of_file "srs_zcash_g1_5" in + let bs = bigstring_of_file (path // "srs_zcash_g1_5") in let srs = Srs.of_bigstring bs ~len:(1 lsl 5) |> Result.get_ok in let v = [ diff --git a/tezt/tests/dune b/tezt/tests/dune index b95109ecf5f76fdba62c27b3e8bf1941a6196a80..a9312e3f511d7dad38af8d8a74e6326ab4098b7d 100644 --- a/tezt/tests/dune +++ b/tezt/tests/dune @@ -86,6 +86,7 @@ src_lib_client_base_unix_test_tezt_lib src_lib_client_base_test_tezt_lib src_lib_clic_test_tezt_lib + src_lib_bls12_381_polynomial_test_tezt_lib src_lib_benchmark_test_tezt_lib src_lib_base_test_tezt_lib) (link_flags