@@ -114,36 +114,26 @@ fn canonicalize(path: impl AsRef<Path>) -> PathBuf {
114114}
115115
116116fn base_config ( test_dir : & str ) -> ( Config , Args ) {
117- let bless = var_os ( "RUSTC_BLESS" ) . is_some_and ( |v| v != "0" ) || env:: args ( ) . any ( |arg| arg == "--bless" ) ;
118-
119- let args = Args {
120- filters : env:: var ( "TESTNAME" )
121- . map ( |filters| filters. split ( ',' ) . map ( str:: to_string) . collect ( ) )
122- . unwrap_or_default ( ) ,
123- quiet : false ,
124- check : !bless,
125- threads : match std:: env:: var_os ( "RUST_TEST_THREADS" ) {
126- Some ( n) => n. to_str ( ) . unwrap ( ) . parse ( ) . unwrap ( ) ,
127- None => std:: thread:: available_parallelism ( ) . unwrap ( ) ,
128- } ,
129- skip : Vec :: new ( ) ,
130- } ;
117+ let mut args = Args :: test ( ) . unwrap ( ) ;
118+ args. bless |= var_os ( "RUSTC_BLESS" ) . is_some_and ( |v| v != "0" ) ;
131119
132120 let mut config = Config {
133121 mode : Mode :: Yolo {
134122 rustfix : ui_test:: RustfixMode :: Everything ,
135123 } ,
136124 stderr_filters : vec ! [ ( Match :: PathBackslash , b"/" ) ] ,
137125 stdout_filters : vec ! [ ] ,
138- output_conflict_handling : if bless {
139- OutputConflictHandling :: Bless
140- } else {
141- OutputConflictHandling :: Error ( "cargo uibless" . into ( ) )
142- } ,
126+ filter_files : env:: var ( "TESTNAME" )
127+ . map ( |filters| filters. split ( ',' ) . map ( str:: to_string) . collect ( ) )
128+ . unwrap_or_default ( ) ,
143129 target : None ,
144130 out_dir : canonicalize ( var_os ( "CARGO_TARGET_DIR" ) . unwrap_or_else ( || "target" . into ( ) ) ) . join ( "ui_test" ) ,
145131 ..Config :: rustc ( Path :: new ( "tests" ) . join ( test_dir) )
146132 } ;
133+ config. with_args ( & args, /* bless by default */ false ) ;
134+ if let OutputConflictHandling :: Error ( err) = & mut config. output_conflict_handling {
135+ * err = "cargo uibless" . into ( ) ;
136+ }
147137 let current_exe_path = env:: current_exe ( ) . unwrap ( ) ;
148138 let deps_path = current_exe_path. parent ( ) . unwrap ( ) ;
149139 let profile_path = deps_path. parent ( ) . unwrap ( ) ;
@@ -186,7 +176,6 @@ fn run_ui() {
186176
187177 ui_test:: run_tests_generic (
188178 vec ! [ config] ,
189- args,
190179 ui_test:: default_file_filter,
191180 ui_test:: default_per_file_config,
192181 if quiet {
@@ -211,7 +200,6 @@ fn run_internal_tests() {
211200
212201 ui_test:: run_tests_generic (
213202 vec ! [ config] ,
214- args,
215203 ui_test:: default_file_filter,
216204 ui_test:: default_per_file_config,
217205 if quiet {
@@ -245,7 +233,6 @@ fn run_ui_toml() {
245233
246234 ui_test:: run_tests_generic (
247235 vec ! [ config] ,
248- args,
249236 ui_test:: default_file_filter,
250237 |config, path, _file_contents| {
251238 config
@@ -304,8 +291,7 @@ fn run_ui_cargo() {
304291
305292 ui_test:: run_tests_generic (
306293 vec ! [ config] ,
307- args,
308- |path, args, _config| path. ends_with ( "Cargo.toml" ) && ui_test:: default_filter_by_arg ( path, args) ,
294+ |path, config| path. ends_with ( "Cargo.toml" ) && ui_test:: default_any_file_filter ( path, config) ,
309295 |config, path, _file_contents| {
310296 config. out_dir = canonicalize (
311297 std:: env:: current_dir ( )
0 commit comments