Skip to content

Commit

Permalink
Fix compiletest upstream bug (osx nightly builds)
Browse files Browse the repository at this point in the history
This is a temporary fix, see Manishearth/compiletest-rs#155
  • Loading branch information
aldanor committed Jan 12, 2019
1 parent 44212fc commit 3112109
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions hdf5-derive/tests/compile-test.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
use std::env;
use std::fs::{read_dir, remove_file};

// Workaround for https://github.com/laumann/compiletest-rs/issues/114
Expand Down Expand Up @@ -26,6 +27,20 @@ fn clean_rlibs(config: &compiletest_rs::Config) {
}
}

fn link_deps(config: &mut compiletest_rs::Config) {
// https://github.com/laumann/compiletest-rs/issues/155
if cfg!(target_os = "macos") {
if let Ok(lib_paths) = env::var("DYLD_FALLBACK_LIBRARY_PATH") {
let mut flags = config.target_rustcflags.take().unwrap_or_else(String::new);
for p in env::split_paths(&lib_paths) {
flags += " -L ";
flags += p.to_str().unwrap(); // Can't fail. We already know this is unicode
}
config.target_rustcflags = Some(flags);
}
}
}

fn run_mode(mode: &'static str) {
let mut config = compiletest_rs::Config::default();
let cfg_mode = mode.parse().expect("Invalid mode");
Expand All @@ -34,6 +49,7 @@ fn run_mode(mode: &'static str) {
config.src_base = format!("tests/{}", mode).into();
config.verbose = false;
config.link_deps();
link_deps(&mut config);
// clean_rlibs(&config); // commented out for now as it's flaky on CI

compiletest_rs::run_tests(&config);
Expand Down

0 comments on commit 3112109

Please sign in to comment.