5
5
#![ warn( rust_2018_idioms, unused_lifetimes) ]
6
6
#![ allow( unused_extern_crates) ]
7
7
8
- use compiletest:: { status_emitter, CommandBuilder } ;
8
+ use compiletest:: { status_emitter, CommandBuilder , OutputConflictHandling } ;
9
9
use ui_test as compiletest;
10
10
use ui_test:: Mode as TestMode ;
11
11
@@ -116,9 +116,9 @@ fn base_config(test_dir: &str) -> compiletest::Config {
116
116
stderr_filters : vec ! [ ] ,
117
117
stdout_filters : vec ! [ ] ,
118
118
output_conflict_handling : if var_os ( "BLESS" ) . is_some ( ) || env:: args ( ) . any ( |arg| arg == "--bless" ) {
119
- compiletest :: OutputConflictHandling :: Bless
119
+ OutputConflictHandling :: Bless
120
120
} else {
121
- compiletest :: OutputConflictHandling :: Error ( "cargo test -- -- --bless " . into ( ) )
121
+ OutputConflictHandling :: Error ( "cargo uibless " . into ( ) )
122
122
} ,
123
123
target : None ,
124
124
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() {
187
187
. to_string ( )
188
188
} ) ,
189
189
) ;
190
- eprintln ! ( " Compiler: {}" , config. program. display( ) ) ;
191
-
192
- let name = config. root_dir . display ( ) . to_string ( ) ;
193
190
194
191
let test_filter = test_filter ( ) ;
195
192
196
193
compiletest:: run_tests_generic (
197
194
config,
198
195
move |path| compiletest:: default_file_filter ( path) && test_filter ( path) ,
199
196
compiletest:: default_per_file_config,
200
- ( status_emitter:: Text , status_emitter :: Gha :: < true > { name } ) ,
197
+ status_emitter:: Text ,
201
198
)
202
199
. unwrap ( ) ;
203
200
check_rustfix_coverage ( ) ;
@@ -208,8 +205,19 @@ fn run_internal_tests() {
208
205
if !RUN_INTERNAL_TESTS {
209
206
return ;
210
207
}
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 ( ) ;
213
221
}
214
222
215
223
fn run_ui_toml ( ) {
@@ -228,13 +236,11 @@ fn run_ui_toml() {
228
236
"$$DIR" ,
229
237
) ;
230
238
231
- let name = config. root_dir . display ( ) . to_string ( ) ;
232
-
233
239
let test_filter = test_filter ( ) ;
234
240
235
241
ui_test:: run_tests_generic (
236
242
config,
237
- |path| test_filter ( path) && path . extension ( ) == Some ( "rs" . as_ref ( ) ) ,
243
+ |path| compiletest :: default_file_filter ( path) && test_filter ( path ) ,
238
244
|config, path| {
239
245
let mut config = config. clone ( ) ;
240
246
config
@@ -243,7 +249,7 @@ fn run_ui_toml() {
243
249
. push ( ( "CLIPPY_CONF_DIR" . into ( ) , Some ( path. parent ( ) . unwrap ( ) . into ( ) ) ) ) ;
244
250
Some ( config)
245
251
} ,
246
- ( status_emitter:: Text , status_emitter :: Gha :: < true > { name } ) ,
252
+ status_emitter:: Text ,
247
253
)
248
254
. unwrap ( ) ;
249
255
}
@@ -284,8 +290,6 @@ fn run_ui_cargo() {
284
290
"$$DIR" ,
285
291
) ;
286
292
287
- let name = config. root_dir . display ( ) . to_string ( ) ;
288
-
289
293
let test_filter = test_filter ( ) ;
290
294
291
295
ui_test:: run_tests_generic (
@@ -296,7 +300,7 @@ fn run_ui_cargo() {
296
300
config. out_dir = PathBuf :: from ( "target/ui_test_cargo/" ) . join ( path. parent ( ) . unwrap ( ) ) ;
297
301
Some ( config)
298
302
} ,
299
- ( status_emitter:: Text , status_emitter :: Gha :: < true > { name } ) ,
303
+ status_emitter:: Text ,
300
304
)
301
305
. unwrap ( ) ;
302
306
}
0 commit comments