diff options
| author | Samuel Holland <samuel@sholland.org> | 2019-09-02 22:10:10 -0500 |
|---|---|---|
| committer | Samuel Holland <samuel@sholland.org> | 2019-09-07 10:32:10 -0500 |
| commit | 2bcabf67378cc4bceb3d66c72f88c95fc97cb4a1 (patch) | |
| tree | 425a3a508b8eb797fcc625d03e6c495e62d7357a | |
| parent | ef54f57c5b9d894a38179d09b00610c1b337b086 (diff) | |
| download | rust-2bcabf67378cc4bceb3d66c72f88c95fc97cb4a1.tar.gz rust-2bcabf67378cc4bceb3d66c72f88c95fc97cb4a1.zip | |
compiletest: Match suffixed environments
This fixes a case where an `ignore-musl` test was not ignored on `armv7-unknown-linux-musleabihf` because the environment did not exactly match. Only enforce that the environment starts with the argument to `ignore-`.
| -rw-r--r-- | src/tools/compiletest/src/header.rs | 2 | ||||
| -rw-r--r-- | src/tools/compiletest/src/util.rs | 8 |
2 files changed, 7 insertions, 3 deletions
diff --git a/src/tools/compiletest/src/header.rs b/src/tools/compiletest/src/header.rs index 3ba8cffe2b5..819d399f34a 100644 --- a/src/tools/compiletest/src/header.rs +++ b/src/tools/compiletest/src/header.rs @@ -835,10 +835,10 @@ impl Config { if name == "test" || util::matches_os(&self.target, name) || // target + util::matches_env(&self.target, name) || // env name == util::get_arch(&self.target) || // architecture name == util::get_pointer_width(&self.target) || // pointer width name == self.stage_id.split('-').next().unwrap() || // stage - Some(name) == util::get_env(&self.target) || // env (self.target != self.host && name == "cross-compile") || match self.compare_mode { Some(CompareMode::Nll) => name == "compare-mode-nll", diff --git a/src/tools/compiletest/src/util.rs b/src/tools/compiletest/src/util.rs index 56ebea7c20f..3a2ee445087 100644 --- a/src/tools/compiletest/src/util.rs +++ b/src/tools/compiletest/src/util.rs @@ -105,8 +105,12 @@ pub fn get_arch(triple: &str) -> &'static str { panic!("Cannot determine Architecture from triple"); } -pub fn get_env(triple: &str) -> Option<&str> { - triple.split('-').nth(3) +pub fn matches_env(triple: &str, name: &str) -> bool { + if let Some(env) = triple.split('-').nth(3) { + env.starts_with(name) + } else { + false + } } pub fn get_pointer_width(triple: &str) -> &'static str { |
