about summary refs log tree commit diff
path: root/library
diff options
context:
space:
mode:
authorStuart Cook <Zalathar@users.noreply.github.com>2025-09-17 14:56:41 +1000
committerGitHub <noreply@github.com>2025-09-17 14:56:41 +1000
commit9d93fab3a105024a504fa8797f3431a8c176bad7 (patch)
tree022aa3f50767278e8112027f9df742998e8924bb /library
parent3f1552a273e43e15f6ed240d00e1efdd6a53e65e (diff)
parent547c72901ad145b40d7271e3ddef2b4ac0c53619 (diff)
downloadrust-9d93fab3a105024a504fa8797f3431a8c176bad7.tar.gz
rust-9d93fab3a105024a504fa8797f3431a8c176bad7.zip
Rollup merge of #142807 - sourcefrog:failfast, r=dtolnay
libtest: expose --fail-fast as an unstable command-line option

This exposes the `fail_fast` option added in rust-lang/rust#105153 on the test harness command line, so that workflows that only want to know if any test fails can find out without waiting for everything to run. For example, cargo-mutants just needs to know if any tests fails. It only works with `-Zunstable-options`.

Tracking issue: rust-lang/rust#142859
Diffstat (limited to 'library')
-rw-r--r--library/test/src/cli.rs4
1 files changed, 3 insertions, 1 deletions
diff --git a/library/test/src/cli.rs b/library/test/src/cli.rs
index 1b3f9e2564c..35291cc15c9 100644
--- a/library/test/src/cli.rs
+++ b/library/test/src/cli.rs
@@ -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(
@@ -260,6 +261,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)?;
@@ -306,7 +308,7 @@ fn parse_opts_impl(matches: getopts::Matches) -> OptRes {
         skip,
         time_options,
         options,
-        fail_fast: false,
+        fail_fast,
     };
 
     Ok(test_opts)