@@ -212,9 +212,15 @@ pub fn parse_config(args: Vec<String>) -> Config {
212
212
)
213
213
. optopt (
214
214
"" ,
215
- "codegen-backend" ,
215
+ "default- codegen-backend" ,
216
216
"the codegen backend currently used" ,
217
217
"CODEGEN BACKEND NAME" ,
218
+ )
219
+ . optopt (
220
+ "" ,
221
+ "override-codegen-backend" ,
222
+ "the codegen backend to use instead of the default one" ,
223
+ "CODEGEN BACKEND [NAME | PATH]" ,
218
224
) ;
219
225
220
226
let ( argv0, args_) = args. split_first ( ) . unwrap ( ) ;
@@ -276,14 +282,17 @@ pub fn parse_config(args: Vec<String>) -> Config {
276
282
|| directives:: extract_llvm_version_from_binary ( & matches. opt_str ( "llvm-filecheck" ) ?) ,
277
283
) ;
278
284
279
- let codegen_backend = match matches. opt_str ( "codegen-backend" ) . as_deref ( ) {
285
+ let default_codegen_backend = match matches. opt_str ( "default- codegen-backend" ) . as_deref ( ) {
280
286
Some ( backend) => match CodegenBackend :: try_from ( backend) {
281
287
Ok ( backend) => backend,
282
- Err ( error) => panic ! ( "invalid value `{backend}` for `--codegen-backend`: {error}" ) ,
288
+ Err ( error) => {
289
+ panic ! ( "invalid value `{backend}` for `--defalt-codegen-backend`: {error}" )
290
+ }
283
291
} ,
284
292
// By default, it's always llvm.
285
293
None => CodegenBackend :: Llvm ,
286
294
} ;
295
+ let override_codegen_backend = matches. opt_str ( "override-codegen-backend" ) ;
287
296
288
297
let run_ignored = matches. opt_present ( "ignored" ) ;
289
298
let with_rustc_debug_assertions = matches. opt_present ( "with-rustc-debug-assertions" ) ;
@@ -472,7 +481,8 @@ pub fn parse_config(args: Vec<String>) -> Config {
472
481
473
482
minicore_path : opt_path ( matches, "minicore-path" ) ,
474
483
475
- codegen_backend,
484
+ default_codegen_backend,
485
+ override_codegen_backend,
476
486
}
477
487
}
478
488
@@ -812,13 +822,13 @@ fn collect_tests_from_dir(
812
822
&& let Some ( Utf8Component :: Normal ( parent) ) = components. next ( )
813
823
&& parent == "tests"
814
824
&& let Ok ( backend) = CodegenBackend :: try_from ( backend)
815
- && backend != cx. config . codegen_backend
825
+ && backend != cx. config . default_codegen_backend
816
826
{
817
827
// We ignore asm tests which don't match the current codegen backend.
818
828
warning ! (
819
829
"Ignoring tests in `{dir}` because they don't match the configured codegen \
820
830
backend (`{}`)",
821
- cx. config. codegen_backend . as_str( ) ,
831
+ cx. config. default_codegen_backend . as_str( ) ,
822
832
) ;
823
833
return Ok ( TestCollector :: new ( ) ) ;
824
834
}
0 commit comments