From 86af2f7bd674ece4880424af85126c2e95b2b490 Mon Sep 17 00:00:00 2001 From: Volodymyr Shymanskyy Date: Mon, 28 Dec 2020 02:20:02 +0200 Subject: [PATCH] Add ability to select spec version for testing --- test/internal/m3_test.c | 11 ++++++----- test/run-spec-test.py | 7 +++++-- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/test/internal/m3_test.c b/test/internal/m3_test.c index d11ff31..673e11f 100644 --- a/test/internal/m3_test.c +++ b/test/internal/m3_test.c @@ -28,16 +28,17 @@ int main (int i_argc, const char * i_argv []) m3Free (ftype); result = SignatureToFuncType (& ftype, " v () "); expect (result == m3Err_none) - expect (ftype->returnType == c_m3Type_none) + expect (ftype->numRets == 0) expect (ftype->numArgs == 0) m3Free (ftype); result = SignatureToFuncType (& ftype, "f(IiF)"); expect (result == m3Err_none) - expect (ftype->returnType == c_m3Type_f32) + expect (ftype->numRets == 1) + expect (ftype->types [0] == c_m3Type_f32) expect (ftype->numArgs == 3) - expect (ftype->argTypes [0] == c_m3Type_i64) - expect (ftype->argTypes [1] == c_m3Type_i32) - expect (ftype->argTypes [2] == c_m3Type_f64) + expect (ftype->types [1] == c_m3Type_i64) + expect (ftype->types [2] == c_m3Type_i32) + expect (ftype->types [3] == c_m3Type_f64) IM3FuncType ftype2 = NULL; result = SignatureToFuncType (& ftype2, "f(I i F)"); expect (result == m3Err_none); diff --git a/test/run-spec-test.py b/test/run-spec-test.py index 66c4b71..b4c71aa 100755 --- a/test/run-spec-test.py +++ b/test/run-spec-test.py @@ -48,6 +48,7 @@ from pprint import pprint parser = argparse.ArgumentParser() parser.add_argument("--exec", metavar="", default="../build/wasm3 --repl") +parser.add_argument("--spec", default="v1.1") parser.add_argument("--timeout", type=int, default=30) parser.add_argument("--line", metavar="", type=int) parser.add_argument("--all", action="store_true") @@ -146,7 +147,7 @@ if not (os.path.isdir("./core") and os.path.isdir("./proposals")): from zipfile import ZipFile from urllib.request import urlopen - officialSpec = "https://github.com/wasm3/wasm-core-testsuite/archive/v1.1.zip" + officialSpec = f"https://github.com/wasm3/wasm-core-testsuite/archive/{args.spec}.zip" print(f"Downloading {officialSpec}") resp = urlopen(officialSpec) @@ -482,7 +483,9 @@ for fn in jsonFiles: try: wasm_fn = os.path.join(pathname(fn), wasm_module) - wasm3.load(wasm_fn) + res = wasm3.load(wasm_fn) + if res: + warning(res) except Exception as e: pass #fatal(str(e))