Merge pull request #4089 from RalfJung/ci-bench
ci TEST_BENCH: show output
This commit is contained in:
commit
658edd4ec5
3 changed files with 18 additions and 8 deletions
|
|
@ -18,7 +18,7 @@ export RUSTFLAGS="-D warnings"
|
|||
export CARGO_INCREMENTAL=0
|
||||
export CARGO_EXTRA_FLAGS="--locked"
|
||||
|
||||
# Determine configuration for installed build (used by test-cargo-miri).
|
||||
# Determine configuration for installed build (used by test-cargo-miri and `./miri bench`).
|
||||
echo "Installing release version of Miri"
|
||||
time ./miri install
|
||||
|
||||
|
|
@ -73,7 +73,7 @@ function run_tests {
|
|||
fi
|
||||
if [ -n "${TEST_BENCH-}" ]; then
|
||||
# Check that the benchmarks build and run, but only once.
|
||||
time HYPERFINE="hyperfine -w0 -r1" ./miri bench $TARGET_FLAG
|
||||
time HYPERFINE="hyperfine -w0 -r1 --show-output" ./miri bench $TARGET_FLAG --no-install
|
||||
fi
|
||||
# Smoke-test `./miri run --dep`.
|
||||
./miri run $TARGET_FLAG --dep tests/pass-dep/getrandom.rs
|
||||
|
|
|
|||
|
|
@ -179,7 +179,8 @@ impl Command {
|
|||
Command::Doc { flags } => Self::doc(flags),
|
||||
Command::Fmt { flags } => Self::fmt(flags),
|
||||
Command::Clippy { flags } => Self::clippy(flags),
|
||||
Command::Bench { target, benches } => Self::bench(target, benches),
|
||||
Command::Bench { target, no_install, benches } =>
|
||||
Self::bench(target, no_install, benches),
|
||||
Command::Toolchain { flags } => Self::toolchain(flags),
|
||||
Command::RustcPull { commit } => Self::rustc_pull(commit.clone()),
|
||||
Command::RustcPush { github_user, branch } => Self::rustc_push(github_user, branch),
|
||||
|
|
@ -378,7 +379,7 @@ impl Command {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
fn bench(target: Option<String>, benches: Vec<String>) -> Result<()> {
|
||||
fn bench(target: Option<String>, no_install: bool, benches: Vec<String>) -> Result<()> {
|
||||
// The hyperfine to use
|
||||
let hyperfine = env::var("HYPERFINE");
|
||||
let hyperfine = hyperfine.as_deref().unwrap_or("hyperfine -w 1 -m 5 --shell=none");
|
||||
|
|
@ -386,8 +387,10 @@ impl Command {
|
|||
let Some((program_name, args)) = hyperfine.split_first() else {
|
||||
bail!("expected HYPERFINE environment variable to be non-empty");
|
||||
};
|
||||
// Make sure we have an up-to-date Miri installed and selected the right toolchain.
|
||||
Self::install(vec![])?;
|
||||
if !no_install {
|
||||
// Make sure we have an up-to-date Miri installed and selected the right toolchain.
|
||||
Self::install(vec![])?;
|
||||
}
|
||||
|
||||
let sh = Shell::new()?;
|
||||
sh.change_dir(miri_dir()?);
|
||||
|
|
|
|||
|
|
@ -69,6 +69,8 @@ pub enum Command {
|
|||
/// Runs the benchmarks from bench-cargo-miri in hyperfine. hyperfine needs to be installed.
|
||||
Bench {
|
||||
target: Option<String>,
|
||||
/// When `true`, skip the `./miri install` step.
|
||||
no_install: bool,
|
||||
/// List of benchmarks to run. By default all benchmarks are run.
|
||||
benches: Vec<String>,
|
||||
},
|
||||
|
|
@ -121,9 +123,11 @@ install`. Sets up the rpath such that the installed binary should work in any
|
|||
working directory. Note that the binaries are placed in the `miri` toolchain
|
||||
sysroot, to prevent conflicts with other toolchains.
|
||||
|
||||
./miri bench [--target <target>] <benches>:
|
||||
./miri bench [--target <target>] [--no-install] <benches>:
|
||||
Runs the benchmarks from bench-cargo-miri in hyperfine. hyperfine needs to be installed.
|
||||
<benches> can explicitly list the benchmarks to run; by default, all of them are run.
|
||||
By default, this runs `./miri install` to ensure the latest local Miri is being benchmarked;
|
||||
`--no-install` can be used to skip that step.
|
||||
|
||||
./miri toolchain <flags>:
|
||||
Update and activate the rustup toolchain 'miri' to the commit given in the
|
||||
|
|
@ -218,16 +222,19 @@ fn main() -> Result<()> {
|
|||
Some("bench") => {
|
||||
let mut target = None;
|
||||
let mut benches = Vec::new();
|
||||
let mut no_install = false;
|
||||
loop {
|
||||
if let Some(val) = args.get_long_opt("target")? {
|
||||
target = Some(val);
|
||||
} else if args.get_long_flag("no-install")? {
|
||||
no_install = true;
|
||||
} else if let Some(flag) = args.get_other() {
|
||||
benches.push(flag);
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
Command::Bench { target, benches }
|
||||
Command::Bench { target, benches, no_install }
|
||||
}
|
||||
Some("toolchain") => Command::Toolchain { flags: args.remainder() },
|
||||
Some("rustc-pull") => {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue