Skip to content

Commit b2e0cc5

Browse files
authored
Merge pull request #399 from GuillaumeGomez/checkout
If the rustc commit cannot be retrieve, just checkout the repository
2 parents a53495a + 6631dd9 commit b2e0cc5

File tree

1 file changed

+24
-14
lines changed

1 file changed

+24
-14
lines changed

build_system/src/test.rs

+24-14
Original file line numberDiff line numberDiff line change
@@ -503,7 +503,15 @@ fn setup_rustc(env: &mut Env, args: &TestArg) -> Result<(), String> {
503503
Some(commit_hash) => commit_hash,
504504
None => return Err("Couldn't retrieve rustc commit hash".to_string()),
505505
};
506-
run_command_with_output_and_env(&[&"git", &"checkout", &rustc_commit], rust_dir, Some(env))?;
506+
if rustc_commit != "unknown" {
507+
run_command_with_output_and_env(
508+
&[&"git", &"checkout", &rustc_commit],
509+
rust_dir,
510+
Some(env),
511+
)?;
512+
} else {
513+
run_command_with_output_and_env(&[&"git", &"checkout"], rust_dir, Some(env))?;
514+
}
507515
let cargo = String::from_utf8(
508516
run_command_with_env(&[&"rustup", &"which", &"cargo"], rust_dir, Some(env))?.stdout,
509517
)
@@ -516,23 +524,25 @@ fn setup_rustc(env: &mut Env, args: &TestArg) -> Result<(), String> {
516524
Ok(cargo)
517525
}
518526
})?;
519-
let llvm_filecheck = String::from_utf8(
520-
run_command_with_env(
521-
&[
522-
&"bash",
523-
&"-c",
524-
&"which FileCheck-10 || \
527+
let llvm_filecheck = match run_command_with_env(
528+
&[
529+
&"bash",
530+
&"-c",
531+
&"which FileCheck-10 || \
525532
which FileCheck-11 || \
526533
which FileCheck-12 || \
527534
which FileCheck-13 || \
528535
which FileCheck-14",
529-
],
530-
rust_dir,
531-
Some(env),
532-
)?
533-
.stdout,
534-
)
535-
.map_err(|error| format!("Failed to retrieve LLVM FileCheck: {:?}", error))?;
536+
],
537+
rust_dir,
538+
Some(env),
539+
) {
540+
Ok(cmd) => String::from_utf8_lossy(&cmd.stdout).to_string(),
541+
Err(_) => {
542+
eprintln!("Failed to retrieve LLVM FileCheck, ignoring...");
543+
String::new()
544+
}
545+
};
536546
std::fs::write(
537547
"rust/config.toml",
538548
&format!(

0 commit comments

Comments
 (0)