@@ -50,6 +50,12 @@ use crate::util::logv;
5050/// some code here that inspects environment variables or even runs executables
5151/// (e.g. when discovering debugger versions).
5252pub fn parse_config ( args : Vec < String > ) -> Config {
53+ if env:: var ( "RUST_TEST_NOCAPTURE" ) . is_ok ( ) {
54+ eprintln ! (
55+ "WARNING: RUST_TEST_NOCAPTURE is not supported. Use the `--no-capture` flag instead."
56+ ) ;
57+ }
58+
5359 let mut opts = Options :: new ( ) ;
5460 opts. reqopt ( "" , "compile-lib-path" , "path to host shared libraries" , "PATH" )
5561 . reqopt ( "" , "run-lib-path" , "path to target shared libraries" , "PATH" )
@@ -128,6 +134,7 @@ pub fn parse_config(args: Vec<String>) -> Config {
128134 "bless" ,
129135 "overwrite stderr/stdout files instead of complaining about a mismatch" ,
130136 )
137+ . optflag ( "" , "fail-fast" , "stop as soon as possible after any test fails" )
131138 . optflag ( "" , "quiet" , "print one character per test instead of one line" )
132139 . optopt ( "" , "color" , "coloring: auto, always, never" , "WHEN" )
133140 . optflag ( "" , "json" , "emit json output instead of plaintext output" )
@@ -319,6 +326,9 @@ pub fn parse_config(args: Vec<String>) -> Config {
319326
320327 Config {
321328 bless : matches. opt_present ( "bless" ) ,
329+ fail_fast : matches. opt_present ( "fail-fast" )
330+ || env:: var_os ( "RUSTC_TEST_FAIL_FAST" ) . is_some ( ) ,
331+
322332 compile_lib_path : make_absolute ( opt_path ( matches, "compile-lib-path" ) ) ,
323333 run_lib_path : make_absolute ( opt_path ( matches, "run-lib-path" ) ) ,
324334 rustc_path : opt_path ( matches, "rustc-path" ) ,
@@ -603,13 +613,6 @@ pub fn run_tests(config: Arc<Config>) {
603613}
604614
605615pub fn test_opts ( config : & Config ) -> test:: TestOpts {
606- if env:: var ( "RUST_TEST_NOCAPTURE" ) . is_ok ( ) {
607- eprintln ! (
608- "WARNING: RUST_TEST_NOCAPTURE is no longer used. \
609- Use the `--nocapture` flag instead."
610- ) ;
611- }
612-
613616 test:: TestOpts {
614617 exclude_should_panic : false ,
615618 filters : config. filters . clone ( ) ,
@@ -629,7 +632,7 @@ pub fn test_opts(config: &Config) -> test::TestOpts {
629632 options : test:: Options :: new ( ) ,
630633 time_options : None ,
631634 force_run_in_process : false ,
632- fail_fast : std :: env :: var_os ( "RUSTC_TEST_FAIL_FAST" ) . is_some ( ) ,
635+ fail_fast : config . fail_fast ,
633636 }
634637}
635638
0 commit comments