Convert some WebAssembly run-make tests to Rust
This commit rewrites a number of `run-make` tests centered around wasm to instead use `rmake.rs` and additionally use the `wasm32-wasip1` target instead of `wasm32-unknown-unknown`. Testing no longer requires Node.js and additionally uses the `wasmparser` crate from crates.io to parse outputs and power assertions.
This commit is contained in:
parent
d255c6a57c
commit
7141379559
35 changed files with 439 additions and 336 deletions
|
|
@ -4,3 +4,4 @@ version = "0.0.0"
|
|||
edition = "2021"
|
||||
|
||||
[dependencies]
|
||||
wasmparser = "0.118.2"
|
||||
|
|
|
|||
|
|
@ -2,13 +2,16 @@ use std::env;
|
|||
use std::path::{Path, PathBuf};
|
||||
use std::process::{Command, Output};
|
||||
|
||||
pub use wasmparser;
|
||||
|
||||
pub fn out_dir() -> PathBuf {
|
||||
env::var_os("TMPDIR").unwrap().into()
|
||||
}
|
||||
|
||||
fn setup_common_build_cmd() -> Command {
|
||||
let rustc = env::var("RUSTC").unwrap();
|
||||
let mut cmd = Command::new(rustc);
|
||||
cmd.arg("--out-dir")
|
||||
.arg(env::var("TMPDIR").unwrap())
|
||||
.arg("-L")
|
||||
.arg(env::var("TMPDIR").unwrap());
|
||||
cmd.arg("--out-dir").arg(out_dir()).arg("-L").arg(out_dir());
|
||||
cmd
|
||||
}
|
||||
|
||||
|
|
@ -45,6 +48,11 @@ impl RustcInvocationBuilder {
|
|||
self
|
||||
}
|
||||
|
||||
pub fn args(&mut self, args: &[&str]) -> &mut RustcInvocationBuilder {
|
||||
self.cmd.args(args);
|
||||
self
|
||||
}
|
||||
|
||||
#[track_caller]
|
||||
pub fn run(&mut self) -> Output {
|
||||
let caller_location = std::panic::Location::caller();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue