From e07ffdc34e073aec9349fd5d2ed94555bba49f78 Mon Sep 17 00:00:00 2001 From: Volodymyr Shymanskyy Date: Sun, 28 Feb 2021 15:10:25 +0200 Subject: [PATCH] Update Cosmopolitan. Update pywasm3 tests. --- platforms/cosmopolitan/build.sh | 3 ++- platforms/python/test/test_m3.py | 10 ++++++---- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/platforms/cosmopolitan/build.sh b/platforms/cosmopolitan/build.sh index b7b7da9..b61a7ef 100755 --- a/platforms/cosmopolitan/build.sh +++ b/platforms/cosmopolitan/build.sh @@ -1,5 +1,6 @@ -COSMOPOLITAN_URL=https://github.com/jart/cosmopolitan/releases/download/0.1.2/cosmopolitan-amalgamation-0.1.2.zip +COSMOPOLITAN_VERSION=0.2 +COSMOPOLITAN_URL=https://github.com/jart/cosmopolitan/releases/download/$COSMOPOLITAN_VERSION/cosmopolitan-amalgamation-$COSMOPOLITAN_VERSION.zip SOURCE_DIR=../../source diff --git a/platforms/python/test/test_m3.py b/platforms/python/test/test_m3.py index f8626df..1e1097c 100644 --- a/platforms/python/test/test_m3.py +++ b/platforms/python/test/test_m3.py @@ -9,7 +9,7 @@ def wat2wasm(wat): fn_out = d + "/output.wasm" with open(fn_in, "wb") as f: f.write(wat.encode('utf8')) - subprocess.run(["wat2wasm", "-o", fn_out, fn_in], check=True) + subprocess.run(["wat2wasm", "--enable-all", "-o", fn_out, fn_in], check=True) with open(fn_out, "rb") as f: return f.read() @@ -19,14 +19,14 @@ FIB64_WASM = wat2wasm(""" (if (result i64) (i64.eqz (get_local $n)) (then (get_local $a)) - (else (call $fib2 (i64.sub (get_local $n) + (else (return_call $fib2 (i64.sub (get_local $n) (i64.const 1)) (get_local $b) (i64.add (get_local $a) (get_local $b)))))) (func $fib (export "fib") (param i64) (result i64) - (call $fib2 (get_local 0) + (return_call $fib2 (get_local 0) (i64.const 0) ;; seed value $a (i64.const 1))) ;; seed value $b ) @@ -200,7 +200,7 @@ def test_m3(capfd): def call_function(wasm, func, *args): env = m3.Environment() - rt = env.new_runtime(1024) + rt = env.new_runtime(4096) mod = env.parse_module(wasm) rt.load(mod) f = rt.find_function(func) @@ -209,3 +209,5 @@ def call_function(wasm, func, *args): def test_fib64(): assert call_function(FIB64_WASM, 'fib', '5') == 5 assert call_function(FIB64_WASM, 'fib', '10') == 55 + assert call_function(FIB64_WASM, 'fib', '90') == 2880067194370816120 +