mirror of
https://github.com/rtic-rs/rtic.git
synced 2025-12-18 05:45:19 +01:00
xtask: size: Store the expected output same as run
This commit is contained in:
parent
b4a0c9057d
commit
67730ceedb
3 changed files with 27 additions and 5 deletions
|
|
@ -468,7 +468,7 @@ pub enum Commands {
|
||||||
/// arguments will be passed on
|
/// arguments will be passed on
|
||||||
///
|
///
|
||||||
/// Example: `cargo xtask size -- -A`
|
/// Example: `cargo xtask size -- -A`
|
||||||
Size(Arg),
|
Size(ArgsAndOverwrite),
|
||||||
|
|
||||||
/// Run examples in QEMU and compare against expected output
|
/// Run examples in QEMU and compare against expected output
|
||||||
///
|
///
|
||||||
|
|
@ -562,6 +562,19 @@ pub struct QemuAndRun {
|
||||||
pub overwrite_expected: bool,
|
pub overwrite_expected: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[derive(Debug, Parser, Clone)]
|
||||||
|
pub struct ArgsAndOverwrite {
|
||||||
|
/// If expected output is missing or mismatching, recreate the file
|
||||||
|
///
|
||||||
|
/// This overwrites only missing or mismatching
|
||||||
|
#[arg(long)]
|
||||||
|
pub overwrite_expected: bool,
|
||||||
|
|
||||||
|
/// Options to pass to `cargo <subcommand>`
|
||||||
|
#[command(subcommand)]
|
||||||
|
pub arguments: Option<ExtraArguments>,
|
||||||
|
}
|
||||||
|
|
||||||
#[derive(Debug, Parser, Clone)]
|
#[derive(Debug, Parser, Clone)]
|
||||||
pub struct Arg {
|
pub struct Arg {
|
||||||
/// Options to pass to `cargo <subcommand>`
|
/// Options to pass to `cargo <subcommand>`
|
||||||
|
|
|
||||||
|
|
@ -317,6 +317,7 @@ fn main() -> anyhow::Result<()> {
|
||||||
platform,
|
platform,
|
||||||
backend,
|
backend,
|
||||||
&examples_to_run,
|
&examples_to_run,
|
||||||
|
args.overwrite_expected,
|
||||||
&args.arguments,
|
&args.arguments,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -68,6 +68,9 @@ fn command_parser(
|
||||||
CargoCommand::Qemu {
|
CargoCommand::Qemu {
|
||||||
platform, example, ..
|
platform, example, ..
|
||||||
}
|
}
|
||||||
|
| CargoCommand::ExampleSize {
|
||||||
|
platform, example, ..
|
||||||
|
}
|
||||||
| CargoCommand::Run {
|
| CargoCommand::Run {
|
||||||
platform, example, ..
|
platform, example, ..
|
||||||
} => {
|
} => {
|
||||||
|
|
@ -108,7 +111,12 @@ fn command_parser(
|
||||||
}
|
}
|
||||||
|
|
||||||
let platform_name = platform.name();
|
let platform_name = platform.name();
|
||||||
let run_file = format!("{example}.run");
|
let run_file = if let CargoCommand::ExampleSize { .. } = *command {
|
||||||
|
format!("{example}.size")
|
||||||
|
} else {
|
||||||
|
format!("{example}.run")
|
||||||
|
};
|
||||||
|
|
||||||
let expected_output_file = ["ci", "expected", &platform_name, &run_file]
|
let expected_output_file = ["ci", "expected", &platform_name, &run_file]
|
||||||
.iter()
|
.iter()
|
||||||
.collect::<PathBuf>()
|
.collect::<PathBuf>()
|
||||||
|
|
@ -148,8 +156,7 @@ fn command_parser(
|
||||||
| CargoCommand::Clippy { .. }
|
| CargoCommand::Clippy { .. }
|
||||||
| CargoCommand::Doc { .. }
|
| CargoCommand::Doc { .. }
|
||||||
| CargoCommand::Test { .. }
|
| CargoCommand::Test { .. }
|
||||||
| CargoCommand::Book { .. }
|
| CargoCommand::Book { .. } => {
|
||||||
| CargoCommand::ExampleSize { .. } => {
|
|
||||||
let cargo_result = run_command(command, output_mode, true)?;
|
let cargo_result = run_command(command, output_mode, true)?;
|
||||||
Ok(cargo_result)
|
Ok(cargo_result)
|
||||||
}
|
}
|
||||||
|
|
@ -429,6 +436,7 @@ pub fn build_and_check_size<'c>(
|
||||||
platform: Platforms,
|
platform: Platforms,
|
||||||
backend: Backends,
|
backend: Backends,
|
||||||
examples: &'c [String],
|
examples: &'c [String],
|
||||||
|
overwrite: bool,
|
||||||
arguments: &'c Option<ExtraArguments>,
|
arguments: &'c Option<ExtraArguments>,
|
||||||
) -> Vec<FinalRunResult<'c>> {
|
) -> Vec<FinalRunResult<'c>> {
|
||||||
info!("Measuring for platform: {platform:?}, backend: {backend:?}");
|
info!("Measuring for platform: {platform:?}, backend: {backend:?}");
|
||||||
|
|
@ -468,7 +476,7 @@ pub fn build_and_check_size<'c>(
|
||||||
|
|
||||||
[cmd_build, cmd_size]
|
[cmd_build, cmd_size]
|
||||||
})
|
})
|
||||||
.map(|cmd| (globals, cmd, false));
|
.map(|cmd| (globals, cmd, overwrite));
|
||||||
|
|
||||||
runner.run_and_coalesce()
|
runner.run_and_coalesce()
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue