From 93b8a725605ef0283cc9026d70ed7733814675c7 Mon Sep 17 00:00:00 2001 From: zapashcanon Date: Wed, 3 Jul 2024 16:12:02 +0200 Subject: [PATCH] valide binary module in script, promote tests --- src/script/script.ml | 11 +++++++---- test/script/reference.t | 2 +- test/script/reference_opt.t | 2 +- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/src/script/script.ml b/src/script/script.ml index 9b4c0e422..64753ad4d 100644 --- a/src/script/script.ml +++ b/src/script/script.ml @@ -188,10 +188,13 @@ let run ~no_exhaustion ~optimize script = let+ () = match got with | Error got -> check_error ~expected ~got - | Ok m -> - (* TODO: there should be some checks here before linking ! *) - let got = Link.modul link_state ~name:None m in - check_error_result expected got + | Ok m -> begin + match Typecheck.modul m with + | Error got -> check_error ~expected ~got + | Ok () -> + let got = Link.modul link_state ~name:None m in + check_error_result expected got + end in link_state | Assert (Assert_invalid (m, expected)) -> diff --git a/test/script/reference.t b/test/script/reference.t index 177759eb7..be6bd8d41 100644 --- a/test/script/reference.t +++ b/test/script/reference.t @@ -1,6 +1,6 @@ $ owi script --no-exhaustion reference/address.wast $ owi script --no-exhaustion reference/align.wast - expected alignment must not be larger than natural but there was no error + expected malformed memop flags but there was no error [7] $ owi script --no-exhaustion reference/binary-leb128.wast $ owi script --no-exhaustion reference/binary.wast diff --git a/test/script/reference_opt.t b/test/script/reference_opt.t index ad79aca6e..d20b46fd4 100644 --- a/test/script/reference_opt.t +++ b/test/script/reference_opt.t @@ -1,6 +1,6 @@ $ owi script --no-exhaustion --optimize reference/address.wast $ owi script --no-exhaustion --optimize reference/align.wast - expected alignment must not be larger than natural but there was no error + expected malformed memop flags but there was no error [7] $ owi script --no-exhaustion --optimize reference/binary-leb128.wast $ owi script --no-exhaustion --optimize reference/binary.wast