Skip to content
Snippets Groups Projects
Commit 15b34fcf authored by Russel Arbore's avatar Russel Arbore
Browse files

persist tmp dir if clang/nvcc fail

parent f847ee50
No related branches found
No related tags found
1 merge request!143Fork improvements
Pipeline #201361 passed
...@@ -780,8 +780,15 @@ impl PassManager { ...@@ -780,8 +780,15 @@ impl PassManager {
.stdin(Stdio::piped()) .stdin(Stdio::piped())
.stdout(Stdio::piped()) .stdout(Stdio::piped())
.spawn() .spawn()
.expect("Error running clang. Is it installed?"); .expect("PANIC: Error running clang. Is it installed?");
assert!(clang_process.wait().unwrap().success()); if clang_process
.wait()
.map(|status| !status.success())
.unwrap_or(false)
{
let path = tmp_dir.into_path();
panic!("PANIC: Clang failed to compile the LLVM IR module. Persisting temporary directory ({}).", path.display());
}
let mut ar_args = vec!["crus", &output_archive, &llvm_object]; let mut ar_args = vec!["crus", &output_archive, &llvm_object];
...@@ -806,8 +813,15 @@ impl PassManager { ...@@ -806,8 +813,15 @@ impl PassManager {
.arg(&cuda_object) .arg(&cuda_object)
.arg(&cuda_path) .arg(&cuda_path)
.spawn() .spawn()
.expect("Error running nvcc. Is it installed?"); .expect("PANIC: Error running NVCC. Is it installed?");
assert!(nvcc_process.wait().unwrap().success()); if nvcc_process
.wait()
.map(|status| !status.success())
.unwrap_or(false)
{
let path = tmp_dir.into_path();
panic!("PANIC: NVCC failed to compile the CUDA module. Persisting temporary directory ({}).", path.display());
}
ar_args.push(&cuda_object); ar_args.push(&cuda_object);
} }
...@@ -816,7 +830,17 @@ impl PassManager { ...@@ -816,7 +830,17 @@ impl PassManager {
.args(&ar_args) .args(&ar_args)
.spawn() .spawn()
.expect("Error running ar. Is it installed?"); .expect("Error running ar. Is it installed?");
assert!(ar_process.wait().unwrap().success()); if ar_process
.wait()
.map(|status| !status.success())
.unwrap_or(false)
{
let path = tmp_dir.into_path();
panic!(
"PANIC: Ar failed to create a static library. Persisting temporary directory ({}).",
path.display()
);
}
// Write the Rust runtime into a file. // Write the Rust runtime into a file.
let output_rt = format!("{}/rt_{}.hrt", output_dir, module_name); let output_rt = format!("{}/rt_{}.hrt", output_dir, module_name);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment