Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion interpreter/host/flags.ml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
let interactive = ref false
let trace = ref false
let unchecked = ref false
let checked = ref false
let print_sig = ref false
let dry = ref false
let width = ref 80
Expand Down
14 changes: 1 addition & 13 deletions interpreter/host/js.ml
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@ open Source
let harness =
"'use strict';\n" ^
"\n" ^
"let hard_validate = " ^ string_of_bool !Flags.checked ^ ";\n" ^
"\n" ^
"let spectest = {\n" ^
" print: print || ((...xs) => console.log(...xs)),\n" ^
" global: 666,\n" ^
Expand All @@ -37,7 +35,7 @@ let harness =
" } catch (e) {\n" ^
" throw new Error(\"Wasm validate throws\");\n" ^
" }\n" ^
" if (validated !== valid && valid !== null) {\n" ^
" if (validated !== valid) {\n" ^
" throw new Error(\"Wasm validate failure\" + " ^
"(valid ? \"\" : \" expected\"));\n" ^
" }\n" ^
Expand Down Expand Up @@ -78,14 +76,6 @@ let harness =
" throw new Error(\"Wasm validation failure expected\");\n" ^
"}\n" ^
"\n" ^
"function assert_soft_invalid(bytes) {\n" ^
" try { module(bytes, hard_validate ? false : null) } catch (e) {\n" ^
" if (e instanceof WebAssembly.CompileError) return;\n" ^
" }\n" ^
" if (hard_validate)\n" ^
" throw new Error(\"Wasm validation failure expected\");\n" ^
"}\n" ^
"\n" ^
"function assert_unlinkable(bytes) {\n" ^
" let mod = module(bytes);\n" ^
" try { new WebAssembly.Instance(mod, registry) } catch (e) {\n" ^
Expand Down Expand Up @@ -330,8 +320,6 @@ let of_assertion mods ass =
"assert_malformed(" ^ of_definition def ^ ");"
| AssertInvalid (def, _) ->
"assert_invalid(" ^ of_definition def ^ ");"
| AssertSoftInvalid (def, _) ->
"assert_soft_invalid(" ^ of_definition def ^ ");"
| AssertUnlinkable (def, _) ->
"assert_unlinkable(" ^ of_definition def ^ ");"
| AssertUninstantiable (def, _) ->
Expand Down
1 change: 0 additions & 1 deletion interpreter/host/main.ml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ let argspec = Arg.align
" configure output width (default is 80)";
"-s", Arg.Set Flags.print_sig, " show module signatures";
"-u", Arg.Set Flags.unchecked, " unchecked, do not perform validation";
"-c", Arg.Set Flags.checked, " fully checked, perform hard validation";
"-h", Arg.Clear Flags.harness, " exclude harness for JS convesion";
"-d", Arg.Set Flags.dry, " dry, do not run program";
"-t", Arg.Set Flags.trace, " trace execution";
Expand Down
15 changes: 5 additions & 10 deletions interpreter/host/run.ml
Original file line number Diff line number Diff line change
Expand Up @@ -313,21 +313,15 @@ let run_assertion ass =
| _ -> Assert.error ass.at "expected decoding error"
)

| AssertInvalid (def, re)
| AssertSoftInvalid (def, re) ->
let active =
match ass.it with
| AssertSoftInvalid _ -> !Flags.checked
| _ -> true
in
trace ("Asserting " ^ (if active then "" else "soft ") ^ "invalid...");
| AssertInvalid (def, re) ->
trace "Asserting invalid...";
(match
let m = run_definition def in
Valid.check_module m
with
| exception Valid.Invalid (_, msg) ->
assert_message ass.at "validation" msg re
| _ -> if active then Assert.error ass.at "expected validation error"
| _ -> Assert.error ass.at "expected validation error"
)

| AssertUnlinkable (def, re) ->
Expand All @@ -351,7 +345,8 @@ let run_assertion ass =
let imports = Import.link m in
ignore (Eval.init m imports)
with
| exception Eval.Trap (_, msg) -> assert_message ass.at "instantiation" msg re
| exception Eval.Trap (_, msg) ->
assert_message ass.at "instantiation" msg re
| _ -> Assert.error ass.at "expected instantiation error"
)

Expand Down
2 changes: 0 additions & 2 deletions interpreter/text/arrange.ml
Original file line number Diff line number Diff line change
Expand Up @@ -410,8 +410,6 @@ let assertion mode ass =
Node ("assert_malformed", [definition `Original None def; Atom (string re)])
| AssertInvalid (def, re) ->
Node ("assert_invalid", [definition mode None def; Atom (string re)])
| AssertSoftInvalid (def, re) ->
Node ("assert_soft_invalid", [definition mode None def; Atom (string re)])
| AssertUnlinkable (def, re) ->
Node ("assert_unlinkable", [definition mode None def; Atom (string re)])
| AssertUninstantiable (def, re) ->
Expand Down
1 change: 0 additions & 1 deletion interpreter/text/lexer.mll
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,6 @@ rule token = parse
| "get" { GET }
| "assert_malformed" { ASSERT_MALFORMED }
| "assert_invalid" { ASSERT_INVALID }
| "assert_soft_invalid" { ASSERT_SOFT_INVALID }
| "assert_unlinkable" { ASSERT_UNLINKABLE }
| "assert_return" { ASSERT_RETURN }
| "assert_return_nan" { ASSERT_RETURN_NAN }
Expand Down
2 changes: 0 additions & 2 deletions interpreter/text/parser.mly
Original file line number Diff line number Diff line change
Expand Up @@ -656,8 +656,6 @@ assertion :
{ AssertMalformed (snd $3, $4) @@ at () }
| LPAR ASSERT_INVALID module_ TEXT RPAR
{ AssertInvalid (snd $3, $4) @@ at () }
| LPAR ASSERT_SOFT_INVALID module_ TEXT RPAR
{ AssertSoftInvalid (snd $3, $4) @@ at () }
| LPAR ASSERT_UNLINKABLE module_ TEXT RPAR
{ AssertUnlinkable (snd $3, $4) @@ at () }
| LPAR ASSERT_TRAP module_ TEXT RPAR
Expand Down
1 change: 0 additions & 1 deletion interpreter/text/script.ml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ type assertion = assertion' Source.phrase
and assertion' =
| AssertMalformed of definition * string
| AssertInvalid of definition * string
| AssertSoftInvalid of definition * string
| AssertUnlinkable of definition * string
| AssertUninstantiable of definition * string
| AssertReturn of action * Ast.literal list
Expand Down
Loading