55#![ warn( rust_2018_idioms, unused_lifetimes) ]
66#![ allow( unused_extern_crates) ]
77
8- use compiletest:: { status_emitter, CommandBuilder } ;
8+ use compiletest:: { status_emitter, CommandBuilder , OutputConflictHandling } ;
99use ui_test as compiletest;
1010use ui_test:: Mode as TestMode ;
1111
@@ -116,9 +116,9 @@ fn base_config(test_dir: &str) -> compiletest::Config {
116116 stderr_filters : vec ! [ ] ,
117117 stdout_filters : vec ! [ ] ,
118118 output_conflict_handling : if var_os ( "BLESS" ) . is_some ( ) || env:: args ( ) . any ( |arg| arg == "--bless" ) {
119- compiletest :: OutputConflictHandling :: Bless
119+ OutputConflictHandling :: Bless
120120 } else {
121- compiletest :: OutputConflictHandling :: Error ( "cargo test -- -- --bless " . into ( ) )
121+ OutputConflictHandling :: Error ( "cargo uibless " . into ( ) )
122122 } ,
123123 target : None ,
124124 out_dir : PathBuf :: from ( std:: env:: var_os ( "CARGO_TARGET_DIR" ) . unwrap_or ( "target" . into ( ) ) ) . join ( "ui_test" ) ,
@@ -187,17 +187,14 @@ fn run_ui() {
187187 . to_string ( )
188188 } ) ,
189189 ) ;
190- eprintln ! ( " Compiler: {}" , config. program. display( ) ) ;
191-
192- let name = config. root_dir . display ( ) . to_string ( ) ;
193190
194191 let test_filter = test_filter ( ) ;
195192
196193 compiletest:: run_tests_generic (
197194 config,
198195 move |path| compiletest:: default_file_filter ( path) && test_filter ( path) ,
199196 compiletest:: default_per_file_config,
200- ( status_emitter:: Text , status_emitter :: Gha :: < true > { name } ) ,
197+ status_emitter:: Text ,
201198 )
202199 . unwrap ( ) ;
203200 check_rustfix_coverage ( ) ;
@@ -208,8 +205,19 @@ fn run_internal_tests() {
208205 if !RUN_INTERNAL_TESTS {
209206 return ;
210207 }
211- let config = base_config ( "ui-internal" ) ;
212- compiletest:: run_tests ( config) . unwrap ( ) ;
208+ let mut config = base_config ( "ui-internal" ) ;
209+ if let OutputConflictHandling :: Error ( err) = & mut config. output_conflict_handling {
210+ * err = "cargo uitest --features internal -- -- --bless" . into ( ) ;
211+ }
212+ let test_filter = test_filter ( ) ;
213+
214+ compiletest:: run_tests_generic (
215+ config,
216+ move |path| compiletest:: default_file_filter ( path) && test_filter ( path) ,
217+ compiletest:: default_per_file_config,
218+ status_emitter:: Text ,
219+ )
220+ . unwrap ( ) ;
213221}
214222
215223fn run_ui_toml ( ) {
@@ -228,13 +236,11 @@ fn run_ui_toml() {
228236 "$$DIR" ,
229237 ) ;
230238
231- let name = config. root_dir . display ( ) . to_string ( ) ;
232-
233239 let test_filter = test_filter ( ) ;
234240
235241 ui_test:: run_tests_generic (
236242 config,
237- |path| test_filter ( path) && path . extension ( ) == Some ( "rs" . as_ref ( ) ) ,
243+ |path| compiletest :: default_file_filter ( path) && test_filter ( path ) ,
238244 |config, path| {
239245 let mut config = config. clone ( ) ;
240246 config
@@ -243,7 +249,7 @@ fn run_ui_toml() {
243249 . push ( ( "CLIPPY_CONF_DIR" . into ( ) , Some ( path. parent ( ) . unwrap ( ) . into ( ) ) ) ) ;
244250 Some ( config)
245251 } ,
246- ( status_emitter:: Text , status_emitter :: Gha :: < true > { name } ) ,
252+ status_emitter:: Text ,
247253 )
248254 . unwrap ( ) ;
249255}
@@ -284,8 +290,6 @@ fn run_ui_cargo() {
284290 "$$DIR" ,
285291 ) ;
286292
287- let name = config. root_dir . display ( ) . to_string ( ) ;
288-
289293 let test_filter = test_filter ( ) ;
290294
291295 ui_test:: run_tests_generic (
@@ -296,7 +300,7 @@ fn run_ui_cargo() {
296300 config. out_dir = PathBuf :: from ( "target/ui_test_cargo/" ) . join ( path. parent ( ) . unwrap ( ) ) ;
297301 Some ( config)
298302 } ,
299- ( status_emitter:: Text , status_emitter :: Gha :: < true > { name } ) ,
303+ status_emitter:: Text ,
300304 )
301305 . unwrap ( ) ;
302306}
0 commit comments