Add cargo xtask miri

This commit is contained in:
Connor Fitzgerald 2025-07-13 02:48:47 -04:00
parent df40889e1b
commit fdc4d421e7
2 changed files with 39 additions and 0 deletions

View File

@ -7,6 +7,7 @@ use anyhow::Context;
use pico_args::Arguments;
mod cts;
mod miri;
mod run_wasm;
mod test;
mod util;
@ -37,6 +38,14 @@ Commands:
All extra arguments will be forwarded to cargo-nextest (NOT wgpu-info)
miri
Run all miri-compatible tests under miri. Requires a nightly toolchain
with the x86_64-unknown-linux-gnu target and miri component installed.
--toolchain <toolchain> The toolchain to use for miri tests.
Must be a nightly toolchain.
Defaults to `nightly`.
vendor-web-sys
Re-vendor the WebGPU web-sys bindings.
@ -85,6 +94,7 @@ fn main() -> anyhow::Result<ExitCode> {
match subcommand.as_deref() {
Some("cts") => cts::run_cts(shell, args)?,
Some("run-wasm") => run_wasm::run_wasm(shell, args)?,
Some("miri") => miri::run_miri(shell, args)?,
Some("test") => test::run_tests(shell, args)?,
Some("vendor-web-sys") => vendor_web_sys::run_vendor_web_sys(shell, args)?,
Some(subcommand) => {

29
xtask/src/miri.rs Normal file
View File

@ -0,0 +1,29 @@
use pico_args::Arguments;
use xshell::Shell;
pub fn run_miri(shell: Shell, mut args: Arguments) -> anyhow::Result<()> {
let toolchain: String = args
.opt_value_from_str("--toolchain")?
.unwrap_or_else(|| String::from("nightly"));
shell
.cmd("rustup")
.args([
"run",
&toolchain,
"cargo",
"miri",
"nextest",
"run",
"--target",
"x86_64-unknown-linux-gnu",
])
.env(
"MIRIFLAGS",
"-Zmiri-disable-isolation -Zmiri-deterministic-floats",
)
.quiet()
.run()?;
Ok(())
}