@@ -212,9 +212,15 @@ pub fn parse_config(args: Vec<String>) -> Config {
212212 )
213213 . optopt (
214214 "" ,
215- "codegen-backend" ,
215+ "default- codegen-backend" ,
216216 "the codegen backend currently used" ,
217217 "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]" ,
218224 ) ;
219225
220226 let ( argv0, args_) = args. split_first ( ) . unwrap ( ) ;
@@ -276,14 +282,17 @@ pub fn parse_config(args: Vec<String>) -> Config {
276282 || directives:: extract_llvm_version_from_binary ( & matches. opt_str ( "llvm-filecheck" ) ?) ,
277283 ) ;
278284
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 ( ) {
280286 Some ( backend) => match CodegenBackend :: try_from ( backend) {
281287 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+ }
283291 } ,
284292 // By default, it's always llvm.
285293 None => CodegenBackend :: Llvm ,
286294 } ;
295+ let override_codegen_backend = matches. opt_str ( "override-codegen-backend" ) ;
287296
288297 let run_ignored = matches. opt_present ( "ignored" ) ;
289298 let with_rustc_debug_assertions = matches. opt_present ( "with-rustc-debug-assertions" ) ;
@@ -472,7 +481,8 @@ pub fn parse_config(args: Vec<String>) -> Config {
472481
473482 minicore_path : opt_path ( matches, "minicore-path" ) ,
474483
475- codegen_backend,
484+ default_codegen_backend,
485+ override_codegen_backend,
476486 }
477487}
478488
@@ -812,13 +822,13 @@ fn collect_tests_from_dir(
812822 && let Some ( Utf8Component :: Normal ( parent) ) = components. next ( )
813823 && parent == "tests"
814824 && let Ok ( backend) = CodegenBackend :: try_from ( backend)
815- && backend != cx. config . codegen_backend
825+ && backend != cx. config . default_codegen_backend
816826 {
817827 // We ignore asm tests which don't match the current codegen backend.
818828 warning ! (
819829 "Ignoring tests in `{dir}` because they don't match the configured codegen \
820830 backend (`{}`)",
821- cx. config. codegen_backend . as_str( ) ,
831+ cx. config. default_codegen_backend . as_str( ) ,
822832 ) ;
823833 return Ok ( TestCollector :: new ( ) ) ;
824834 }
0 commit comments