Skip to content

libtest: expose --fail-fast as an unstable command-line option #142807

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion library/test/src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ fn optgroups() -> getopts::Options {
.optflag("", "test", "Run tests and not benchmarks")
.optflag("", "bench", "Run benchmarks instead of tests")
.optflag("", "list", "List all tests and benchmarks")
.optflag("", "fail-fast", "Don't start new tests after the first failure")
.optflag("h", "help", "Display this message")
.optopt("", "logfile", "Write logs to the specified file (deprecated)", "PATH")
.optflag(
Expand Down Expand Up @@ -261,6 +262,7 @@ fn parse_opts_impl(matches: getopts::Matches) -> OptRes {
// 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 fail_fast = unstable_optflag!(matches, allow_unstable, "fail-fast");
let time_options = get_time_options(&matches, allow_unstable)?;
let shuffle = get_shuffle(&matches, allow_unstable)?;
let shuffle_seed = get_shuffle_seed(&matches, allow_unstable)?;
Expand Down Expand Up @@ -307,7 +309,7 @@ fn parse_opts_impl(matches: getopts::Matches) -> OptRes {
skip,
time_options,
options,
fail_fast: false,
fail_fast,
};

Ok(test_opts)
Expand Down
12 changes: 12 additions & 0 deletions src/doc/rustc/src/tests/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,18 @@ unstable-options` flag. See [tracking issue

The following options affect how tests are executed.

#### `--fail-fast`

Stops tests after the first failure.

If running tests in parallel (which is the default), then tests that have already been started on
other threads will be allowed to run to completion before the process exits.

Note that when running tests in parallel, the test execution order is non-deterministic:
if multiple tests would fail, the first failure encountered will be reported.

⚠️ 🚧 This requires the `-Z unstable-options` flag.

#### `--test-threads` _NUM_THREADS_

Sets the number of threads to use for running tests in parallel. By default,
Expand Down
Loading