Skip to content

Commit 68223c5

Browse files
committed
reviews
1 parent ceff3a5 commit 68223c5

File tree

2 files changed

+12
-17
lines changed

2 files changed

+12
-17
lines changed

.github/workflows/hil.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,4 +119,4 @@ jobs:
119119
echo "$PWD/xtask_app" >> "$GITHUB_PATH"
120120
121121
- name: Run all tests
122-
run: xtask run-tests --chip ${{ matrix.board.mcu }} -t 60 --local-espflash=false
122+
run: xtask run-tests --chip ${{ matrix.board.mcu }} -t 60 --no-build

xtask/src/test_runner.rs

Lines changed: 11 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ use std::{
1212
time::{Duration, Instant},
1313
};
1414

15-
use clap::Args;
15+
use clap::{ArgAction, Args};
1616
use log::info;
1717

1818
use crate::Result;
@@ -39,8 +39,8 @@ pub struct RunTestsArgs {
3939
pub timeout: u64,
4040

4141
/// Whether to build espflash before running tests, true by default
42-
#[arg(long, value_parser = clap::value_parser!(bool))]
43-
pub local_espflash: Option<bool>,
42+
#[arg(long = "no-build", action = ArgAction::SetFalse, default_value_t = true)]
43+
pub build_espflash: bool,
4444
}
4545

4646
/// A struct to manage and run tests for the espflash
@@ -54,7 +54,7 @@ pub struct TestRunner {
5454
/// Optional chip target for tests
5555
pub chip: Option<String>,
5656
/// Build espflash before running tests
57-
pub local_espflash: Option<bool>,
57+
pub build_espflash: bool,
5858
}
5959

6060
impl TestRunner {
@@ -63,14 +63,14 @@ impl TestRunner {
6363
workspace: &Path,
6464
tests_dir: PathBuf,
6565
timeout_secs: u64,
66-
local_espflash: bool,
66+
build_espflash: bool,
6767
) -> Self {
6868
Self {
6969
workspace: workspace.to_path_buf(),
7070
tests_dir,
7171
timeout: Duration::from_secs(timeout_secs),
7272
chip: None,
73-
local_espflash: Some(local_espflash),
73+
build_espflash,
7474
}
7575
}
7676

@@ -223,12 +223,12 @@ impl TestRunner {
223223

224224
// we need to distinguish between local and CI runs, on CI we are building
225225
// espflash and then copying the binary, so we can use just `espflash`
226-
match self.local_espflash {
227-
None | Some(true) => {
226+
match self.build_espflash {
227+
true => {
228228
log::info!("Running cargo run...");
229229
cmd.args(["run", "-p", "espflash", "--release", "--quiet", "--"]);
230230
}
231-
Some(false) => {
231+
false => {
232232
log::info!("Using system espflash");
233233
let mut cmd = Command::new("espflash");
234234
cmd.args(args);
@@ -926,16 +926,11 @@ pub fn run_tests(workspace: &Path, args: RunTestsArgs) -> Result<()> {
926926
log::info!("Running espflash tests");
927927

928928
let tests_dir = workspace.join("espflash").join("tests");
929-
let test_runner = TestRunner::new(
930-
workspace,
931-
tests_dir,
932-
args.timeout,
933-
args.local_espflash.unwrap_or(true),
934-
);
929+
let test_runner = TestRunner::new(workspace, tests_dir, args.timeout, args.build_espflash);
935930

936931
// Build espflash before running test(s) so we are not "waisting" test's
937932
// duration or timeout
938-
if args.local_espflash.unwrap_or(true) {
933+
if args.build_espflash {
939934
test_runner.build_espflash();
940935
}
941936

0 commit comments

Comments
 (0)