Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: Fix spectest failure output #548

Merged
merged 2 commits into from
Sep 24, 2020
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
10 changes: 10 additions & 0 deletions test/smoketests/spectests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,16 @@ set_tests_properties(
PASS_REGULAR_EXPRESSION "PASSED 4, FAILED 22, SKIPPED 2"
)

add_test(
NAME fizzy/smoketests/spectests/failures-output
COMMAND fizzy-spectests ${CMAKE_CURRENT_LIST_DIR}/failures
)
set_tests_properties(
fizzy/smoketests/spectests/failures-output
PROPERTIES
PASS_REGULAR_EXPRESSION "FAILED Incorrect returned value\\. Expected: 12 \\(0xc\\) Actual: 10 \\(0xa\\)"
)

add_test(
NAME fizzy/smoketests/spectests/broken
COMMAND fizzy-spectests ${CMAKE_CURRENT_LIST_DIR}/broken
Expand Down
Binary file modified test/smoketests/spectests/failures/failures.14.wasm
Binary file not shown.
2 changes: 1 addition & 1 deletion test/smoketests/spectests/failures/failures.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
{"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": 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": 49, "action": {"type": "invoke", "field": "foo.i64", "args": []}, "expected": [{"type": "i64", "value": "12"}]},
{"type": "assert_return", "line": 50, "action": {"type": "invoke", "field": "foo.f32", "args": []}, "expected": [{"type": "f32", "value": "1075654427"}]},
{"type": "assert_return", "line": 51, "action": {"type": "invoke", "field": "foo.f64", "args": []}, "expected": [{"type": "f64", "value": "4612712839142428377"}]},
{"type": "assert_return", "line": 52, "action": {"type": "invoke", "field": "foo.f32", "args": []}, "expected": [{"type": "f32", "value": "nan:canonical"}]},
Expand Down
4 changes: 2 additions & 2 deletions test/smoketests/spectests/failures/failures.wast
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,13 @@
;; invalid result
(module
(func (export "foo.i32") (result i32) (i32.const 1))
(func (export "foo.i64") (result i64) (i64.const 1))
(func (export "foo.i64") (result i64) (i64.const 10))
(func (export "foo.f32") (result f32) (f32.const 1.234))
(func (export "foo.f64") (result f64) (f64.const 1.234))
(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.i64") (i64.const 12))
(assert_return (invoke "foo.f32") (f32.const 2.456))
(assert_return (invoke "foo.f64") (f64.const 2.456))
(assert_return (invoke "foo.f32") (f32.const nan:canonical))
Expand Down
4 changes: 2 additions & 2 deletions test/spectests/spectests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -492,8 +492,8 @@ class test_runner
std::stringstream message;
message << "Incorrect returned value. Expected: " << expected_value.i64 << " (0x"
<< std::hex << expected_value.i64 << ")"
<< " Actual: " << actual_value.i64 << " (0x" << std::hex << actual_value.i64
<< ")";
<< " Actual: " << std::dec << actual_value.i64 << " (0x" << std::hex
<< actual_value.i64 << ")";
fail(message.str());
return false;
}
Expand Down