Skip to content

Commit

Permalink
Allow compile tests to run under both debug and release profiles.
Browse files Browse the repository at this point in the history
Fixes #28.
  • Loading branch information
orium committed Oct 27, 2023
1 parent b8418a8 commit ba4efda
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion tests/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,15 @@ fn rustc_flags(dependency_path: &str, dependencies: &[&str]) -> String {
flags
}

fn dependency_path() -> String {
std::env::var("LD_LIBRARY_PATH")
.expect("LD_LIBRARY_PATH not defined")
.split(':')
.find(|path| path.ends_with("/deps"))
.expect("could not find dependency path")
.to_owned()
}

#[test]
fn compile_tests() {
use compiletest::common::Mode;
Expand All @@ -48,7 +57,7 @@ fn compile_tests() {

let dependencies = ["archery", "static_assertions"];

config.target_rustcflags = Some(rustc_flags("target/debug/deps/", &dependencies));
config.target_rustcflags = Some(rustc_flags(&dependency_path(), &dependencies));

compiletest::run_tests(&config);
}

0 comments on commit ba4efda

Please sign in to comment.