diff options
| author | Cameron Steffen <cam.steffen94@gmail.com> | 2021-09-08 10:45:44 -0500 |
|---|---|---|
| committer | Cameron Steffen <cam.steffen94@gmail.com> | 2021-09-08 14:07:03 -0500 |
| commit | 2e15c8054d7f26bf438a84a7e6a7fd34f540444f (patch) | |
| tree | 97f0dcb8591e05210f58577123ba28728a1189b1 | |
| parent | cea46dd9fe268d733156ed620bee1309fbcc2396 (diff) | |
| download | rust-2e15c8054d7f26bf438a84a7e6a7fd34f540444f.tar.gz rust-2e15c8054d7f26bf438a84a7e6a7fd34f540444f.zip | |
Make host libs -L flag optional
| -rw-r--r-- | tests/compile-test.rs | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/tests/compile-test.rs b/tests/compile-test.rs index ddf5b394ae1..27a1627622b 100644 --- a/tests/compile-test.rs +++ b/tests/compile-test.rs @@ -104,7 +104,7 @@ fn extern_flags() -> String { } crates .into_iter() - .map(|(name, path)| format!("--extern {}={} ", name, path)) + .map(|(name, path)| format!(" --extern {}={}", name, path)) .collect() } @@ -126,10 +126,13 @@ fn default_config() -> compiletest::Config { // Using `-L dependency={}` enforces that external dependencies are added with `--extern`. // This is valuable because a) it allows us to monitor what external dependencies are used // and b) it ensures that conflicting rlibs are resolved properly. + let host_libs = option_env!("HOST_LIBS") + .map(|p| format!(" -L dependency={}", Path::new(p).join("deps").display())) + .unwrap_or_default(); config.target_rustcflags = Some(format!( - "--emit=metadata -L dependency={} -L dependency={} -Dwarnings -Zui-testing {}", - host_lib().join("deps").display(), + "--emit=metadata -Dwarnings -Zui-testing -L dependency={}{}{}", deps_path.display(), + host_libs, extern_flags(), )); |
