diff options
| author | Tyler Mandry <tmandry@gmail.com> | 2019-11-14 07:26:22 -0800 |
|---|---|---|
| committer | Tyler Mandry <tmandry@gmail.com> | 2019-11-15 05:52:06 -0800 |
| commit | b8dca6c82714d04a26071a48cd671ad707249950 (patch) | |
| tree | 2b5c0c789bb492e0491ff4f5a0b83cf82b4efd07 | |
| parent | d63b24ffcc48f44ef09e0369e6516d6f2dec3520 (diff) | |
| download | rust-b8dca6c82714d04a26071a48cd671ad707249950.tar.gz rust-b8dca6c82714d04a26071a48cd671ad707249950.zip | |
Add --force-run-in-process unstable libtest option
| -rw-r--r-- | src/libtest/cli.rs | 4 | ||||
| -rw-r--r-- | src/libtest/lib.rs | 2 | ||||
| -rw-r--r-- | src/libtest/tests.rs | 1 |
3 files changed, 6 insertions, 1 deletions
diff --git a/src/libtest/cli.rs b/src/libtest/cli.rs index a34426305be..c97cb0e0605 100644 --- a/src/libtest/cli.rs +++ b/src/libtest/cli.rs @@ -13,6 +13,7 @@ pub struct TestOpts { pub list: bool, pub filter: Option<String>, pub filter_exact: bool, + pub force_run_in_process: bool, pub exclude_should_panic: bool, pub run_ignored: RunIgnored, pub run_tests: bool, @@ -46,6 +47,7 @@ fn optgroups() -> getopts::Options { let mut opts = getopts::Options::new(); opts.optflag("", "include-ignored", "Run ignored and not ignored tests") .optflag("", "ignored", "Run only ignored tests") + .optflag("", "force-run-in-process", "Forces tests to run in-process when panic=abort") .optflag("", "exclude-should-panic", "Excludes tests marked as should_panic") .optflag("", "test", "Run tests and not benchmarks") .optflag("", "bench", "Run benchmarks instead of tests") @@ -233,6 +235,7 @@ fn parse_opts_impl(matches: getopts::Matches) -> OptRes { let allow_unstable = get_allow_unstable(&matches)?; // Unstable flags + let force_run_in_process = unstable_optflag!(matches, allow_unstable, "force-run-in-process"); let exclude_should_panic = unstable_optflag!(matches, allow_unstable, "exclude-should-panic"); let include_ignored = unstable_optflag!(matches, allow_unstable, "include-ignored"); let time_options = get_time_options(&matches, allow_unstable)?; @@ -259,6 +262,7 @@ fn parse_opts_impl(matches: getopts::Matches) -> OptRes { list, filter, filter_exact: exact, + force_run_in_process, exclude_should_panic, run_ignored, run_tests, diff --git a/src/libtest/lib.rs b/src/libtest/lib.rs index 341a2e18db5..7647978b3d9 100644 --- a/src/libtest/lib.rs +++ b/src/libtest/lib.rs @@ -254,7 +254,7 @@ where let mut pending = 0; let (tx, rx) = channel::<CompletedTest>(); - let run_strategy = if opts.options.panic_abort { + let run_strategy = if opts.options.panic_abort && !opts.force_run_in_process { RunStrategy::SpawnPrimary } else { RunStrategy::InProcess diff --git a/src/libtest/tests.rs b/src/libtest/tests.rs index e0e211444cf..5f55b647f5e 100644 --- a/src/libtest/tests.rs +++ b/src/libtest/tests.rs @@ -24,6 +24,7 @@ impl TestOpts { list: false, filter: None, filter_exact: false, + force_run_in_process: false, exclude_should_panic: false, run_ignored: RunIgnored::No, run_tests: false, |
