Skip to content

Commit fdc4d42

Browse files
committed
Add cargo xtask miri
1 parent df40889 commit fdc4d42

File tree

2 files changed

+39
-0
lines changed

2 files changed

+39
-0
lines changed

xtask/src/main.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ use anyhow::Context;
77
use pico_args::Arguments;
88

99
mod cts;
10+
mod miri;
1011
mod run_wasm;
1112
mod test;
1213
mod util;
@@ -37,6 +38,14 @@ Commands:
3738
3839
All extra arguments will be forwarded to cargo-nextest (NOT wgpu-info)
3940
41+
miri
42+
Run all miri-compatible tests under miri. Requires a nightly toolchain
43+
with the x86_64-unknown-linux-gnu target and miri component installed.
44+
45+
--toolchain <toolchain> The toolchain to use for miri tests.
46+
Must be a nightly toolchain.
47+
Defaults to `nightly`.
48+
4049
vendor-web-sys
4150
Re-vendor the WebGPU web-sys bindings.
4251
@@ -85,6 +94,7 @@ fn main() -> anyhow::Result<ExitCode> {
8594
match subcommand.as_deref() {
8695
Some("cts") => cts::run_cts(shell, args)?,
8796
Some("run-wasm") => run_wasm::run_wasm(shell, args)?,
97+
Some("miri") => miri::run_miri(shell, args)?,
8898
Some("test") => test::run_tests(shell, args)?,
8999
Some("vendor-web-sys") => vendor_web_sys::run_vendor_web_sys(shell, args)?,
90100
Some(subcommand) => {

xtask/src/miri.rs

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
use pico_args::Arguments;
2+
use xshell::Shell;
3+
4+
pub fn run_miri(shell: Shell, mut args: Arguments) -> anyhow::Result<()> {
5+
let toolchain: String = args
6+
.opt_value_from_str("--toolchain")?
7+
.unwrap_or_else(|| String::from("nightly"));
8+
9+
shell
10+
.cmd("rustup")
11+
.args([
12+
"run",
13+
&toolchain,
14+
"cargo",
15+
"miri",
16+
"nextest",
17+
"run",
18+
"--target",
19+
"x86_64-unknown-linux-gnu",
20+
])
21+
.env(
22+
"MIRIFLAGS",
23+
"-Zmiri-disable-isolation -Zmiri-deterministic-floats",
24+
)
25+
.quiet()
26+
.run()?;
27+
28+
Ok(())
29+
}

0 commit comments

Comments
 (0)