about summary refs log tree commit diff
diff options
context:
space:
mode:
authormsizanoen1 <qtmlabs@protonmail.com>2019-11-07 14:01:25 +0700
committermsizanoen1 <qtmlabs@protonmail.com>2019-11-07 22:48:14 +0700
commit52f9927ff59390f9f9cc4f2d701b907a1f8eed97 (patch)
treeae2aca3f7b6d9cebdd8416b49b395eda07307bef
parent7531a08eed84a86e96d1cffdd002654507819873 (diff)
downloadrust-52f9927ff59390f9f9cc4f2d701b907a1f8eed97.tar.gz
rust-52f9927ff59390f9f9cc4f2d701b907a1f8eed97.zip
Add the TARGET_LIBS environment variable for rustc CI testing
-rw-r--r--tests/compile-test.rs13
1 files changed, 12 insertions, 1 deletions
diff --git a/tests/compile-test.rs b/tests/compile-test.rs
index b5cd2860e81..c06580c701a 100644
--- a/tests/compile-test.rs
+++ b/tests/compile-test.rs
@@ -28,6 +28,11 @@ fn host_libs() -> PathBuf {
 }
 
 #[must_use]
+fn target_libs() -> Option<PathBuf> {
+    option_env!("TARGET_LIBS").map(PathBuf::from)
+}
+
+#[must_use]
 fn rustc_test_suite() -> Option<PathBuf> {
     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();