Files
core/test/dever-cli-tests/support/llvm_inputs.rs
T

49 lines
1.4 KiB
Rust

//! Explicit Linux author inputs shared by opt-in native fixtures.
use std::path::{Path, PathBuf};
pub fn workspace() -> PathBuf {
let root = std::env::var_os("DEVER_NATIVE_ACCEPTANCE_WORKSPACE")
.map(PathBuf::from)
.unwrap_or_else(|| Path::new(env!("CARGO_MANIFEST_DIR")).join("../.."));
assert!(root.is_absolute());
root
}
fn prepared_root() -> PathBuf {
workspace().join("target/native-release-inputs")
}
pub fn core_libraries() -> Vec<(String, PathBuf)> {
let mut inputs = std::fs::read_dir(prepared_root().join("core-libraries"))
.expect("prepare the explicit GNU compiler-library closure")
.map(|entry| {
let entry = entry.unwrap();
assert!(entry.file_type().unwrap().is_file());
(entry.file_name().into_string().unwrap(), entry.path())
})
.collect::<Vec<_>>();
assert!(!inputs.is_empty(), "compiler-library closure is empty");
inputs.sort_by(|left, right| left.0.cmp(&right.0));
inputs
}
pub fn native_inputs() -> Vec<(&'static str, PathBuf)> {
let native = prepared_root().join("native");
[
"runtime.a",
"crt1.o",
"crti.o",
"crtbeginT.o",
"crtend.o",
"crtn.o",
"libc.a",
"libm.a",
"libmvec.a",
"libgcc.a",
"libgcc_eh.a",
]
.into_iter()
.map(|name| (name, native.join(name)))
.collect()
}