8e161a791a
This commit moves over most of the testing infrastructure to in-tree docker images that are all dispatched to from Travis (no other test configuration). This allows versioning modifications to the test infrastructure as well as the code itself. Additionally separate docker images allows for easy modification of one without worrying about tampering of others as well as easy addition of new targets by simply adding a new `Dockerfile`. Additionally this commit bundles the master version of the `compiler-rt` source repository from `llvm-mirror/compiler-rt` to test against. The compiler-rt library itself is compiled as a `cdylib` which is then dynamically located at runtime and we look for symbols in. There's a few hoops here, but they currently get the job done. All tests now execute against both gcc_s and compiler-rt, and this testing strategy is now all hidden behind a macro as well (refactoring all existing tests along the way).
36 lines
875 B
Rust
36 lines
875 B
Rust
#![feature(drop_types_in_const)]
|
|
|
|
extern crate libloading;
|
|
|
|
use std::sync::{Once, ONCE_INIT};
|
|
use std::env;
|
|
|
|
use libloading::Library;
|
|
|
|
fn compiler_rt() -> &'static Library {
|
|
let dir = env::current_exe().unwrap();
|
|
let cdylib = dir.parent().unwrap().read_dir().unwrap().map(|c| {
|
|
c.unwrap().path()
|
|
}).find(|path| {
|
|
path.file_name().unwrap().to_str().unwrap().contains("compiler_rt_cdylib")
|
|
}).unwrap();
|
|
|
|
unsafe {
|
|
static mut COMPILER_RT: Option<Library> = None;
|
|
static INIT: Once = ONCE_INIT;
|
|
|
|
INIT.call_once(|| {
|
|
COMPILER_RT = Some(Library::new(&cdylib).unwrap());
|
|
});
|
|
COMPILER_RT.as_ref().unwrap()
|
|
}
|
|
}
|
|
|
|
pub fn get(sym: &str) -> usize {
|
|
unsafe {
|
|
let sym = format!("_{}", sym);
|
|
let f: fn() -> usize = *compiler_rt().get(sym.as_bytes()).unwrap();
|
|
f()
|
|
}
|
|
}
|