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-`.
This commit is contained in:
Samuel Holland 2019-09-02 22:10:10 -05:00
parent ef54f57c5b
commit 2bcabf6737
2 changed files with 7 additions and 3 deletions

View file

@ -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",

View file

@ -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 {