diff --git a/manifest/main.ml b/manifest/main.ml index d96046e6704ee435eaddaecce6031847be1e3bb1..e70d83d46042bbc9df3346846c1039873e8a99b2 100644 --- a/manifest/main.ml +++ b/manifest/main.ml @@ -387,7 +387,7 @@ let tezt_js_lib = external_sublib tezt_lib ~js_compatible:true "tezt.js" let tezt ~opam ~path ?js_compatible ?modes ?(deps = []) ?dep_globs ?dep_globs_rec ?dep_files ?opam_with_test ?synopsis - ?(with_macos_security_framework = false) l = + ?(with_macos_security_framework = false) ?dune l = tezt_without_tezt_lib_dependency ~with_macos_security_framework ~opam @@ -402,6 +402,7 @@ let tezt ~opam ~path ?js_compatible ?modes ?(deps = []) ?dep_globs ?dep_globs_rec ?dep_files ?opam_with_test + ?dune l (* The main module [Octez_alcotest] is [open_] so that one can replace @@ -1347,12 +1348,12 @@ let _octez_webassembly_repl = ] let _octez_webassembly_test = - test - "main" + tezt + ["smallint"] ~path:"src/lib_webassembly/tests" ~opam:"tezos-webassembly-interpreter" ~dune:Dune.[[S "include_subdirs"; S "no"]] - ~deps:[octez_webassembly_interpreter |> open_; alcotest] + ~deps:[octez_webassembly_interpreter |> open_; alcotezt] let octez_version_parser = public_lib diff --git a/manifest/manifest.ml b/manifest/manifest.ml index 7863af64a76394980d0a491c70951c8f5c933bf1..8a799c691026f8357dc634f8273a45b01116c1cc 100644 --- a/manifest/manifest.ml +++ b/manifest/manifest.ml @@ -1797,13 +1797,15 @@ type tezt_target = { synopsis : string option; opam_with_test : with_test option; with_macos_security_framework : bool; + dune : Dune.s_expr; } let tezt_targets_by_path : tezt_target String_map.t ref = ref String_map.empty let tezt ~opam ~path ?js_compatible ?modes ?(lib_deps = []) ?(exe_deps = []) ?(js_deps = []) ?(dep_globs = []) ?(dep_globs_rec = []) ?(dep_files = []) - ?synopsis ?opam_with_test ?(with_macos_security_framework = false) modules = + ?synopsis ?opam_with_test ?(with_macos_security_framework = false) + ?(dune = Dune.[]) modules = if String_map.mem path !tezt_targets_by_path then invalid_arg ("cannot call Manifest.tezt twice for the same directory: " ^ path) ; @@ -1822,6 +1824,7 @@ let tezt ~opam ~path ?js_compatible ?modes ?(lib_deps = []) ?(exe_deps = []) synopsis; opam_with_test; with_macos_security_framework; + dune; } in tezt_targets_by_path := String_map.add path tezt_target !tezt_targets_by_path @@ -1843,6 +1846,7 @@ let register_tezt_targets ~make_tezt_exe = synopsis; opam_with_test; with_macos_security_framework; + dune; } = let path_with_underscores = String.map (function '-' | '/' -> '_' | c -> c) path @@ -1858,6 +1862,7 @@ let register_tezt_targets ~make_tezt_exe = ~deps:lib_deps ~modules ~linkall:true + ~dune in tezt_test_libs := lib :: !tezt_test_libs ; let declare_exe ?js_compatible exe_name modes deps main = diff --git a/manifest/manifest.mli b/manifest/manifest.mli index 74a395da8a3811becba914bf5c725e47442837b5..2536a2f78a5cd701a98ab51b7bdc8f73ae3f950c 100644 --- a/manifest/manifest.mli +++ b/manifest/manifest.mli @@ -934,6 +934,7 @@ val tezt : ?synopsis:string -> ?opam_with_test:with_test -> ?with_macos_security_framework:bool -> + ?dune:Dune.s_expr -> string list -> unit diff --git a/opam/tezos-webassembly-interpreter.opam b/opam/tezos-webassembly-interpreter.opam index 6eab9ec459f8387b389abffa7388fee2e39a31c6..c1e6271a2c4b7ede65d4597f10c43666ee56b96a 100644 --- a/opam/tezos-webassembly-interpreter.opam +++ b/opam/tezos-webassembly-interpreter.opam @@ -16,11 +16,13 @@ depends: [ "tezos-error-monad" "zarith" { >= "1.12" & < "1.13" } "tezos-lazy-containers" - "alcotest" { with-test & >= "1.5.0" } + "tezt" { with-test & >= "3.0.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: "WebAssembly reference interpreter with tweaks for Tezos" diff --git a/src/lib_webassembly/tests/dune b/src/lib_webassembly/tests/dune index 3baa8375c13590773a593ed8792edec42f72780c..3dc399bc059256e0f3eaf49d5ae0f5151e4937f2 100644 --- a/src/lib_webassembly/tests/dune +++ b/src/lib_webassembly/tests/dune @@ -1,18 +1,36 @@ ; This file was automatically generated, do not edit. ; Edit file manifest/main.ml instead. -(executable - (name main) +(library + (name src_lib_webassembly_tests_tezt_lib) + (instrumentation (backend bisect_ppx)) (libraries + tezt.core tezos-webassembly-interpreter - alcotest) + octez-alcotezt) + (library_flags (:standard -linkall)) (flags (:standard) - -open Tezos_webassembly_interpreter)) + -open Tezt_core + -open Tezt_core.Base + -open Tezos_webassembly_interpreter + -open Octez_alcotezt) + (modules smallint)) + +(include_subdirs no) + +(executable + (name main) + (libraries + src_lib_webassembly_tests_tezt_lib + tezt) + (modules main)) (rule - (alias runtest) + (alias runtezt) (package tezos-webassembly-interpreter) (action (run %{dep:./main.exe}))) -(include_subdirs no) +(rule + (targets main.ml) + (action (with-stdout-to %{targets} (echo "let () = Tezt.Test.run ()")))) diff --git a/src/lib_webassembly/tests/main.ml b/src/lib_webassembly/tests/main.ml deleted file mode 100644 index 3e187136e3a8c6ab9e1dba63fa391167c2cbf935..0000000000000000000000000000000000000000 --- a/src/lib_webassembly/tests/main.ml +++ /dev/null @@ -1,3 +0,0 @@ -let tests = [("Smallint", Smallint.tests)] - -let () = Alcotest.run "WebAssembly reference interpreter tests" tests diff --git a/src/lib_webassembly/tests/smallint.ml b/src/lib_webassembly/tests/smallint.ml index 235adaeec461d403db8e7f469cb2afb37e8ab772..e83e7a2bd5db3bbdc559ac335b3530fab594037a 100644 --- a/src/lib_webassembly/tests/smallint.ml +++ b/src/lib_webassembly/tests/smallint.ml @@ -116,4 +116,6 @@ let check () = assert_equal 15l (I16.popcnt s16max) ; assert_equal 7l (I8.popcnt s8max) -let tests = [Alcotest.test_case "Check_smallint" `Quick check] +let tests = [("Smallint", [Alcotest.test_case "Check_smallint" `Quick check])] + +let () = Alcotest.run "WebAssembly reference interpreter tests" tests diff --git a/tezt/tests/dune b/tezt/tests/dune index f7da14044a1a9d1a71bf8e40280becfab5534de4..e6f8f79d8ec46ce4264acad493b8b901819c17da 100644 --- a/tezt/tests/dune +++ b/tezt/tests/dune @@ -57,6 +57,7 @@ src_proto_012_Psithaca_lib_client_test_tezt_lib src_proto_011_PtHangz2_lib_client_test_tezt_lib src_lib_workers_test_tezt_lib + src_lib_webassembly_tests_tezt_lib src_lib_stdlib_unix_test__tezt_lib src_lib_stdlib_test_unix_tezt_lib src_lib_stdlib_test_tezt_lib