Skip to content

Commit 9469c16

Browse files
authored
Remove reliance on wat2wasm in interpreter tests (#1893)
Move usage to the `wat` crate instead.
1 parent 31f7bd5 commit 9469c16

File tree

3 files changed

+5
-32
lines changed

3 files changed

+5
-32
lines changed

azure-pipelines.yml

+2-17
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,8 @@ jobs:
100100
displayName: "wasm-bindgen-anyref-xform tests"
101101
- script: cargo test -p wasm-bindgen-multi-value-xform
102102
displayName: "wasm-bindgen-multi-value-xform tests"
103+
- script: cargo test -p wasm-bindgen-wasm-interpreter
104+
displayName: "wasm-bindgen-wasm-interpreter tests"
103105

104106
- job: test_web_sys
105107
displayName: "Run web-sys crate tests"
@@ -158,23 +160,6 @@ jobs:
158160
# - template: ci/azure-install-sccache.yml
159161
- script: cargo test -p wasm-bindgen-macro
160162

161-
- job: test_wasm_interpreter
162-
displayName: "Run wasm-bindgen-wasm-interpreter tests"
163-
steps:
164-
- template: ci/azure-install-rust.yml
165-
# Temporarily disable sccache because it is failing on CI.
166-
# - template: ci/azure-install-sccache.yml
167-
- script: |
168-
git clone https://github.com/WebAssembly/wabt
169-
mkdir -p wabt/build
170-
cd wabt/build
171-
# Temporarily disable sccache because it is failing on CI.
172-
# cmake .. -DCMAKE_BUILD_TYPE=Release -DBUILD_TESTS=off -DCMAKE_CXX_COMPILER_LAUNCHER=$RUSTC_WRAPPER
173-
cmake .. -DCMAKE_BUILD_TYPE=Release -DBUILD_TESTS=off
174-
cmake --build . -- -j$(nproc)
175-
echo "##vso[task.prependpath]$PWD"
176-
- script: cargo test -p wasm-bindgen-wasm-interpreter
177-
178163
- job: test_typescript_output
179164
displayName: "Test TypeScript output of wasm-bindgen"
180165
steps:

crates/wasm-interpreter/Cargo.toml

+1
Original file line numberDiff line numberDiff line change
@@ -18,3 +18,4 @@ walrus = "0.14.0"
1818

1919
[dev-dependencies]
2020
tempfile = "3"
21+
wat = "1.0"

crates/wasm-interpreter/tests/smoke.rs

+2-15
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,8 @@
1-
use std::fs;
2-
use std::process::Command;
3-
41
use wasm_bindgen_wasm_interpreter::Interpreter;
52

63
fn interpret(wat: &str, name: &str, result: Option<&[u32]>) {
7-
let input = tempfile::NamedTempFile::new().unwrap();
8-
let output = tempfile::NamedTempFile::new().unwrap();
9-
fs::write(input.path(), wat).unwrap();
10-
let status = Command::new("wat2wasm")
11-
.arg(input.path())
12-
.arg("-o")
13-
.arg(output.path())
14-
.status()
15-
.unwrap();
16-
println!("status: {}", status);
17-
assert!(status.success());
18-
let module = walrus::Module::from_file(output.path()).unwrap();
4+
let wasm = wat::parse_str(wat).unwrap();
5+
let module = walrus::Module::from_buffer(&wasm).unwrap();
196
let mut i = Interpreter::new(&module).unwrap();
207
let id = module
218
.exports

0 commit comments

Comments
 (0)