Skip to content

Commit

Permalink
feat: add 'timeout-multiplier' flag to config file
Browse files Browse the repository at this point in the history
  • Loading branch information
ASuciuX committed Feb 18, 2024
1 parent 75df41b commit 2767a1f
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion book/src/timeouts.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,6 @@ You can also set an explicit timeout with the `--timeout` option, also measured
in seconds. If this option is specified then the timeout is also applied to the
unmutated tests.

You can set a timeout multiplier that is relative to the duration of the unmutated tests with `--timeout-multiplier`. This option is only applied if the baseline is not skipped and no `--timeout` option is specified, otherwise it is ignored.
You can set a timeout multiplier that is relative to the duration of the unmutated tests with `--timeout-multiplier` or setting `timeout_multiplier` in `.cargo/mutants.toml` (`timeout-multiplier = 1.5`). This option is only applied if the baseline is not skipped and no `--timeout` option is specified, otherwise it is ignored.

The timeout does not apply to `cargo check` or `cargo build`, only `cargo test`.
2 changes: 2 additions & 0 deletions src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ pub struct Config {
pub minimum_test_timeout: Option<f64>,
/// Choice of test tool: cargo or nextest.
pub test_tool: Option<TestTool>,
/// Timeout multiplier, relative to the baseline 'cargo test'.
pub timeout_multiplier: Option<f64>,
}

impl Config {
Expand Down
2 changes: 1 addition & 1 deletion src/options.rs
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ impl Options {
show_times: !args.no_times,
show_all_logs: args.all_logs,
test_timeout: args.timeout.map(Duration::from_secs_f64),
test_timeout_multiplier: args.timeout_multiplier,
test_timeout_multiplier: config.timeout_multiplier.or(args.timeout_multiplier),
test_tool: args.test_tool.or(config.test_tool).unwrap_or_default(),
};
options.error_values.iter().for_each(|e| {
Expand Down

0 comments on commit 2767a1f

Please sign in to comment.