From 92b907872adda7bf453dff230902b8ae4605abd2 Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Tue, 8 Nov 2022 11:08:30 -0800 Subject: [PATCH 1/3] Add empty `imports.wit` for `exports_only` test Otherwise the build process thinks this is always missing so tests are always slowly rebuilt. --- tests/runtime/exports_only/imports.wit | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 tests/runtime/exports_only/imports.wit diff --git a/tests/runtime/exports_only/imports.wit b/tests/runtime/exports_only/imports.wit new file mode 100644 index 000000000..e69de29bb From 53822221558df64b7b174b7e1c5b59b92d2953b9 Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Tue, 8 Nov 2022 11:11:50 -0800 Subject: [PATCH 2/3] Fix compiling the `runtime` test for JS in isolation This requires the `clap` feature to be enabled now which works with `cargo test --workspace` but isn't working with individual crate testing. --- crates/gen-host-js/Cargo.toml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/crates/gen-host-js/Cargo.toml b/crates/gen-host-js/Cargo.toml index 9af643205..58be287cd 100644 --- a/crates/gen-host-js/Cargo.toml +++ b/crates/gen-host-js/Cargo.toml @@ -20,3 +20,7 @@ base64 = "0.13.1" [dev-dependencies] test-helpers = { path = '../test-helpers' } + +[[test]] +name = "runtime" +required-features = ["clap"] From 0031a50f66eef4f33882ddfe68fe78aec5b8d64d Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Tue, 8 Nov 2022 11:13:33 -0800 Subject: [PATCH 3/3] Don't test wasm size in exports_only test Different versions of `wasi-libc` will produce differently sized binaries, so only test the generated JS which this repo controls. --- tests/runtime/exports_only/host.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/runtime/exports_only/host.ts b/tests/runtime/exports_only/host.ts index ce9b1cfff..0c1d5d481 100644 --- a/tests/runtime/exports_only/host.ts +++ b/tests/runtime/exports_only/host.ts @@ -1,4 +1,4 @@ -// Flags: --base64 --nodejs-compat --valid-lifting-optimization +// Flags: --nodejs-compat --valid-lifting-optimization // @ts-ignore import { ok, strictEqual } from 'assert'; // @ts-ignore @@ -13,6 +13,6 @@ strictEqual(result, 'test'); // Verify the inlined file size does not regress const url = new URL('./exports_only.js', import.meta.url); const jsSource = await readFile(url); -const max_size = 6442; +const max_size = 1105; ok(jsSource.byteLength <= max_size, `JS inlined bytelength ${jsSource.byteLength} is greater than ${max_size} bytes, at ${fileURLToPath(url)}`);