Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit338756f

Browse files
Add--toolchain option fortest command
1 parentf518ec5 commit338756f

File tree

1 file changed

+28
-7
lines changed

1 file changed

+28
-7
lines changed

‎build_system/src/test.rs

Lines changed: 28 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,8 @@ fn show_usage() {
7070
--use-system-gcc : Use system installed libgccjit
7171
--build-only : Only build rustc_codegen_gcc then exits
7272
--nb-parts : Used to split rustc_tests (for CI needs)
73-
--current-part : Used with `--nb-parts`, allows you to specify which parts to test"#
73+
--current-part : Used with `--nb-parts`, allows you to specify which parts to test
74+
--toolchain [arg] : The (rustc) toolchain to be used"#
7475
);
7576
ConfigInfo::show_usage();
7677
for(option,(doc, _))inget_runners(){
@@ -95,6 +96,7 @@ struct TestArg {
9596
sysroot_panic_abort:bool,
9697
config_info:ConfigInfo,
9798
sysroot_features:Vec<String>,
99+
toolchain_name:Option<String>,
98100
keep_lto_tests:bool,
99101
}
100102

@@ -142,6 +144,18 @@ impl TestArg {
142144
returnErr(format!("Expected an argument after `{}`, found nothing", arg));
143145
}
144146
},
147+
"--toolchain" =>match args.next(){
148+
Some(toolchain_name)if !toolchain_name.is_empty() =>{
149+
if !toolchain_name.starts_with('+'){
150+
test_arg.toolchain_name =Some(format!("+{toolchain_name}"));
151+
}else{
152+
test_arg.toolchain_name =Some(toolchain_name);
153+
}
154+
}
155+
_ =>{
156+
returnErr(format!("Expected an argument after `{}`, found nothing", arg));
157+
}
158+
},
145159
"--help" =>{
146160
show_usage();
147161
returnOk(None);
@@ -184,7 +198,11 @@ fn build_if_no_backend(env: &Env, args: &TestArg) -> Result<(), String> {
184198
if args.config_info.backend.is_some(){
185199
returnOk(());
186200
}
187-
letmut command:Vec<&dynAsRef<OsStr>> =vec![&"cargo",&"rustc"];
201+
letmut command:Vec<&dynAsRef<OsStr>> =vec![&"cargo"];
202+
ifletSome(ref toolchain_name) = args.toolchain_name{
203+
command.push(toolchain_name);
204+
}
205+
command.push(&"rustc");
188206
letmut tmp_env;
189207
let env =if args.config_info.channel ==Channel::Release{
190208
tmp_env = env.clone();
@@ -460,11 +478,14 @@ fn std_tests(env: &Env, args: &TestArg) -> Result<(), String> {
460478
}
461479

462480
fnsetup_rustc(env:&mutEnv,args:&TestArg) ->Result<PathBuf,String>{
463-
let toolchain =format!(
464-
"+{channel}-{host}",
465-
channel = get_toolchain()?,// May also include date
466-
host = args.config_info.host_triple
467-
);
481+
let toolchain =match args.toolchain_name{
482+
Some(ref toolchain_name) => toolchain_name.clone(),
483+
None =>format!(
484+
"+{channel}-{host}",
485+
channel = get_toolchain()?,// May also include date
486+
host = args.config_info.host_triple
487+
),
488+
};
468489
let rust_dir_path =Path::new(crate::BUILD_DIR).join("rust");
469490
// If the repository was already cloned, command will fail, so doesn't matter.
470491
let _ =git_clone("https://github.com/rust-lang/rust.git",Some(&rust_dir_path),false);

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp