Skip to content

Commit

Permalink
test: add smoketest for test failures with i64/f32/f64 results
Browse files Browse the repository at this point in the history
  • Loading branch information
gumb0 committed Aug 7, 2020
1 parent fd7fed9 commit 2ef71c1
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 7 deletions.
2 changes: 1 addition & 1 deletion test/smoketests/spectests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ add_test(
set_tests_properties(
fizzy/smoketests/spectests/failures
PROPERTIES
PASS_REGULAR_EXPRESSION "PASSED 4, FAILED 18, SKIPPED 2"
PASS_REGULAR_EXPRESSION "PASSED 4, FAILED 21, SKIPPED 2"
)

add_test(
Expand Down
Binary file modified test/smoketests/spectests/failures/failures.14.wasm
Binary file not shown.
15 changes: 9 additions & 6 deletions test/smoketests/spectests/failures/failures.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,12 @@
{"type": "assert_uninstantiable", "line": 36, "filename": "failures.12.wasm", "text": "error", "module_type": "binary"},
{"type": "assert_unlinkable", "line": 38, "filename": "failures.13.wasm", "text": "error", "module_type": "binary"},
{"type": "module", "line": 41, "filename": "failures.14.wasm"},
{"type": "assert_return", "line": 45, "action": {"type": "invoke", "field": "foo.i32", "args": []}, "expected": [{"type": "i32", "value": "2"}]},
{"type": "assert_return", "line": 46, "action": {"type": "invoke", "field": "trap", "args": []}, "expected": [{"type": "i32", "value": "2"}]},
{"type": "assert_return", "line": 47, "action": {"type": "invoke", "field": "foo.i32", "args": []}, "expected": []},
{"type": "assert_trap", "line": 48, "action": {"type": "invoke", "field": "foo.i32", "args": []}, "text": "error", "expected": [{"type": "i32"}]},
{"type": "assert_return", "line": 51, "action": {"type": "invoke", "field": "foo.unknown", "args": []}, "expected": [{"type": "i32", "value": "2"}]},
{"type": "assert_return", "line": 53, "action": {"type": "get", "field": "glob"}, "expected": [{"type": "i32", "value": "55"}]}]}
{"type": "assert_return", "line": 48, "action": {"type": "invoke", "field": "foo.i32", "args": []}, "expected": [{"type": "i32", "value": "2"}]},
{"type": "assert_return", "line": 49, "action": {"type": "invoke", "field": "foo.i64", "args": []}, "expected": [{"type": "i64", "value": "2"}]},
{"type": "assert_return", "line": 50, "action": {"type": "invoke", "field": "foo.f32", "args": []}, "expected": [{"type": "f32", "value": "1073741824"}]},
{"type": "assert_return", "line": 51, "action": {"type": "invoke", "field": "foo.f64", "args": []}, "expected": [{"type": "f64", "value": "4611686018427387904"}]},
{"type": "assert_return", "line": 52, "action": {"type": "invoke", "field": "trap", "args": []}, "expected": [{"type": "i32", "value": "2"}]},
{"type": "assert_return", "line": 53, "action": {"type": "invoke", "field": "foo.i32", "args": []}, "expected": []},
{"type": "assert_trap", "line": 54, "action": {"type": "invoke", "field": "foo.i32", "args": []}, "text": "error", "expected": [{"type": "i32"}]},
{"type": "assert_return", "line": 57, "action": {"type": "invoke", "field": "foo.unknown", "args": []}, "expected": [{"type": "i32", "value": "2"}]},
{"type": "assert_return", "line": 59, "action": {"type": "get", "field": "glob"}, "expected": [{"type": "i32", "value": "55"}]}]}
6 changes: 6 additions & 0 deletions test/smoketests/spectests/failures/failures.wast
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,15 @@
;; invalid result
(module
(func (export "foo.i32") (result i32) (i32.const 1))
(func (export "foo.i64") (result i64) (i64.const 1))
(func (export "foo.f32") (result f32) (f32.const 1))
(func (export "foo.f64") (result f64) (f64.const 1))
(func (export "trap") (result i32) (unreachable))
)
(assert_return (invoke "foo.i32") (i32.const 2))
(assert_return (invoke "foo.i64") (i64.const 2))
(assert_return (invoke "foo.f32") (f32.const 2))
(assert_return (invoke "foo.f64") (f64.const 2))
(assert_return (invoke "trap") (i32.const 2))
(assert_return (invoke "foo.i32"))
(assert_trap (invoke "foo.i32") "error")
Expand Down

0 comments on commit 2ef71c1

Please sign in to comment.