Skip to content

Commit

Permalink
compiletest: Match suffixed environments
Browse files Browse the repository at this point in the history
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-`.
  • Loading branch information
smaeul committed Sep 7, 2019
1 parent ef54f57 commit 2bcabf6
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/tools/compiletest/src/header.rs
Expand Up @@ -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",
Expand Down
8 changes: 6 additions & 2 deletions src/tools/compiletest/src/util.rs
Expand Up @@ -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 {
Expand Down

0 comments on commit 2bcabf6

Please sign in to comment.