@@ -3,7 +3,6 @@ use regex::bytes::Regex;
33use std:: ffi:: OsString ;
44use std:: path:: { Path , PathBuf } ;
55use std:: { env, process:: Command } ;
6- use ui_test:: status_emitter:: StatusEmitter ;
76use ui_test:: CommandBuilder ;
87use ui_test:: { color_eyre:: Result , Config , Match , Mode , OutputConflictHandling } ;
98
@@ -76,7 +75,7 @@ fn test_config(target: &str, path: &str, mode: Mode, with_dependencies: bool) ->
7675 let skip_ui_checks = env:: var_os ( "MIRI_SKIP_UI_CHECKS" ) . is_some ( ) ;
7776
7877 let output_conflict_handling = match ( env:: var_os ( "MIRI_BLESS" ) . is_some ( ) , skip_ui_checks) {
79- ( false , false ) => OutputConflictHandling :: Error ,
78+ ( false , false ) => OutputConflictHandling :: Error ( "./miri bless" . into ( ) ) ,
8079 ( true , false ) => OutputConflictHandling :: Bless ,
8180 ( false , true ) => OutputConflictHandling :: Ignore ,
8281 ( true , true ) => panic ! ( "cannot use MIRI_BLESS and MIRI_SKIP_UI_CHECKS at the same time" ) ,
@@ -86,13 +85,11 @@ fn test_config(target: &str, path: &str, mode: Mode, with_dependencies: bool) ->
8685 target : Some ( target. to_owned ( ) ) ,
8786 stderr_filters : STDERR . clone ( ) ,
8887 stdout_filters : STDOUT . clone ( ) ,
89- root_dir : PathBuf :: from ( path) ,
9088 mode,
9189 program,
9290 output_conflict_handling,
93- quiet : false ,
9491 edition : Some ( "2021" . into ( ) ) ,
95- ..Config :: default ( )
92+ ..Config :: rustc ( path . into ( ) )
9693 } ;
9794
9895 let use_std = env:: var_os ( "MIRI_NO_STD" ) . is_none ( ) ;
@@ -113,39 +110,48 @@ fn test_config(target: &str, path: &str, mode: Mode, with_dependencies: bool) ->
113110}
114111
115112fn run_tests ( mode : Mode , path : & str , target : & str , with_dependencies : bool ) -> Result < ( ) > {
116- let mut config = test_config ( target, path, mode, with_dependencies) ;
113+ let config = test_config ( target, path, mode, with_dependencies) ;
117114
118115 // Handle command-line arguments.
119116 let mut after_dashdash = false ;
120- config. path_filter . extend ( std:: env:: args ( ) . skip ( 1 ) . filter ( |arg| {
121- if after_dashdash {
122- // Just propagate everything.
123- return true ;
124- }
125- match & * * arg {
126- "--quiet" => {
127- config. quiet = true ;
128- false
129- }
130- "--" => {
131- after_dashdash = true ;
132- false
117+ let mut quiet = false ;
118+ let filters = std:: env:: args ( )
119+ . skip ( 1 )
120+ . filter ( |arg| {
121+ if after_dashdash {
122+ // Just propagate everything.
123+ return true ;
133124 }
134- s if s. starts_with ( '-' ) => {
135- panic ! ( "unknown compiletest flag `{s}`" ) ;
125+ match & * * arg {
126+ "--quiet" => {
127+ quiet = true ;
128+ false
129+ }
130+ "--" => {
131+ after_dashdash = true ;
132+ false
133+ }
134+ s if s. starts_with ( '-' ) => {
135+ panic ! ( "unknown compiletest flag `{s}`" ) ;
136+ }
137+ _ => true ,
136138 }
137- _ => true ,
138- }
139- } ) ) ;
140-
139+ } )
140+ . collect :: < Vec < _ > > ( ) ;
141141 eprintln ! ( " Compiler: {}" , config. program. display( ) ) ;
142142 ui_test:: run_tests_generic (
143143 config,
144144 // The files we're actually interested in (all `.rs` files).
145- |path| path. extension ( ) . is_some_and ( |ext| ext == "rs" ) ,
145+ |path| {
146+ path. extension ( ) . is_some_and ( |ext| ext == "rs" )
147+ && ( filters. is_empty ( ) || filters. iter ( ) . any ( |f| path. starts_with ( f) ) )
148+ } ,
146149 // This could be used to overwrite the `Config` on a per-test basis.
147150 |_, _| None ,
148- TextAndGha ,
151+ (
152+ ui_test:: status_emitter:: Text ,
153+ ui_test:: status_emitter:: Gha :: < false > { name : format ! ( "{mode:?} {path} ({target})" ) } ,
154+ ) ,
149155 )
150156}
151157
@@ -270,45 +276,3 @@ fn run_dep_mode(target: String, mut args: impl Iterator<Item = OsString>) -> Res
270276 cmd. args ( args) ;
271277 if cmd. spawn ( ) ?. wait ( ) ?. success ( ) { Ok ( ( ) ) } else { std:: process:: exit ( 1 ) }
272278}
273-
274- /// This is a custom renderer for `ui_test` output that does not emit github actions
275- /// `group`s, while still producing regular github actions messages on test failures.
276- struct TextAndGha ;
277- impl StatusEmitter for TextAndGha {
278- fn failed_test < ' a > (
279- & ' a self ,
280- revision : & ' a str ,
281- path : & ' a Path ,
282- cmd : & ' a Command ,
283- stderr : & ' a [ u8 ] ,
284- ) -> Box < dyn std:: fmt:: Debug + ' a > {
285- Box :: new ( (
286- ui_test:: status_emitter:: Gha :: < false > . failed_test ( revision, path, cmd, stderr) ,
287- ui_test:: status_emitter:: Text . failed_test ( revision, path, cmd, stderr) ,
288- ) )
289- }
290-
291- fn run_tests ( & self , _config : & Config ) -> Box < dyn ui_test:: status_emitter:: DuringTestRun > {
292- Box :: new ( TextAndGha )
293- }
294-
295- fn finalize (
296- & self ,
297- failures : usize ,
298- succeeded : usize ,
299- ignored : usize ,
300- filtered : usize ,
301- ) -> Box < dyn ui_test:: status_emitter:: Summary > {
302- Box :: new ( (
303- ui_test:: status_emitter:: Gha :: < false > . finalize ( failures, succeeded, ignored, filtered) ,
304- ui_test:: status_emitter:: Text . finalize ( failures, succeeded, ignored, filtered) ,
305- ) )
306- }
307- }
308-
309- impl ui_test:: status_emitter:: DuringTestRun for TextAndGha {
310- fn test_result ( & mut self , path : & Path , revision : & str , result : & ui_test:: TestResult ) {
311- ui_test:: status_emitter:: Text . test_result ( path, revision, result) ;
312- ui_test:: status_emitter:: Gha :: < false > . test_result ( path, revision, result) ;
313- }
314- }
0 commit comments