Skip to content

Commit bf405e3

Browse files
committed
We don't need u64 for the test timeout
A timeout greater than 2^32 seconds (~136 years) does not make much sense, so we can use u32 instead of u64.
1 parent 6b53e04 commit bf405e3

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

src/config.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ pub struct Config {
77
pub manifest_path: PathBuf,
88
pub default_target: Option<String>,
99
pub run_command: Vec<String>,
10-
pub test_timeout: u64,
10+
pub test_timeout: u32,
1111
}
1212

1313
pub(crate) fn read_config(manifest_path: PathBuf) -> Result<Config, ErrorString> {
@@ -58,7 +58,7 @@ pub(crate) fn read_config_inner(manifest_path: PathBuf) -> Result<Config, ErrorS
5858
Err(format!("test-timeout must not be negative"))?
5959
}
6060
("test-timeout", Value::Integer(timeout)) => {
61-
config.test_timeout = Some(timeout as u64);
61+
config.test_timeout = Some(timeout as u32);
6262
}
6363
("run-command", Value::Array(array)) => {
6464
let mut command = Vec::new();
@@ -85,7 +85,7 @@ struct ConfigBuilder {
8585
manifest_path: Option<PathBuf>,
8686
default_target: Option<String>,
8787
run_command: Option<Vec<String>>,
88-
test_timeout: Option<u64>,
88+
test_timeout: Option<u32>,
8989
}
9090

9191
impl Into<Config> for ConfigBuilder {

src/subcommand/test.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ pub(crate) fn test(mut args: Args) -> Result<(), ErrorString> {
5050
let mut child = command
5151
.spawn()
5252
.map_err(|e| format!("Failed to launch QEMU: {:?}\n{}", command, e))?;
53-
let timeout = Duration::from_secs(config.test_timeout);
53+
let timeout = Duration::from_secs(config.test_timeout.into());
5454
match child
5555
.wait_timeout(timeout)
5656
.map_err(|e| format!("Failed to wait with timeout: {}", e))?

src/subcommand/tester.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ path = "{test_path}"
157157
let mut child = command
158158
.spawn()
159159
.map_err(|e| format!("Failed to launch QEMU: {:?}\n{}", command, e))?;
160-
let timeout = Duration::from_secs(config.test_timeout);
160+
let timeout = Duration::from_secs(config.test_timeout.into());
161161
let (exit_status, output) = match child
162162
.wait_timeout(timeout)
163163
.map_err(|e| format!("Failed to wait with timeout: {}", e))?

0 commit comments

Comments
 (0)