@@ -46,42 +46,30 @@ fn build_so_for_c_ffi_tests() -> PathBuf {
46
46
}
47
47
48
48
fn run_tests ( mode : Mode , path : & str , target : & str , with_dependencies : bool ) -> Result < ( ) > {
49
- let mut config = Config {
50
- target : Some ( target. to_owned ( ) ) ,
51
- stderr_filters : STDERR . clone ( ) ,
52
- stdout_filters : STDOUT . clone ( ) ,
53
- root_dir : PathBuf :: from ( path) ,
54
- mode,
55
- program : CommandBuilder :: rustc ( ) ,
56
- quiet : false ,
57
- edition : Some ( "2021" . into ( ) ) ,
58
- ..Config :: default ( )
59
- } ;
60
-
61
- config. program . program = miri_path ( ) ;
49
+ // Miri is rustc-like, so we create a default builder for rustc and modify it
50
+ let mut program = CommandBuilder :: rustc ( ) ;
51
+ program. program = miri_path ( ) ;
62
52
63
53
let in_rustc_test_suite = option_env ! ( "RUSTC_STAGE" ) . is_some ( ) ;
64
54
65
55
// Add some flags we always want.
66
56
if in_rustc_test_suite {
67
57
// Less aggressive warnings to make the rustc toolstate management less painful.
68
58
// (We often get warnings when e.g. a feature gets stabilized or some lint gets added/improved.)
69
- config . program . args . push ( "-Astable-features" . into ( ) ) ;
70
- config . program . args . push ( "-Aunused" . into ( ) ) ;
59
+ program. args . push ( "-Astable-features" . into ( ) ) ;
60
+ program. args . push ( "-Aunused" . into ( ) ) ;
71
61
} else {
72
- config . program . args . push ( "-Dwarnings" . into ( ) ) ;
73
- config . program . args . push ( "-Dunused" . into ( ) ) ;
62
+ program. args . push ( "-Dwarnings" . into ( ) ) ;
63
+ program. args . push ( "-Dunused" . into ( ) ) ;
74
64
}
75
65
if let Ok ( extra_flags) = env:: var ( "MIRIFLAGS" ) {
76
66
for flag in extra_flags. split_whitespace ( ) {
77
- config . program . args . push ( flag. into ( ) ) ;
67
+ program. args . push ( flag. into ( ) ) ;
78
68
}
79
69
}
80
- config. program . args . push ( "-Zui-testing" . into ( ) ) ;
81
- if let Some ( target) = & config. target {
82
- config. program . args . push ( "--target" . into ( ) ) ;
83
- config. program . args . push ( target. into ( ) ) ;
84
- }
70
+ program. args . push ( "-Zui-testing" . into ( ) ) ;
71
+ program. args . push ( "--target" . into ( ) ) ;
72
+ program. args . push ( target. into ( ) ) ;
85
73
86
74
// If we're on linux, and we're testing the extern-so functionality,
87
75
// then build the shared object file for testing external C function calls
@@ -90,18 +78,31 @@ fn run_tests(mode: Mode, path: &str, target: &str, with_dependencies: bool) -> R
90
78
let so_file_path = build_so_for_c_ffi_tests ( ) ;
91
79
let mut flag = std:: ffi:: OsString :: from ( "-Zmiri-extern-so-file=" ) ;
92
80
flag. push ( so_file_path. into_os_string ( ) ) ;
93
- config . program . args . push ( flag) ;
81
+ program. args . push ( flag) ;
94
82
}
95
83
96
84
let skip_ui_checks = env:: var_os ( "MIRI_SKIP_UI_CHECKS" ) . is_some ( ) ;
97
85
98
- config . output_conflict_handling = match ( env:: var_os ( "MIRI_BLESS" ) . is_some ( ) , skip_ui_checks) {
86
+ let output_conflict_handling = match ( env:: var_os ( "MIRI_BLESS" ) . is_some ( ) , skip_ui_checks) {
99
87
( false , false ) => OutputConflictHandling :: Error ,
100
88
( true , false ) => OutputConflictHandling :: Bless ,
101
89
( false , true ) => OutputConflictHandling :: Ignore ,
102
90
( true , true ) => panic ! ( "cannot use MIRI_BLESS and MIRI_SKIP_UI_CHECKS at the same time" ) ,
103
91
} ;
104
92
93
+ let mut config = Config {
94
+ target : Some ( target. to_owned ( ) ) ,
95
+ stderr_filters : STDERR . clone ( ) ,
96
+ stdout_filters : STDOUT . clone ( ) ,
97
+ root_dir : PathBuf :: from ( path) ,
98
+ mode,
99
+ program,
100
+ output_conflict_handling,
101
+ quiet : false ,
102
+ edition : Some ( "2021" . into ( ) ) ,
103
+ ..Config :: default ( )
104
+ } ;
105
+
105
106
// Handle command-line arguments.
106
107
let mut after_dashdash = false ;
107
108
config. path_filter . extend ( std:: env:: args ( ) . skip ( 1 ) . filter ( |arg| {
0 commit comments