Skip to content

Commit a7fffd2

Browse files
committed
Add --force-run-in-process unstable libtest option
1 parent d63b24f commit a7fffd2

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

src/libtest/cli.rs

+4
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ pub struct TestOpts {
1313
pub list: bool,
1414
pub filter: Option<String>,
1515
pub filter_exact: bool,
16+
pub force_run_in_process: bool,
1617
pub exclude_should_panic: bool,
1718
pub run_ignored: RunIgnored,
1819
pub run_tests: bool,
@@ -46,6 +47,7 @@ fn optgroups() -> getopts::Options {
4647
let mut opts = getopts::Options::new();
4748
opts.optflag("", "include-ignored", "Run ignored and not ignored tests")
4849
.optflag("", "ignored", "Run only ignored tests")
50+
.optflag("", "force-run-in-process", "Forces tests to run in-process when panic=abort")
4951
.optflag("", "exclude-should-panic", "Excludes tests marked as should_panic")
5052
.optflag("", "test", "Run tests and not benchmarks")
5153
.optflag("", "bench", "Run benchmarks instead of tests")
@@ -233,6 +235,7 @@ fn parse_opts_impl(matches: getopts::Matches) -> OptRes {
233235
let allow_unstable = get_allow_unstable(&matches)?;
234236

235237
// Unstable flags
238+
let force_run_in_process = unstable_optflag!(matches, allow_unstable, "force-run-in-process");
236239
let exclude_should_panic = unstable_optflag!(matches, allow_unstable, "exclude-should-panic");
237240
let include_ignored = unstable_optflag!(matches, allow_unstable, "include-ignored");
238241
let time_options = get_time_options(&matches, allow_unstable)?;
@@ -259,6 +262,7 @@ fn parse_opts_impl(matches: getopts::Matches) -> OptRes {
259262
list,
260263
filter,
261264
filter_exact: exact,
265+
force_run_in_process,
262266
exclude_should_panic,
263267
run_ignored,
264268
run_tests,

src/libtest/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -254,7 +254,7 @@ where
254254
let mut pending = 0;
255255

256256
let (tx, rx) = channel::<CompletedTest>();
257-
let run_strategy = if opts.options.panic_abort {
257+
let run_strategy = if opts.options.panic_abort && !opts.force_run_in_process {
258258
RunStrategy::SpawnPrimary
259259
} else {
260260
RunStrategy::InProcess

0 commit comments

Comments
 (0)