diff options
| author | Aaron Hill <aa1ronham@gmail.com> | 2019-03-20 23:27:08 -0400 |
|---|---|---|
| committer | Aaron Hill <aa1ronham@gmail.com> | 2019-04-14 00:37:25 -0400 |
| commit | 21491dc7012ae50ecdc694b5ee664ecc502ae2c5 (patch) | |
| tree | c9db87cbc1361fcc989fb25b4d263b4843235d10 /src/tools/compiletest | |
| parent | ee621f42329069c296b4c2066b3743cc4ff0f369 (diff) | |
| download | rust-21491dc7012ae50ecdc694b5ee664ecc502ae2c5.tar.gz rust-21491dc7012ae50ecdc694b5ee664ecc502ae2c5.zip | |
Properly parse '--extern-private' with name and path
Diffstat (limited to 'src/tools/compiletest')
| -rw-r--r-- | src/tools/compiletest/src/header.rs | 12 | ||||
| -rw-r--r-- | src/tools/compiletest/src/runtest.rs | 18 |
2 files changed, 30 insertions, 0 deletions
diff --git a/src/tools/compiletest/src/header.rs b/src/tools/compiletest/src/header.rs index 2fe837e99d3..c548b1efa75 100644 --- a/src/tools/compiletest/src/header.rs +++ b/src/tools/compiletest/src/header.rs @@ -286,6 +286,9 @@ pub struct TestProps { // directory as the test, but for backwards compatibility reasons // we also check the auxiliary directory) pub aux_builds: Vec<String>, + // A list of crates to pass '--extern-private name:PATH' flags for + // This should be a subset of 'aux_build' + pub extern_private: Vec<String>, // Environment settings to use for compiling pub rustc_env: Vec<(String, String)>, // Environment settings to use during execution @@ -353,6 +356,7 @@ impl TestProps { run_flags: None, pp_exact: None, aux_builds: vec![], + extern_private: vec![], revisions: vec![], rustc_env: vec![], exec_env: vec![], @@ -469,6 +473,10 @@ impl TestProps { self.aux_builds.push(ab); } + if let Some(ep) = config.parse_extern_private(ln) { + self.extern_private.push(ep); + } + if let Some(ee) = config.parse_env(ln, "exec-env") { self.exec_env.push(ee); } @@ -610,6 +618,10 @@ impl Config { .map(|r| r.trim().to_string()) } + fn parse_extern_private(&self, line: &str) -> Option<String> { + self.parse_name_value_directive(line, "extern-private") + } + fn parse_compile_flags(&self, line: &str) -> Option<String> { self.parse_name_value_directive(line, "compile-flags") } diff --git a/src/tools/compiletest/src/runtest.rs b/src/tools/compiletest/src/runtest.rs index 2021dd513aa..cec1d83eb02 100644 --- a/src/tools/compiletest/src/runtest.rs +++ b/src/tools/compiletest/src/runtest.rs @@ -74,6 +74,17 @@ pub fn dylib_env_var() -> &'static str { } } +/// The platform-specific library file extension +pub fn lib_extension() -> &'static str { + if cfg!(windows) { + ".dll" + } else if cfg!(target_os = "macos") { + ".dylib" + } else { + ".so" + } +} + #[derive(Debug, PartialEq)] pub enum DiffLine { Context(String), @@ -1585,6 +1596,13 @@ impl<'test> TestCx<'test> { create_dir_all(&aux_dir).unwrap(); } + for priv_dep in &self.props.extern_private { + let lib_name = format!("lib{}{}", priv_dep, lib_extension()); + rustc + .arg("--extern-private") + .arg(format!("{}={}", priv_dep, aux_dir.join(lib_name).to_str().unwrap())); + } + for rel_ab in &self.props.aux_builds { let aux_testpaths = self.compute_aux_test_paths(rel_ab); let aux_props = |
