From 3d2d891d7e1492d179cd8da7a618fbdd5efcca2c Mon Sep 17 00:00:00 2001 From: nsfisis Date: Sat, 16 Mar 2024 20:41:50 +0900 Subject: feat: add spec testsuites --- tests/fixtures/spec_testsuites/core/traps.json | 38 ++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 tests/fixtures/spec_testsuites/core/traps.json (limited to 'tests/fixtures/spec_testsuites/core/traps.json') diff --git a/tests/fixtures/spec_testsuites/core/traps.json b/tests/fixtures/spec_testsuites/core/traps.json new file mode 100644 index 0000000..a430fef --- /dev/null +++ b/tests/fixtures/spec_testsuites/core/traps.json @@ -0,0 +1,38 @@ +{"source_filename": "./traps.wast", + "commands": [ + {"type": "module", "line": 5, "filename": "traps.0.wasm"}, + {"type": "assert_trap", "line": 16, "action": {"type": "invoke", "field": "no_dce.i32.div_s", "args": [{"type": "i32", "value": "1"}, {"type": "i32", "value": "0"}]}, "text": "integer divide by zero", "expected": []}, + {"type": "assert_trap", "line": 17, "action": {"type": "invoke", "field": "no_dce.i32.div_u", "args": [{"type": "i32", "value": "1"}, {"type": "i32", "value": "0"}]}, "text": "integer divide by zero", "expected": []}, + {"type": "assert_trap", "line": 18, "action": {"type": "invoke", "field": "no_dce.i64.div_s", "args": [{"type": "i64", "value": "1"}, {"type": "i64", "value": "0"}]}, "text": "integer divide by zero", "expected": []}, + {"type": "assert_trap", "line": 19, "action": {"type": "invoke", "field": "no_dce.i64.div_u", "args": [{"type": "i64", "value": "1"}, {"type": "i64", "value": "0"}]}, "text": "integer divide by zero", "expected": []}, + {"type": "assert_trap", "line": 20, "action": {"type": "invoke", "field": "no_dce.i32.div_s", "args": [{"type": "i32", "value": "2147483648"}, {"type": "i32", "value": "4294967295"}]}, "text": "integer overflow", "expected": []}, + {"type": "assert_trap", "line": 21, "action": {"type": "invoke", "field": "no_dce.i64.div_s", "args": [{"type": "i64", "value": "9223372036854775808"}, {"type": "i64", "value": "18446744073709551615"}]}, "text": "integer overflow", "expected": []}, + {"type": "module", "line": 23, "filename": "traps.1.wasm"}, + {"type": "assert_trap", "line": 34, "action": {"type": "invoke", "field": "no_dce.i32.rem_s", "args": [{"type": "i32", "value": "1"}, {"type": "i32", "value": "0"}]}, "text": "integer divide by zero", "expected": []}, + {"type": "assert_trap", "line": 35, "action": {"type": "invoke", "field": "no_dce.i32.rem_u", "args": [{"type": "i32", "value": "1"}, {"type": "i32", "value": "0"}]}, "text": "integer divide by zero", "expected": []}, + {"type": "assert_trap", "line": 36, "action": {"type": "invoke", "field": "no_dce.i64.rem_s", "args": [{"type": "i64", "value": "1"}, {"type": "i64", "value": "0"}]}, "text": "integer divide by zero", "expected": []}, + {"type": "assert_trap", "line": 37, "action": {"type": "invoke", "field": "no_dce.i64.rem_u", "args": [{"type": "i64", "value": "1"}, {"type": "i64", "value": "0"}]}, "text": "integer divide by zero", "expected": []}, + {"type": "module", "line": 39, "filename": "traps.2.wasm"}, + {"type": "assert_trap", "line": 50, "action": {"type": "invoke", "field": "no_dce.i32.trunc_f32_s", "args": [{"type": "f32", "value": "2143289344"}]}, "text": "invalid conversion to integer", "expected": []}, + {"type": "assert_trap", "line": 51, "action": {"type": "invoke", "field": "no_dce.i32.trunc_f32_u", "args": [{"type": "f32", "value": "2143289344"}]}, "text": "invalid conversion to integer", "expected": []}, + {"type": "assert_trap", "line": 52, "action": {"type": "invoke", "field": "no_dce.i32.trunc_f64_s", "args": [{"type": "f64", "value": "9221120237041090560"}]}, "text": "invalid conversion to integer", "expected": []}, + {"type": "assert_trap", "line": 53, "action": {"type": "invoke", "field": "no_dce.i32.trunc_f64_u", "args": [{"type": "f64", "value": "9221120237041090560"}]}, "text": "invalid conversion to integer", "expected": []}, + {"type": "assert_trap", "line": 54, "action": {"type": "invoke", "field": "no_dce.i64.trunc_f32_s", "args": [{"type": "f32", "value": "2143289344"}]}, "text": "invalid conversion to integer", "expected": []}, + {"type": "assert_trap", "line": 55, "action": {"type": "invoke", "field": "no_dce.i64.trunc_f32_u", "args": [{"type": "f32", "value": "2143289344"}]}, "text": "invalid conversion to integer", "expected": []}, + {"type": "assert_trap", "line": 56, "action": {"type": "invoke", "field": "no_dce.i64.trunc_f64_s", "args": [{"type": "f64", "value": "9221120237041090560"}]}, "text": "invalid conversion to integer", "expected": []}, + {"type": "assert_trap", "line": 57, "action": {"type": "invoke", "field": "no_dce.i64.trunc_f64_u", "args": [{"type": "f64", "value": "9221120237041090560"}]}, "text": "invalid conversion to integer", "expected": []}, + {"type": "module", "line": 59, "filename": "traps.3.wasm"}, + {"type": "assert_trap", "line": 78, "action": {"type": "invoke", "field": "no_dce.i32.load", "args": [{"type": "i32", "value": "65536"}]}, "text": "out of bounds memory access", "expected": []}, + {"type": "assert_trap", "line": 79, "action": {"type": "invoke", "field": "no_dce.i32.load16_s", "args": [{"type": "i32", "value": "65536"}]}, "text": "out of bounds memory access", "expected": []}, + {"type": "assert_trap", "line": 80, "action": {"type": "invoke", "field": "no_dce.i32.load16_u", "args": [{"type": "i32", "value": "65536"}]}, "text": "out of bounds memory access", "expected": []}, + {"type": "assert_trap", "line": 81, "action": {"type": "invoke", "field": "no_dce.i32.load8_s", "args": [{"type": "i32", "value": "65536"}]}, "text": "out of bounds memory access", "expected": []}, + {"type": "assert_trap", "line": 82, "action": {"type": "invoke", "field": "no_dce.i32.load8_u", "args": [{"type": "i32", "value": "65536"}]}, "text": "out of bounds memory access", "expected": []}, + {"type": "assert_trap", "line": 83, "action": {"type": "invoke", "field": "no_dce.i64.load", "args": [{"type": "i32", "value": "65536"}]}, "text": "out of bounds memory access", "expected": []}, + {"type": "assert_trap", "line": 84, "action": {"type": "invoke", "field": "no_dce.i64.load32_s", "args": [{"type": "i32", "value": "65536"}]}, "text": "out of bounds memory access", "expected": []}, + {"type": "assert_trap", "line": 85, "action": {"type": "invoke", "field": "no_dce.i64.load32_u", "args": [{"type": "i32", "value": "65536"}]}, "text": "out of bounds memory access", "expected": []}, + {"type": "assert_trap", "line": 86, "action": {"type": "invoke", "field": "no_dce.i64.load16_s", "args": [{"type": "i32", "value": "65536"}]}, "text": "out of bounds memory access", "expected": []}, + {"type": "assert_trap", "line": 87, "action": {"type": "invoke", "field": "no_dce.i64.load16_u", "args": [{"type": "i32", "value": "65536"}]}, "text": "out of bounds memory access", "expected": []}, + {"type": "assert_trap", "line": 88, "action": {"type": "invoke", "field": "no_dce.i64.load8_s", "args": [{"type": "i32", "value": "65536"}]}, "text": "out of bounds memory access", "expected": []}, + {"type": "assert_trap", "line": 89, "action": {"type": "invoke", "field": "no_dce.i64.load8_u", "args": [{"type": "i32", "value": "65536"}]}, "text": "out of bounds memory access", "expected": []}, + {"type": "assert_trap", "line": 90, "action": {"type": "invoke", "field": "no_dce.f32.load", "args": [{"type": "i32", "value": "65536"}]}, "text": "out of bounds memory access", "expected": []}, + {"type": "assert_trap", "line": 91, "action": {"type": "invoke", "field": "no_dce.f64.load", "args": [{"type": "i32", "value": "65536"}]}, "text": "out of bounds memory access", "expected": []}]} -- cgit v1.2.3-70-g09d2