@@ -15,7 +15,7 @@ use ui_test::spanned::Spanned;
15
15
use ui_test:: { status_emitter, CommandBuilder , Config , Format , Match , OutputConflictHandling } ;
16
16
17
17
#[ derive( Copy , Clone , Debug ) ]
18
- enum Mode {
18
+ enum RunDepMode {
19
19
Pass ,
20
20
Fail ,
21
21
Yolo ,
@@ -80,7 +80,7 @@ fn build_native_lib() -> PathBuf {
80
80
81
81
/// Does *not* set any args or env vars, since it is shared between the test runner and
82
82
/// run_dep_mode.
83
- fn miri_config ( target : & str , path : & str , mode : Mode , with_dependencies : bool ) -> Config {
83
+ fn miri_config ( target : & str , path : & str , mode : RunDepMode , with_dependencies : bool ) -> Config {
84
84
// Miri is rustc-like, so we create a default builder for rustc and modify it
85
85
let mut program = CommandBuilder :: rustc ( ) ;
86
86
program. program = miri_path ( ) ;
@@ -96,20 +96,15 @@ fn miri_config(target: &str, path: &str, mode: Mode, with_dependencies: bool) ->
96
96
} ;
97
97
98
98
config. comment_defaults . base ( ) . exit_status = match mode {
99
- Mode :: Pass => Some ( 0_i32 ) ,
100
- Mode :: Fail => Some ( 1 ) ,
101
- Mode :: Yolo => None ,
102
- Mode :: Panic => Some ( 101 ) ,
99
+ RunDepMode :: Pass => Some ( 0_i32 ) ,
100
+ RunDepMode :: Fail => Some ( 1 ) ,
101
+ RunDepMode :: Yolo => None ,
102
+ RunDepMode :: Panic => Some ( 101 ) ,
103
103
}
104
104
. map ( Spanned :: dummy)
105
105
. into ( ) ;
106
106
107
- config. comment_defaults . base ( ) . require_annotations = Spanned :: dummy ( match mode {
108
- Mode :: Pass => false ,
109
- Mode :: Fail => true ,
110
- Mode :: Yolo => false ,
111
- Mode :: Panic => false ,
112
- } )
107
+ config. comment_defaults . base ( ) . require_annotations = Spanned :: dummy ( matches ! ( mode, RunDepMode :: Fail ) )
113
108
. into ( ) ;
114
109
115
110
config. comment_defaults . base ( ) . normalize_stderr =
@@ -143,7 +138,7 @@ fn miri_config(target: &str, path: &str, mode: Mode, with_dependencies: bool) ->
143
138
}
144
139
145
140
fn run_tests (
146
- mode : Mode ,
141
+ mode : RunDepMode ,
147
142
path : & str ,
148
143
target : & str ,
149
144
with_dependencies : bool ,
@@ -280,7 +275,7 @@ enum Dependencies {
280
275
use Dependencies :: * ;
281
276
282
277
fn ui (
283
- mode : Mode ,
278
+ mode : RunDepMode ,
284
279
path : & str ,
285
280
target : & str ,
286
281
with_dependencies : Dependencies ,
@@ -316,21 +311,21 @@ fn main() -> Result<()> {
316
311
}
317
312
}
318
313
319
- ui ( Mode :: Pass , "tests/pass" , & target, WithoutDependencies , tmpdir. path ( ) ) ?;
320
- ui ( Mode :: Pass , "tests/pass-dep" , & target, WithDependencies , tmpdir. path ( ) ) ?;
321
- ui ( Mode :: Panic , "tests/panic" , & target, WithDependencies , tmpdir. path ( ) ) ?;
322
- ui ( Mode :: Fail , "tests/fail" , & target, WithoutDependencies , tmpdir. path ( ) ) ?;
323
- ui ( Mode :: Fail , "tests/fail-dep" , & target, WithDependencies , tmpdir. path ( ) ) ?;
314
+ ui ( RunDepMode :: Pass , "tests/pass" , & target, WithoutDependencies , tmpdir. path ( ) ) ?;
315
+ ui ( RunDepMode :: Pass , "tests/pass-dep" , & target, WithDependencies , tmpdir. path ( ) ) ?;
316
+ ui ( RunDepMode :: Panic , "tests/panic" , & target, WithDependencies , tmpdir. path ( ) ) ?;
317
+ ui ( RunDepMode :: Fail , "tests/fail" , & target, WithoutDependencies , tmpdir. path ( ) ) ?;
318
+ ui ( RunDepMode :: Fail , "tests/fail-dep" , & target, WithDependencies , tmpdir. path ( ) ) ?;
324
319
if cfg ! ( unix) {
325
- ui ( Mode :: Pass , "tests/native-lib/pass" , & target, WithoutDependencies , tmpdir. path ( ) ) ?;
326
- ui ( Mode :: Fail , "tests/native-lib/fail" , & target, WithoutDependencies , tmpdir. path ( ) ) ?;
320
+ ui ( RunDepMode :: Pass , "tests/native-lib/pass" , & target, WithoutDependencies , tmpdir. path ( ) ) ?;
321
+ ui ( RunDepMode :: Fail , "tests/native-lib/fail" , & target, WithoutDependencies , tmpdir. path ( ) ) ?;
327
322
}
328
323
329
324
Ok ( ( ) )
330
325
}
331
326
332
327
fn run_dep_mode ( target : String , args : impl Iterator < Item = OsString > ) -> Result < ( ) > {
333
- let mut config = miri_config ( & target, "" , Mode :: Yolo , /* with dependencies */ true ) ;
328
+ let mut config = miri_config ( & target, "" , RunDepMode :: Yolo , /* with dependencies */ true ) ;
334
329
config. comment_defaults . base ( ) . custom . remove ( "edition" ) ;
335
330
config. fill_host_and_target ( ) ?;
336
331
config. program . args = args. collect ( ) ;
0 commit comments