aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar datdenkikniet <jcdra1@gmail.com> 2023-04-15 22:19:13 +0200
committerGravatar datdenkikniet <jcdra1@gmail.com> 2023-04-16 13:08:46 +0200
commit1c84ccf6e4169b4b45f0e22e709e4265a10324a5 (patch)
treed192d3915f52b9168de9c140dca3c459dc18e5fc
parentd838286de679a1ac35ea79999816418cd02b7259 (diff)
downloadrtic-1c84ccf6e4169b4b45f0e22e709e4265a10324a5.tar.gz
rtic-1c84ccf6e4169b4b45f0e22e709e4265a10324a5.tar.zst
rtic-1c84ccf6e4169b4b45f0e22e709e4265a10324a5.zip
Fix running of tests
-rw-r--r--xtask/src/cargo_commands.rs47
-rw-r--r--xtask/src/command.rs7
-rw-r--r--xtask/src/main.rs2
3 files changed, 30 insertions, 26 deletions
diff --git a/xtask/src/cargo_commands.rs b/xtask/src/cargo_commands.rs
index ead6eaa9..42895d81 100644
--- a/xtask/src/cargo_commands.rs
+++ b/xtask/src/cargo_commands.rs
@@ -302,7 +302,7 @@ pub fn cargo_book<'c>(
/// Run examples
///
/// Supports updating the expected output via the overwrite argument
-pub fn run_test<'c>(
+pub fn qemu_run_examples<'c>(
globals: &Globals,
cargoarg: &'c Option<&'c str>,
backend: Backends,
@@ -312,31 +312,30 @@ pub fn run_test<'c>(
let target = backend.to_target();
let features = Some(target.and_features(backend.to_rtic_feature()));
- examples_iter(examples)
- .map(|example| {
- let cmd = CargoCommand::ExampleBuild {
- cargoarg: &Some("--quiet"),
- example,
- target,
- features: features.clone(),
- mode: BuildMode::Release,
- };
-
- if let Err(err) = command_parser(globals, &cmd, false) {
- error!("{err}");
- }
+ let build = examples_iter(examples).map(|example| {
+ let cmd_build = CargoCommand::ExampleBuild {
+ // We need to be in the correct
+ cargoarg: &None,
+ example,
+ target,
+ features: features.clone(),
+ mode: BuildMode::Release,
+ };
+ (globals, cmd_build, overwrite)
+ });
- let cmd = CargoCommand::Qemu {
- cargoarg,
- example,
- target,
- features: features.clone(),
- mode: BuildMode::Release,
- };
+ let run = examples_iter(examples).map(|example| {
+ let cmd_qemu = CargoCommand::Qemu {
+ cargoarg,
+ example,
+ target,
+ features: features.clone(),
+ mode: BuildMode::Release,
+ };
+ (globals, cmd_qemu, overwrite)
+ });
- (globals, cmd, overwrite)
- })
- .run_and_coalesce()
+ build.chain(run).run_and_coalesce()
}
/// Check the binary sizes of examples
diff --git a/xtask/src/command.rs b/xtask/src/command.rs
index a45cb8ac..187a3ddc 100644
--- a/xtask/src/command.rs
+++ b/xtask/src/command.rs
@@ -593,6 +593,11 @@ impl<'a> CargoCommand<'a> {
if let Some(cargoarg) = 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(&[
self.command(),
"--example",
@@ -856,7 +861,7 @@ pub fn handle_results(globals: &Globals, results: Vec<FinalRunResult>) -> Result
if globals.verbose > 0 {
info!("✅ Success: {cmd}{path}\n {}", cmd.as_cmd_string());
} else {
- info!("✅ Success:{cmd}{path}");
+ info!("✅ Success: {cmd}{path}");
}
});
diff --git a/xtask/src/main.rs b/xtask/src/main.rs
index 7077d552..853dbe78 100644
--- a/xtask/src/main.rs
+++ b/xtask/src/main.rs
@@ -268,7 +268,7 @@ fn main() -> anyhow::Result<()> {
Commands::Qemu(args) | Commands::Run(args) => {
// x86_64 target not valid
info!("Testing for backend: {backend:?}");
- run_test(
+ qemu_run_examples(
globals,
&cargologlevel,
backend,