]>
Commit | Line | Data |
---|---|---|
2b03887a FG |
1 | use std::env; |
2 | use std::path::Path; | |
3 | ||
4 | use super::build_sysroot; | |
5 | use super::config; | |
6 | use super::prepare; | |
7 | use super::utils::{cargo_command, spawn_and_wait}; | |
8 | use super::SysrootKind; | |
9 | ||
10 | pub(crate) fn run( | |
11 | channel: &str, | |
12 | sysroot_kind: SysrootKind, | |
13 | target_dir: &Path, | |
14 | cg_clif_dylib: &Path, | |
15 | host_triple: &str, | |
16 | target_triple: &str, | |
17 | ) { | |
18 | if !config::get_bool("testsuite.abi-cafe") { | |
19 | eprintln!("[SKIP] abi-cafe"); | |
20 | return; | |
21 | } | |
22 | ||
23 | if host_triple != target_triple { | |
24 | eprintln!("[SKIP] abi-cafe (cross-compilation not supported)"); | |
25 | return; | |
26 | } | |
27 | ||
28 | eprintln!("Building sysroot for abi-cafe"); | |
29 | build_sysroot::build_sysroot( | |
30 | channel, | |
31 | sysroot_kind, | |
32 | target_dir, | |
33 | cg_clif_dylib, | |
34 | host_triple, | |
35 | target_triple, | |
36 | ); | |
37 | ||
38 | eprintln!("Running abi-cafe"); | |
39 | let abi_cafe_path = prepare::ABI_CAFE.source_dir(); | |
40 | env::set_current_dir(abi_cafe_path.clone()).unwrap(); | |
41 | ||
42 | let pairs = ["rustc_calls_cgclif", "cgclif_calls_rustc", "cgclif_calls_cc", "cc_calls_cgclif"]; | |
43 | ||
44 | let mut cmd = cargo_command("cargo", "run", Some(target_triple), &abi_cafe_path); | |
45 | cmd.arg("--"); | |
46 | cmd.arg("--pairs"); | |
47 | cmd.args(pairs); | |
48 | cmd.arg("--add-rustc-codegen-backend"); | |
49 | cmd.arg(format!("cgclif:{}", cg_clif_dylib.display())); | |
50 | ||
51 | spawn_and_wait(cmd); | |
52 | } |