2021-08-26 10:58:59 +02:00
|
|
|
mod build;
|
|
|
|
mod command;
|
|
|
|
|
|
|
|
use anyhow::bail;
|
2023-02-05 01:50:29 +01:00
|
|
|
use clap::{Parser, Subcommand};
|
2021-08-26 10:58:59 +02:00
|
|
|
use core::fmt;
|
2023-02-05 02:07:20 +01:00
|
|
|
use rayon::prelude::*;
|
2021-08-26 10:58:59 +02:00
|
|
|
use std::{
|
|
|
|
error::Error,
|
|
|
|
ffi::OsString,
|
2023-02-05 01:50:29 +01:00
|
|
|
fs::File,
|
|
|
|
io::prelude::*,
|
2021-08-26 10:58:59 +02:00
|
|
|
path::{Path, PathBuf},
|
|
|
|
process,
|
|
|
|
process::ExitStatus,
|
|
|
|
str,
|
|
|
|
};
|
2023-02-05 01:50:29 +01:00
|
|
|
|
|
|
|
use env_logger::Env;
|
|
|
|
use log::{debug, error, info, log_enabled, trace, Level};
|
2021-08-26 10:58:59 +02:00
|
|
|
|
|
|
|
use crate::{
|
2021-12-26 10:43:57 +01:00
|
|
|
build::init_build_dir,
|
2021-08-26 10:58:59 +02:00
|
|
|
command::{run_command, run_successful, BuildMode, CargoCommand},
|
|
|
|
};
|
|
|
|
|
|
|
|
const ARMV6M: &str = "thumbv6m-none-eabi";
|
|
|
|
const ARMV7M: &str = "thumbv7m-none-eabi";
|
2023-02-05 19:39:29 +01:00
|
|
|
const ARMV8MBASE: &str = "thumbv8m.base-none-eabi";
|
|
|
|
const ARMV8MMAIN: &str = "thumbv8m.main-none-eabi";
|
2021-08-26 10:58:59 +02:00
|
|
|
|
2023-02-05 01:50:29 +01:00
|
|
|
const DEFAULT_FEATURES: Option<&str> = Some("test-critical-section");
|
|
|
|
|
|
|
|
#[derive(Parser)]
|
|
|
|
#[command(author, version, about, long_about = None)]
|
|
|
|
/// RTIC xtask powered testing toolbox
|
|
|
|
struct Cli {
|
2023-02-04 15:22:43 +01:00
|
|
|
/// For which ARM target to build: v7 or v6
|
|
|
|
///
|
2023-02-05 01:50:29 +01:00
|
|
|
/// Defaults to all targets if omitted.
|
2023-02-04 15:22:43 +01:00
|
|
|
/// The permissible targets are:
|
|
|
|
///
|
2023-02-05 01:50:29 +01:00
|
|
|
/// thumbv6m-none-eabi
|
|
|
|
/// thumbv7m-none-eabi
|
2023-02-05 19:39:29 +01:00
|
|
|
/// thumbv8m.base-none-eabi
|
|
|
|
/// thumbv8m.main-none-eabi
|
2023-02-05 01:50:29 +01:00
|
|
|
#[arg(short, long)]
|
2023-02-04 16:55:29 +01:00
|
|
|
target: Option<String>,
|
2023-02-05 01:50:29 +01:00
|
|
|
|
|
|
|
/// List of comma separated examples to run, all others are excluded
|
|
|
|
///
|
|
|
|
/// If omitted all examples are run
|
2023-02-04 15:47:23 +01:00
|
|
|
///
|
2023-02-05 01:50:29 +01:00
|
|
|
/// Example: `cargo xtask --example complex,spawn,init`
|
|
|
|
/// would include complex, spawn and init
|
|
|
|
#[arg(short, long, group = "example_group")]
|
2023-02-04 15:47:23 +01:00
|
|
|
example: Option<String>,
|
2023-02-05 01:50:29 +01:00
|
|
|
|
|
|
|
/// List of comma separated examples to exclude, all others are included
|
|
|
|
///
|
|
|
|
/// If omitted all examples are run
|
|
|
|
///
|
|
|
|
/// Example: `cargo xtask --excludeexample complex,spawn,init`
|
|
|
|
/// would exclude complex, spawn and init
|
|
|
|
#[arg(long, group = "example_group")]
|
|
|
|
exampleexclude: Option<String>,
|
|
|
|
|
|
|
|
/// Enable more verbose output, repeat up to `-vvv` for even more
|
|
|
|
#[arg(short, long, action = clap::ArgAction::Count)]
|
|
|
|
verbose: u8,
|
|
|
|
|
|
|
|
/// Subcommand picking which kind of operation
|
|
|
|
///
|
|
|
|
/// If omitted run all tests
|
|
|
|
#[command(subcommand)]
|
|
|
|
command: Option<Commands>,
|
|
|
|
}
|
|
|
|
|
|
|
|
#[derive(Debug, Subcommand)]
|
|
|
|
enum Commands {
|
|
|
|
/// Run `cargo size` on selected or all examples
|
2023-02-04 15:22:43 +01:00
|
|
|
///
|
|
|
|
/// To pass options to `cargo size`, add `--` and then the following
|
|
|
|
/// arguments will be passed on
|
|
|
|
///
|
2023-02-05 01:50:29 +01:00
|
|
|
/// Example: `cargo xtask size -- -A`
|
|
|
|
Size(Size),
|
|
|
|
|
|
|
|
/// Run examples in QEMU and compare against expected output
|
|
|
|
///
|
|
|
|
/// Example runtime output is matched against `rtic/ci/expected/`
|
|
|
|
Qemu {
|
|
|
|
/// If expected output is missing or mismatching, recreate the file
|
|
|
|
///
|
|
|
|
/// This overwrites only missing or mismatching
|
|
|
|
#[arg(long)]
|
|
|
|
overwrite_expected: bool,
|
|
|
|
},
|
|
|
|
/// Build all examples
|
|
|
|
Build,
|
|
|
|
/// Check all examples
|
|
|
|
Check,
|
|
|
|
}
|
|
|
|
|
|
|
|
#[derive(Debug, Parser)]
|
|
|
|
struct Size {
|
2023-02-04 15:22:43 +01:00
|
|
|
/// Options to pass to `cargo size`
|
2023-02-05 01:50:29 +01:00
|
|
|
#[command(subcommand)]
|
2023-02-04 15:22:43 +01:00
|
|
|
sizearguments: Option<Sizearguments>,
|
|
|
|
}
|
|
|
|
|
2023-02-05 01:50:29 +01:00
|
|
|
#[derive(Clone, Debug, PartialEq, Parser)]
|
2023-02-04 15:22:43 +01:00
|
|
|
pub enum Sizearguments {
|
2023-02-05 01:50:29 +01:00
|
|
|
/// All remaining flags and options
|
|
|
|
#[command(external_subcommand)]
|
2023-02-04 15:22:43 +01:00
|
|
|
Other(Vec<String>),
|
2021-08-26 10:58:59 +02:00
|
|
|
}
|
|
|
|
|
2021-09-22 13:22:45 +02:00
|
|
|
#[derive(Debug, Clone)]
|
2021-08-26 10:58:59 +02:00
|
|
|
pub struct RunResult {
|
|
|
|
exit_status: ExitStatus,
|
|
|
|
output: String,
|
|
|
|
}
|
|
|
|
|
|
|
|
#[derive(Debug)]
|
2021-09-22 13:22:45 +02:00
|
|
|
pub enum TestRunError {
|
|
|
|
FileCmpError { expected: String, got: String },
|
|
|
|
FileError { file: String },
|
2021-08-26 10:58:59 +02:00
|
|
|
PathConversionError(OsString),
|
|
|
|
CommandError(RunResult),
|
|
|
|
IncompatibleCommand,
|
|
|
|
}
|
2023-02-06 13:03:15 +01:00
|
|
|
use diffy::{create_patch, PatchFormatter};
|
2021-08-26 10:58:59 +02:00
|
|
|
|
|
|
|
impl fmt::Display for TestRunError {
|
|
|
|
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
|
|
|
match self {
|
2021-09-22 13:22:45 +02:00
|
|
|
TestRunError::FileCmpError { expected, got } => {
|
2023-02-06 13:03:15 +01:00
|
|
|
let patch = create_patch(expected, got);
|
2023-02-04 15:22:43 +01:00
|
|
|
writeln!(f, "Differing output in files.\n")?;
|
2023-02-06 13:03:15 +01:00
|
|
|
let pf = PatchFormatter::new().with_color();
|
|
|
|
writeln!(f, "{}", pf.fmt_patch(&patch))?;
|
|
|
|
write!(
|
|
|
|
f,
|
|
|
|
"See flag --overwrite-expected to create/update expected output."
|
|
|
|
)
|
2021-09-22 13:22:45 +02:00
|
|
|
}
|
|
|
|
TestRunError::FileError { file } => {
|
2023-02-06 13:03:15 +01:00
|
|
|
write!(f, "File error on: {file}\nSee flag --overwrite-expected to create/update expected output.")
|
2021-08-26 10:58:59 +02:00
|
|
|
}
|
|
|
|
TestRunError::CommandError(e) => {
|
|
|
|
write!(
|
|
|
|
f,
|
|
|
|
"Command failed with exit status {}: {}",
|
|
|
|
e.exit_status, e.output
|
|
|
|
)
|
|
|
|
}
|
|
|
|
TestRunError::PathConversionError(p) => {
|
2023-02-04 15:22:43 +01:00
|
|
|
write!(f, "Can't convert path from `OsString` to `String`: {p:?}")
|
2021-08-26 10:58:59 +02:00
|
|
|
}
|
|
|
|
TestRunError::IncompatibleCommand => {
|
|
|
|
write!(f, "Can't run that command in this context")
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
impl Error for TestRunError {}
|
|
|
|
|
|
|
|
fn main() -> anyhow::Result<()> {
|
2021-09-17 15:44:33 +02:00
|
|
|
// if there's an `xtask` folder, we're *probably* at the root of this repo (we can't just
|
|
|
|
// check the name of `env::current_dir()` because people might clone it into a different name)
|
|
|
|
let probably_running_from_repo_root = Path::new("./xtask").exists();
|
2023-02-04 15:22:43 +01:00
|
|
|
if !probably_running_from_repo_root {
|
|
|
|
bail!("xtasks can only be executed from the root of the `rtic` repository");
|
2021-08-26 10:58:59 +02:00
|
|
|
}
|
2023-02-05 19:39:29 +01:00
|
|
|
for entry in std::fs::read_dir(".").unwrap() {
|
2021-08-26 10:58:59 +02:00
|
|
|
|
2021-09-22 13:22:45 +02:00
|
|
|
|
2023-02-05 19:39:29 +01:00
|
|
|
let mut targets: Vec<String> = [
|
|
|
|
ARMV7M.to_owned(),
|
|
|
|
ARMV6M.to_owned(),
|
|
|
|
ARMV8MBASE.to_owned(),
|
|
|
|
ARMV8MMAIN.to_owned(),
|
|
|
|
]
|
|
|
|
.to_vec();
|
|
|
|
|
|
|
|
let examples: Vec<_> = std::fs::read_dir("./rtic/examples")?
|
2023-01-08 19:56:47 +01:00
|
|
|
.filter_map(|p| p.ok())
|
|
|
|
.map(|p| p.path())
|
|
|
|
.filter(|p| p.display().to_string().ends_with(".rs"))
|
|
|
|
.map(|path| path.file_stem().unwrap().to_str().unwrap().to_string())
|
2021-09-22 13:22:45 +02:00
|
|
|
.collect();
|
|
|
|
|
2023-02-05 01:50:29 +01:00
|
|
|
let cli = Cli::parse();
|
|
|
|
|
|
|
|
let env_logger_default_level = match cli.verbose {
|
|
|
|
0 => Env::default().default_filter_or("error"),
|
|
|
|
1 => Env::default().default_filter_or("info"),
|
|
|
|
2 => Env::default().default_filter_or("debug"),
|
|
|
|
_ => Env::default().default_filter_or("trace"),
|
|
|
|
};
|
|
|
|
env_logger::Builder::from_env(env_logger_default_level)
|
|
|
|
.format_module_path(false)
|
|
|
|
.format_timestamp(None)
|
|
|
|
.init();
|
2023-01-08 19:56:47 +01:00
|
|
|
|
2023-02-05 01:50:29 +01:00
|
|
|
trace!("default logging level: {0}", cli.verbose);
|
|
|
|
trace!("examples: {examples:?}");
|
|
|
|
|
|
|
|
let target = cli.target;
|
|
|
|
let example = cli.example;
|
2023-02-04 15:47:23 +01:00
|
|
|
|
|
|
|
if let Some(example) = example {
|
|
|
|
if examples.contains(&example) {
|
2023-02-05 01:50:29 +01:00
|
|
|
info!("Testing example: {example}");
|
2023-02-04 15:47:23 +01:00
|
|
|
// If we managed to filter, set the examples to test to only this one
|
|
|
|
examples = vec![example]
|
|
|
|
} else {
|
2023-02-05 01:50:29 +01:00
|
|
|
error!(
|
2023-02-04 15:47:23 +01:00
|
|
|
"\nThe example you specified is not available. Available examples are:\
|
|
|
|
\n{examples:#?}\n\
|
2023-02-05 01:50:29 +01:00
|
|
|
By default if example flag is emitted, all examples are tested.",
|
|
|
|
);
|
|
|
|
process::exit(1);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if let Some(target) = target {
|
|
|
|
if targets.contains(&target) {
|
|
|
|
debug!("\nTesting target: {target}");
|
|
|
|
// If we managed to filter, set the targets to test to only this one
|
|
|
|
targets = vec![target]
|
|
|
|
} else {
|
|
|
|
error!(
|
|
|
|
"\nThe target you specified is not available. Available targets are:\
|
|
|
|
\n{targets:#?}\n\
|
|
|
|
By default all targets are tested.",
|
2023-02-04 15:47:23 +01:00
|
|
|
);
|
|
|
|
process::exit(1);
|
|
|
|
}
|
|
|
|
}
|
2023-02-05 01:50:29 +01:00
|
|
|
|
2021-09-20 17:35:15 +02:00
|
|
|
init_build_dir()?;
|
2023-02-05 01:50:29 +01:00
|
|
|
#[allow(clippy::if_same_then_else)]
|
|
|
|
let cargoarg = if log_enabled!(Level::Trace) {
|
|
|
|
Some("-vv")
|
|
|
|
} else if log_enabled!(Level::Debug) {
|
|
|
|
Some("-v")
|
|
|
|
} else if log_enabled!(Level::Info) {
|
|
|
|
None
|
|
|
|
} else if log_enabled!(Level::Warn) || log_enabled!(Level::Error) {
|
|
|
|
Some("--quiet")
|
|
|
|
} else {
|
|
|
|
// Off case
|
|
|
|
Some("--quiet")
|
|
|
|
};
|
2021-09-20 17:35:15 +02:00
|
|
|
|
2023-02-05 01:50:29 +01:00
|
|
|
match cli.command {
|
|
|
|
Some(Commands::Size(arguments)) => {
|
|
|
|
debug!("Measuring on target(s): {targets:?}");
|
|
|
|
for t in &targets {
|
|
|
|
info!("Measuring for target: {t:?}");
|
|
|
|
build_and_check_size(&cargoarg, t, &examples, &arguments.sizearguments)?;
|
2023-02-04 16:55:29 +01:00
|
|
|
}
|
|
|
|
}
|
2023-02-05 01:50:29 +01:00
|
|
|
Some(Commands::Qemu {
|
|
|
|
overwrite_expected: overwrite,
|
|
|
|
}) => {
|
|
|
|
debug!("Testing on target(s): {targets:?}");
|
|
|
|
for t in &targets {
|
|
|
|
info!("Testing for target: {t:?}");
|
|
|
|
run_test(&cargoarg, t, &examples, overwrite)?;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
Some(Commands::Build) => {
|
|
|
|
debug!("Building for target(s): {targets:?}");
|
|
|
|
for t in &targets {
|
|
|
|
info!("Building for target: {t:?}");
|
|
|
|
build_all(&cargoarg, t)?;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
Some(Commands::Check) => {
|
|
|
|
debug!("Checking on target(s): {targets:?}");
|
|
|
|
for t in &targets {
|
|
|
|
info!("Checking on target: {t:?}");
|
|
|
|
check_all(&cargoarg, t)?;
|
2023-02-04 16:55:29 +01:00
|
|
|
}
|
2021-08-26 10:58:59 +02:00
|
|
|
}
|
2023-02-05 01:50:29 +01:00
|
|
|
None => {
|
|
|
|
todo!();
|
|
|
|
}
|
2021-08-26 10:58:59 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
Ok(())
|
|
|
|
}
|
|
|
|
|
2023-02-05 01:50:29 +01:00
|
|
|
fn build_all(cargoarg: &Option<&str>, target: &str) -> anyhow::Result<()> {
|
|
|
|
arm_example(
|
|
|
|
&CargoCommand::BuildAll {
|
|
|
|
cargoarg,
|
|
|
|
target,
|
|
|
|
features: DEFAULT_FEATURES,
|
|
|
|
mode: BuildMode::Release,
|
|
|
|
},
|
|
|
|
false,
|
|
|
|
)?;
|
|
|
|
Ok(())
|
|
|
|
}
|
|
|
|
|
|
|
|
fn check_all(cargoarg: &Option<&str>, target: &str) -> anyhow::Result<()> {
|
|
|
|
arm_example(
|
|
|
|
&CargoCommand::CheckAll {
|
|
|
|
cargoarg,
|
|
|
|
target,
|
|
|
|
features: DEFAULT_FEATURES,
|
|
|
|
},
|
|
|
|
false,
|
|
|
|
)?;
|
|
|
|
Ok(())
|
|
|
|
}
|
|
|
|
|
2023-02-04 15:22:43 +01:00
|
|
|
fn run_test(
|
2023-02-05 01:50:29 +01:00
|
|
|
cargoarg: &Option<&str>,
|
2023-02-04 15:22:43 +01:00
|
|
|
target: &str,
|
|
|
|
examples: &[String],
|
2023-02-05 01:50:29 +01:00
|
|
|
overwrite: bool,
|
2023-02-04 15:22:43 +01:00
|
|
|
) -> anyhow::Result<()> {
|
2023-02-05 02:07:20 +01:00
|
|
|
examples.into_par_iter().for_each(|example| {
|
2023-02-05 01:50:29 +01:00
|
|
|
let cmd = CargoCommand::Build {
|
|
|
|
cargoarg: &Some("--quiet"),
|
|
|
|
example,
|
|
|
|
target,
|
|
|
|
features: DEFAULT_FEATURES,
|
|
|
|
mode: BuildMode::Release,
|
|
|
|
};
|
2023-02-05 02:07:20 +01:00
|
|
|
arm_example(&cmd, false).unwrap();
|
2023-02-05 01:50:29 +01:00
|
|
|
|
2021-09-22 13:22:45 +02:00
|
|
|
let cmd = CargoCommand::Run {
|
2023-02-05 01:50:29 +01:00
|
|
|
cargoarg,
|
2021-09-22 13:22:45 +02:00
|
|
|
example,
|
|
|
|
target,
|
2023-02-05 01:50:29 +01:00
|
|
|
features: DEFAULT_FEATURES,
|
2021-09-22 13:22:45 +02:00
|
|
|
mode: BuildMode::Release,
|
|
|
|
};
|
|
|
|
|
2023-02-05 02:07:20 +01:00
|
|
|
arm_example(&cmd, overwrite).unwrap();
|
|
|
|
});
|
2023-02-05 01:50:29 +01:00
|
|
|
|
|
|
|
Ok(())
|
|
|
|
}
|
|
|
|
|
|
|
|
fn build_and_check_size(
|
|
|
|
cargoarg: &Option<&str>,
|
|
|
|
target: &str,
|
|
|
|
examples: &[String],
|
|
|
|
size_arguments: &Option<Sizearguments>,
|
|
|
|
) -> anyhow::Result<()> {
|
2023-02-05 02:07:20 +01:00
|
|
|
examples.into_par_iter().for_each(|example| {
|
2023-02-05 01:50:29 +01:00
|
|
|
// Make sure the requested example(s) are built
|
|
|
|
let cmd = CargoCommand::Build {
|
|
|
|
cargoarg: &Some("--quiet"),
|
|
|
|
example,
|
|
|
|
target,
|
|
|
|
features: DEFAULT_FEATURES,
|
|
|
|
mode: BuildMode::Release,
|
|
|
|
};
|
2023-02-05 02:07:20 +01:00
|
|
|
arm_example(&cmd, false).unwrap();
|
2023-02-05 01:50:29 +01:00
|
|
|
|
|
|
|
let cmd = CargoCommand::Size {
|
|
|
|
cargoarg,
|
|
|
|
example,
|
|
|
|
target,
|
|
|
|
features: DEFAULT_FEATURES,
|
|
|
|
mode: BuildMode::Release,
|
|
|
|
arguments: size_arguments.clone(),
|
|
|
|
};
|
2023-02-05 02:07:20 +01:00
|
|
|
arm_example(&cmd, false).unwrap();
|
|
|
|
});
|
2021-08-26 10:58:59 +02:00
|
|
|
|
|
|
|
Ok(())
|
|
|
|
}
|
|
|
|
|
|
|
|
// run example binary `example`
|
2023-02-05 01:50:29 +01:00
|
|
|
fn arm_example(command: &CargoCommand, overwrite: bool) -> anyhow::Result<()> {
|
2021-08-26 10:58:59 +02:00
|
|
|
match *command {
|
2021-12-26 10:43:57 +01:00
|
|
|
CargoCommand::Run { example, .. } => {
|
2023-02-04 15:22:43 +01:00
|
|
|
let run_file = format!("{example}.run");
|
2023-02-04 16:47:17 +01:00
|
|
|
let expected_output_file = ["rtic", "ci", "expected", &run_file]
|
2021-08-26 10:58:59 +02:00
|
|
|
.iter()
|
|
|
|
.collect::<PathBuf>()
|
|
|
|
.into_os_string()
|
|
|
|
.into_string()
|
2023-02-04 15:22:43 +01:00
|
|
|
.map_err(TestRunError::PathConversionError)?;
|
2021-08-26 10:58:59 +02:00
|
|
|
|
2023-02-05 01:50:29 +01:00
|
|
|
// cargo run <..>
|
2023-02-04 15:22:43 +01:00
|
|
|
let cargo_run_result = run_command(command)?;
|
2023-02-05 01:50:29 +01:00
|
|
|
info!("{}", cargo_run_result.output);
|
2021-08-26 10:58:59 +02:00
|
|
|
|
2023-02-05 01:50:29 +01:00
|
|
|
// Create a file for the expected output if it does not exist or mismatches
|
|
|
|
if overwrite {
|
|
|
|
let result = run_successful(&cargo_run_result, &expected_output_file);
|
|
|
|
if let Err(e) = result {
|
|
|
|
// FileError means the file did not exist or was unreadable
|
|
|
|
error!("Error: {e}");
|
|
|
|
let mut file_handle = File::create(&expected_output_file).map_err(|_| {
|
|
|
|
TestRunError::FileError {
|
|
|
|
file: expected_output_file.clone(),
|
|
|
|
}
|
|
|
|
})?;
|
2023-02-06 13:03:15 +01:00
|
|
|
info!("Flag --overwrite-expected enabled");
|
2023-02-05 01:50:29 +01:00
|
|
|
info!("Creating/updating file: {expected_output_file}");
|
|
|
|
file_handle.write_all(cargo_run_result.output.as_bytes())?;
|
|
|
|
};
|
|
|
|
} else {
|
|
|
|
run_successful(&cargo_run_result, &expected_output_file)?;
|
|
|
|
}
|
|
|
|
Ok(())
|
|
|
|
}
|
|
|
|
CargoCommand::Build { .. } => {
|
|
|
|
// cargo run <..>
|
|
|
|
let cargo_build_result = run_command(command)?;
|
|
|
|
if !cargo_build_result.output.is_empty() {
|
|
|
|
info!("{}", cargo_build_result.output);
|
2021-08-26 10:58:59 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
Ok(())
|
|
|
|
}
|
2021-12-26 10:43:57 +01:00
|
|
|
CargoCommand::BuildAll { .. } => {
|
2023-02-05 01:50:29 +01:00
|
|
|
// cargo build --examples
|
|
|
|
let cargo_build_result = run_command(command)?;
|
|
|
|
if !cargo_build_result.output.is_empty() {
|
|
|
|
info!("{}", cargo_build_result.output);
|
|
|
|
}
|
|
|
|
|
|
|
|
Ok(())
|
|
|
|
}
|
|
|
|
CargoCommand::CheckAll { .. } => {
|
|
|
|
// cargo check --examples
|
|
|
|
let cargo_check_result = run_command(command)?;
|
|
|
|
if !cargo_check_result.output.is_empty() {
|
|
|
|
info!("{}", cargo_check_result.output);
|
|
|
|
}
|
2021-08-26 10:58:59 +02:00
|
|
|
|
2021-12-26 10:43:57 +01:00
|
|
|
Ok(())
|
2023-02-04 15:22:43 +01:00
|
|
|
}
|
|
|
|
CargoCommand::Size { .. } => {
|
2023-02-05 01:50:29 +01:00
|
|
|
// cargo size
|
|
|
|
let cargo_size_result = run_command(command)?;
|
|
|
|
if !cargo_size_result.output.is_empty() {
|
|
|
|
info!("{}", cargo_size_result.output);
|
|
|
|
}
|
2023-02-04 15:22:43 +01:00
|
|
|
Ok(())
|
|
|
|
}
|
2021-08-26 10:58:59 +02:00
|
|
|
}
|
|
|
|
}
|