diff --git a/miri-script/src/commands.rs b/miri-script/src/commands.rs index aa43aa1548..88ee62fc18 100644 --- a/miri-script/src/commands.rs +++ b/miri-script/src/commands.rs @@ -356,11 +356,17 @@ impl Command { .unwrap_or_else(|_| "0".into()) .parse() .context("failed to parse MIRI_SEED_START")?; - let seed_count: u64 = env::var("MIRI_SEEDS") - .unwrap_or_else(|_| "256".into()) - .parse() - .context("failed to parse MIRI_SEEDS")?; - let seed_end = seed_start + seed_count; + let seed_end: u64 = match (env::var("MIRI_SEEDS"), env::var("MIRI_SEED_END")) { + (Ok(_), Ok(_)) => bail!("Only one of MIRI_SEEDS and MIRI_SEED_END may be set"), + (Ok(seeds), Err(_)) => + seed_start + seeds.parse::().context("failed to parse MIRI_SEEDS")?, + (Err(_), Ok(seed_end)) => seed_end.parse().context("failed to parse MIRI_SEED_END")?, + (Err(_), Err(_)) => seed_start + 256, + }; + if seed_end <= seed_start { + bail!("the end of the seed range must be larger than the start."); + } + let Some((command_name, trailing_args)) = command.split_first() else { bail!("expected many-seeds command to be non-empty"); }; diff --git a/miri-script/src/main.rs b/miri-script/src/main.rs index 41b82cfc47..712180be28 100644 --- a/miri-script/src/main.rs +++ b/miri-script/src/main.rs @@ -113,8 +113,9 @@ sysroot, to prevent conflicts with other toolchains. ./miri many-seeds : Runs over and over again with different seeds for Miri. The MIRIFLAGS variable is set to its original value appended with ` -Zmiri-seed=$SEED` for -many different seeds. The MIRI_SEEDS variable controls how many seeds are being -tried; MIRI_SEED_START controls the first seed to try. +many different seeds. MIRI_SEED_START controls the first seed to try (default: 0). +MIRI_SEEDS controls how many seeds are being tried (default: 256); +alternatively, MIRI_SEED_END controls the end of the (exclusive) seed range to try. ./miri bench : Runs the benchmarks from bench-cargo-miri in hyperfine. hyperfine needs to be installed.