mirror of
https://github.com/rtic-rs/rtic.git
synced 2024-11-23 20:22:51 +01:00
Fix running of tests
This commit is contained in:
parent
d838286de6
commit
1c84ccf6e4
3 changed files with 30 additions and 26 deletions
|
@ -302,7 +302,7 @@ pub fn cargo_book<'c>(
|
||||||
/// Run examples
|
/// Run examples
|
||||||
///
|
///
|
||||||
/// Supports updating the expected output via the overwrite argument
|
/// Supports updating the expected output via the overwrite argument
|
||||||
pub fn run_test<'c>(
|
pub fn qemu_run_examples<'c>(
|
||||||
globals: &Globals,
|
globals: &Globals,
|
||||||
cargoarg: &'c Option<&'c str>,
|
cargoarg: &'c Option<&'c str>,
|
||||||
backend: Backends,
|
backend: Backends,
|
||||||
|
@ -312,31 +312,30 @@ pub fn run_test<'c>(
|
||||||
let target = backend.to_target();
|
let target = backend.to_target();
|
||||||
let features = Some(target.and_features(backend.to_rtic_feature()));
|
let features = Some(target.and_features(backend.to_rtic_feature()));
|
||||||
|
|
||||||
examples_iter(examples)
|
let build = examples_iter(examples).map(|example| {
|
||||||
.map(|example| {
|
let cmd_build = CargoCommand::ExampleBuild {
|
||||||
let cmd = CargoCommand::ExampleBuild {
|
// We need to be in the correct
|
||||||
cargoarg: &Some("--quiet"),
|
cargoarg: &None,
|
||||||
example,
|
example,
|
||||||
target,
|
target,
|
||||||
features: features.clone(),
|
features: features.clone(),
|
||||||
mode: BuildMode::Release,
|
mode: BuildMode::Release,
|
||||||
};
|
};
|
||||||
|
(globals, cmd_build, overwrite)
|
||||||
|
});
|
||||||
|
|
||||||
if let Err(err) = command_parser(globals, &cmd, false) {
|
let run = examples_iter(examples).map(|example| {
|
||||||
error!("{err}");
|
let cmd_qemu = CargoCommand::Qemu {
|
||||||
}
|
cargoarg,
|
||||||
|
example,
|
||||||
|
target,
|
||||||
|
features: features.clone(),
|
||||||
|
mode: BuildMode::Release,
|
||||||
|
};
|
||||||
|
(globals, cmd_qemu, overwrite)
|
||||||
|
});
|
||||||
|
|
||||||
let cmd = CargoCommand::Qemu {
|
build.chain(run).run_and_coalesce()
|
||||||
cargoarg,
|
|
||||||
example,
|
|
||||||
target,
|
|
||||||
features: features.clone(),
|
|
||||||
mode: BuildMode::Release,
|
|
||||||
};
|
|
||||||
|
|
||||||
(globals, cmd, overwrite)
|
|
||||||
})
|
|
||||||
.run_and_coalesce()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Check the binary sizes of examples
|
/// Check the binary sizes of examples
|
||||||
|
|
|
@ -593,6 +593,11 @@ impl<'a> CargoCommand<'a> {
|
||||||
if let Some(cargoarg) = cargoarg {
|
if let Some(cargoarg) = cargoarg {
|
||||||
args.extend_from_slice(&[cargoarg]);
|
args.extend_from_slice(&[cargoarg]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// We need to be in the `rtic` directory to pick up
|
||||||
|
// the correct .cargo/config.toml file
|
||||||
|
args.extend_from_slice(&["-Z", "unstable-options", "-C", "rtic"]);
|
||||||
|
|
||||||
args.extend_from_slice(&[
|
args.extend_from_slice(&[
|
||||||
self.command(),
|
self.command(),
|
||||||
"--example",
|
"--example",
|
||||||
|
@ -856,7 +861,7 @@ pub fn handle_results(globals: &Globals, results: Vec<FinalRunResult>) -> Result
|
||||||
if globals.verbose > 0 {
|
if globals.verbose > 0 {
|
||||||
info!("✅ Success: {cmd}{path}\n {}", cmd.as_cmd_string());
|
info!("✅ Success: {cmd}{path}\n {}", cmd.as_cmd_string());
|
||||||
} else {
|
} else {
|
||||||
info!("✅ Success:{cmd}{path}");
|
info!("✅ Success: {cmd}{path}");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -268,7 +268,7 @@ fn main() -> anyhow::Result<()> {
|
||||||
Commands::Qemu(args) | Commands::Run(args) => {
|
Commands::Qemu(args) | Commands::Run(args) => {
|
||||||
// x86_64 target not valid
|
// x86_64 target not valid
|
||||||
info!("Testing for backend: {backend:?}");
|
info!("Testing for backend: {backend:?}");
|
||||||
run_test(
|
qemu_run_examples(
|
||||||
globals,
|
globals,
|
||||||
&cargologlevel,
|
&cargologlevel,
|
||||||
backend,
|
backend,
|
||||||
|
|
Loading…
Reference in a new issue