Skip to content

Commit 1597443

Browse files
authored
Add new host-test xtask subcommand (#4085)
* Add new `host-test` xtask subcommand + smaller consistency and fmt fixes * reviews * reviews
1 parent 36634a4 commit 1597443

File tree

15 files changed

+156
-33
lines changed

15 files changed

+156
-33
lines changed

.github/workflows/ci.yml

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -188,16 +188,5 @@ jobs:
188188
# Check metadata generation for all packages:
189189
- run: cargo xtask update-metadata --check
190190

191-
# Run tests in esp-config
192-
- run: cd esp-config && cargo test --features build,tui
193-
194-
# Run tests in esp-bootloader-esp-idf
195-
- run: cd esp-bootloader-esp-idf && cargo test --features=std
196-
197-
# Run tests in esp-storage
198-
- run: cd esp-storage && cargo test --features=emulation -- --test-threads=1
199-
- run: cd esp-storage && cargo test --features=emulation,bytewise-read -- --test-threads=1
200-
201-
# Miri tests in esp-storage
202-
- run: cd esp-storage && cargo +nightly miri test --features=emulation -- --test-threads=1
203-
- run: cd esp-storage && cargo +nightly miri test --features=emulation,bytewise-read -- --test-threads=1
191+
# Run host tests for all applicable packages:
192+
- run: cargo xtask host-tests

esp-config/src/generate/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -572,7 +572,7 @@ fn screaming_snake_case(name: &str) -> String {
572572
}
573573

574574
#[cfg(test)]
575-
mod test {
575+
mod tests {
576576
use super::*;
577577
use crate::generate::{validator::Validator, value::Value};
578578

esp-config/src/generate/value.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ impl From<String> for Value {
185185
}
186186

187187
#[cfg(test)]
188-
mod test {
188+
mod tests {
189189
use super::*;
190190

191191
#[test]

esp-config/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ macro_rules! esp_config_int_parse {
6969
}
7070

7171
#[cfg(test)]
72-
mod test {
72+
mod tests {
7373
// We can only test success in the const context
7474
const _: () = {
7575
core::assert!(esp_config_int_parse!(i64, "-77777") == -77777);

esp-storage/src/nor_flash.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,7 @@ impl MultiwriteNorFlash for FlashStorage {}
189189

190190
// Run the tests with `--test-threads=1` - the emulation is not multithread safe
191191
#[cfg(test)]
192-
mod test {
192+
mod tests {
193193
use super::*;
194194

195195
const WORD_SIZE: u32 = 4;

xtask/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ Commands:
1818
semver-check Semver Checks
1919
check-changelog Check the changelog for packages
2020
update-chip-support-table Re-generate the chip support table in the esp-hal README
21+
host-tests Run host tests for all the packages where they are present
2122
help Print this message or the help of the given subcommand(s)
2223
2324
Options:

xtask/src/cargo.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ fn get_cargo() -> String {
107107
cargo
108108
}
109109

110-
#[derive(Debug, Default)]
110+
#[derive(Clone, Debug, Default)]
111111
pub struct CargoArgsBuilder {
112112
toolchain: Option<String>,
113113
subcommand: String,

xtask/src/changelog.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -342,7 +342,7 @@ fn parse_tag_link(line: &str) -> Result<(&str, &str)> {
342342
}
343343

344344
#[cfg(test)]
345-
mod test {
345+
mod tests {
346346
use super::*;
347347

348348
#[test]

xtask/src/commands/release/bump_version.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -345,7 +345,7 @@ fn finalize_placeholders(
345345
}
346346

347347
#[cfg(test)]
348-
mod test {
348+
mod tests {
349349
use toml_edit::DocumentMut;
350350

351351
use super::*;

xtask/src/commands/release/execute_plan.rs

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -102,10 +102,20 @@ pub fn execute_plan(workspace: &Path, args: ApplyPlanArgs) -> Result<()> {
102102
);
103103
}
104104

105-
let branch = make_git_changes(!args.no_dry_run, "release-branch", "Finalize crate releases")?;
106-
107-
open_pull_request(&branch, !args.no_dry_run, args.manual_pull_request, &plan_source, &plan)
108-
.with_context(|| "Failed to open pull request")?;
105+
let branch = make_git_changes(
106+
!args.no_dry_run,
107+
"release-branch",
108+
"Finalize crate releases",
109+
)?;
110+
111+
open_pull_request(
112+
&branch,
113+
!args.no_dry_run,
114+
args.manual_pull_request,
115+
&plan_source,
116+
&plan,
117+
)
118+
.with_context(|| "Failed to open pull request")?;
109119

110120
if !args.no_dry_run {
111121
println!(
@@ -151,7 +161,11 @@ pub(crate) fn make_git_changes(dry_run: bool, branch_name: &str, commit: &str) -
151161
if dry_run {
152162
println!("Dry run: would commit changes to branch: {branch_name}");
153163
} else {
154-
Command::new("git").arg("add").arg(".").status().context("Failed to stage changes")?;
164+
Command::new("git")
165+
.arg("add")
166+
.arg(".")
167+
.status()
168+
.context("Failed to stage changes")?;
155169
Command::new("git")
156170
.arg("commit")
157171
.arg("-m")
@@ -306,7 +320,7 @@ pub(crate) fn comparison_url(base: &str, url: &str, branch_name: &str) -> Result
306320
}
307321

308322
#[cfg(test)]
309-
mod test {
323+
mod tests {
310324
use super::*;
311325

312326
#[test]

0 commit comments

Comments
 (0)