From 52f9927ff59390f9f9cc4f2d701b907a1f8eed97 Mon Sep 17 00:00:00 2001 From: msizanoen1 Date: Thu, 7 Nov 2019 14:01:25 +0700 Subject: [PATCH 1/2] Add the TARGET_LIBS environment variable for rustc CI testing --- tests/compile-test.rs | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/tests/compile-test.rs b/tests/compile-test.rs index b5cd2860e811..c06580c701a1 100644 --- a/tests/compile-test.rs +++ b/tests/compile-test.rs @@ -27,6 +27,11 @@ fn host_libs() -> PathBuf { } } +#[must_use] +fn target_libs() -> Option { + option_env!("TARGET_LIBS").map(PathBuf::from) +} + #[must_use] fn rustc_test_suite() -> Option { option_env!("RUSTC_TEST_SUITE").map(PathBuf::from) @@ -57,8 +62,14 @@ fn config(mode: &str, dir: PathBuf) -> compiletest::Config { // See https://github.com/rust-lang/rust-clippy/issues/4015. let needs_disambiguation = ["serde", "regex", "clippy_lints"]; // This assumes that deps are compiled (they are for Cargo integration tests). - let deps = std::fs::read_dir(host_libs().join("deps")).unwrap(); + let deps = fs::read_dir(host_libs().join("deps")).unwrap(); + let deps: Vec<_> = if let Some(target_libs) = target_libs() { + deps.chain(fs::read_dir(target_libs.join("deps")).unwrap()).collect() + } else { + deps.collect() + }; let disambiguated = deps + .into_iter() .filter_map(|dep| { let path = dep.ok()?.path(); let name = path.file_name()?.to_string_lossy(); From 7d2e813634367b7c1798ac54c9ea712a8e767e88 Mon Sep 17 00:00:00 2001 From: msizanoen1 Date: Fri, 8 Nov 2019 12:29:07 +0700 Subject: [PATCH 2/2] Add target libs directory to search path --- tests/compile-test.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/compile-test.rs b/tests/compile-test.rs index c06580c701a1..2dd88f3ba5ef 100644 --- a/tests/compile-test.rs +++ b/tests/compile-test.rs @@ -86,8 +86,9 @@ fn config(mode: &str, dir: PathBuf) -> compiletest::Config { .collect::>(); config.target_rustcflags = Some(format!( - "-L {0} -L {0}/deps -Dwarnings -Zui-testing {1}", + "-L {0} -L {0}/deps {1} -Dwarnings -Zui-testing {2}", host_libs().display(), + target_libs().map_or_else(String::new, |path| format!("-L {0} -L {0}/deps", path.display())), disambiguated.join(" ") ));