@@ -2,6 +2,8 @@ use colored::*;
2
2
use regex:: bytes:: Regex ;
3
3
use std:: path:: { Path , PathBuf } ;
4
4
use std:: { env, process:: Command } ;
5
+ use ui_test:: status_emitter:: StatusEmitter ;
6
+ use ui_test:: CommandBuilder ;
5
7
use ui_test:: { color_eyre:: Result , Config , Match , Mode , OutputConflictHandling } ;
6
8
7
9
fn miri_path ( ) -> PathBuf {
@@ -50,33 +52,35 @@ fn run_tests(mode: Mode, path: &str, target: &str, with_dependencies: bool) -> R
50
52
stdout_filters : STDOUT . clone ( ) ,
51
53
root_dir : PathBuf :: from ( path) ,
52
54
mode,
53
- program : miri_path ( ) ,
55
+ program : CommandBuilder :: rustc ( ) ,
54
56
quiet : false ,
55
57
edition : Some ( "2021" . into ( ) ) ,
56
58
..Config :: default ( )
57
59
} ;
58
60
61
+ config. program . program = miri_path ( ) ;
62
+
59
63
let in_rustc_test_suite = option_env ! ( "RUSTC_STAGE" ) . is_some ( ) ;
60
64
61
65
// Add some flags we always want.
62
66
if in_rustc_test_suite {
63
67
// Less aggressive warnings to make the rustc toolstate management less painful.
64
68
// (We often get warnings when e.g. a feature gets stabilized or some lint gets added/improved.)
65
- config. args . push ( "-Astable-features" . into ( ) ) ;
66
- config. args . push ( "-Aunused" . into ( ) ) ;
69
+ config. program . args . push ( "-Astable-features" . into ( ) ) ;
70
+ config. program . args . push ( "-Aunused" . into ( ) ) ;
67
71
} else {
68
- config. args . push ( "-Dwarnings" . into ( ) ) ;
69
- config. args . push ( "-Dunused" . into ( ) ) ;
72
+ config. program . args . push ( "-Dwarnings" . into ( ) ) ;
73
+ config. program . args . push ( "-Dunused" . into ( ) ) ;
70
74
}
71
75
if let Ok ( extra_flags) = env:: var ( "MIRIFLAGS" ) {
72
76
for flag in extra_flags. split_whitespace ( ) {
73
- config. args . push ( flag. into ( ) ) ;
77
+ config. program . args . push ( flag. into ( ) ) ;
74
78
}
75
79
}
76
- config. args . push ( "-Zui-testing" . into ( ) ) ;
80
+ config. program . args . push ( "-Zui-testing" . into ( ) ) ;
77
81
if let Some ( target) = & config. target {
78
- config. args . push ( "--target" . into ( ) ) ;
79
- config. args . push ( target. into ( ) ) ;
82
+ config. program . args . push ( "--target" . into ( ) ) ;
83
+ config. program . args . push ( target. into ( ) ) ;
80
84
}
81
85
82
86
// If we're on linux, and we're testing the extern-so functionality,
@@ -86,7 +90,7 @@ fn run_tests(mode: Mode, path: &str, target: &str, with_dependencies: bool) -> R
86
90
let so_file_path = build_so_for_c_ffi_tests ( ) ;
87
91
let mut flag = std:: ffi:: OsString :: from ( "-Zmiri-extern-so-file=" ) ;
88
92
flag. push ( so_file_path. into_os_string ( ) ) ;
89
- config. args . push ( flag) ;
93
+ config. program . args . push ( flag) ;
90
94
}
91
95
92
96
let skip_ui_checks = env:: var_os ( "MIRI_SKIP_UI_CHECKS" ) . is_some ( ) ;
@@ -135,7 +139,12 @@ fn run_tests(mode: Mode, path: &str, target: &str, with_dependencies: bool) -> R
135
139
"run" . into( ) , // There is no `cargo miri build` so we just use `cargo miri run`.
136
140
] ;
137
141
}
138
- ui_test:: run_tests ( config)
142
+ ui_test:: run_tests_generic (
143
+ config,
144
+ |path| path. extension ( ) . is_some_and ( |ext| ext == "rs" ) ,
145
+ |_, _| None ,
146
+ TextAndGha ,
147
+ )
139
148
}
140
149
141
150
macro_rules! regexes {
@@ -235,3 +244,45 @@ fn main() -> Result<()> {
235
244
236
245
Ok ( ( ) )
237
246
}
247
+
248
+ /// This is a custom renderer for `ui_test` output that does not emit github actions
249
+ /// `group`s, while still producing regular github actions messages on test failures.
250
+ struct TextAndGha ;
251
+ impl StatusEmitter for TextAndGha {
252
+ fn failed_test < ' a > (
253
+ & ' a self ,
254
+ revision : & ' a str ,
255
+ path : & ' a Path ,
256
+ cmd : & ' a Command ,
257
+ stderr : & ' a [ u8 ] ,
258
+ ) -> Box < dyn std:: fmt:: Debug + ' a > {
259
+ Box :: new ( (
260
+ ui_test:: status_emitter:: Gha :: < false > . failed_test ( revision, path, cmd, stderr) ,
261
+ ui_test:: status_emitter:: Text . failed_test ( revision, path, cmd, stderr) ,
262
+ ) )
263
+ }
264
+
265
+ fn run_tests ( & self , _config : & Config ) -> Box < dyn ui_test:: status_emitter:: DuringTestRun > {
266
+ Box :: new ( TextAndGha )
267
+ }
268
+
269
+ fn finalize (
270
+ & self ,
271
+ failures : usize ,
272
+ succeeded : usize ,
273
+ ignored : usize ,
274
+ filtered : usize ,
275
+ ) -> Box < dyn ui_test:: status_emitter:: Summary > {
276
+ Box :: new ( (
277
+ ui_test:: status_emitter:: Gha :: < false > . finalize ( failures, succeeded, ignored, filtered) ,
278
+ ui_test:: status_emitter:: Text . finalize ( failures, succeeded, ignored, filtered) ,
279
+ ) )
280
+ }
281
+ }
282
+
283
+ impl ui_test:: status_emitter:: DuringTestRun for TextAndGha {
284
+ fn test_result ( & mut self , path : & Path , revision : & str , result : & ui_test:: TestResult ) {
285
+ ui_test:: status_emitter:: Text . test_result ( path, revision, result) ;
286
+ ui_test:: status_emitter:: Gha :: < false > . test_result ( path, revision, result) ;
287
+ }
288
+ }
0 commit comments