Skip to content

Commit a82ccff

Browse files
committed
add no-reboot
1 parent 1c3750d commit a82ccff

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

src/config.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,10 @@ pub struct Config {
3333
/// An exit code that should be considered as success for test executables (applies to
3434
/// `bootimage runner`)
3535
pub test_success_exit_code: Option<i32>,
36+
/// Whether the `--no-reboot` flag should be passed to test executables
37+
///
38+
/// Defaults to `true`
39+
pub test_no_reboot: bool,
3640
}
3741

3842
/// Reads the configuration from a `package.metadata.bootimage` in the given Cargo.toml.
@@ -91,6 +95,9 @@ fn read_config_inner(manifest_path: &Path) -> Result<Config> {
9195
("test-args", Value::Array(array)) => {
9296
config.test_args = Some(parse_string_array(array, "test-args")?);
9397
}
98+
("test-no-reboot", Value::Boolean(no_reboot)) => {
99+
config.test_no_reboot = Some(no_reboot);
100+
}
94101
(key, value) => {
95102
return Err(anyhow!(
96103
"unexpected `package.metadata.bootimage` \
@@ -123,6 +130,7 @@ struct ConfigBuilder {
123130
test_args: Option<Vec<String>>,
124131
test_timeout: Option<u32>,
125132
test_success_exit_code: Option<i32>,
133+
test_no_reboot: Option<bool>,
126134
}
127135

128136
impl Into<Config> for ConfigBuilder {
@@ -140,6 +148,7 @@ impl Into<Config> for ConfigBuilder {
140148
test_args: self.test_args,
141149
test_timeout: self.test_timeout.unwrap_or(60 * 5),
142150
test_success_exit_code: self.test_success_exit_code,
151+
test_no_reboot: self.test_no_reboot.unwrap_or(true),
143152
}
144153
}
145154
}

src/run.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,9 @@ pub fn run(
2323
.map(|arg| arg.replace("{}", &format!("{}", image_path.display())))
2424
.collect();
2525
if is_test {
26+
if config.test_no_reboot {
27+
run_command.push("--no-reboot".to_owned());
28+
}
2629
if let Some(args) = config.test_args {
2730
run_command.extend(args);
2831
}

0 commit comments

Comments
 (0)