Skip to content

Enable ignoring tests based on architecture. #19809

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions src/compiletest/header.rs
Original file line number Diff line number Diff line change
Expand Up @@ -144,9 +144,12 @@ pub fn load_props(testfile: &Path) -> TestProps {
}

pub fn is_test_ignored(config: &Config, testfile: &Path) -> bool {
fn ignore_target(config: &Config) -> String {
fn ignore_os(config: &Config) -> String {
format!("ignore-{}", util::get_os(config.target.as_slice()))
}
fn ignore_arch(config: &Config) -> String {
format!("ignore-{}", util::get_arch(config.target.as_slice()))
}
fn ignore_stage(config: &Config) -> String {
format!("ignore-{}",
config.stage_id.as_slice().split('-').next().unwrap())
Expand Down Expand Up @@ -209,7 +212,8 @@ pub fn is_test_ignored(config: &Config, testfile: &Path) -> bool {

let val = iter_header(testfile, |ln| {
!parse_name_directive(ln, "ignore-test") &&
!parse_name_directive(ln, ignore_target(config).as_slice()) &&
!parse_name_directive(ln, ignore_os(config).as_slice()) &&
!parse_name_directive(ln, ignore_arch(config).as_slice()) &&
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unfortunately due to the use of .contains in parse_name_directive I think this suffers the same problem as before :(

!parse_name_directive(ln, ignore_stage(config).as_slice()) &&
!(config.mode == common::Pretty && parse_name_directive(ln, "ignore-pretty")) &&
!(config.target != config.host && parse_name_directive(ln, "ignore-cross-compile")) &&
Expand Down
18 changes: 18 additions & 0 deletions src/compiletest/util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,15 @@ static OS_TABLE: &'static [(&'static str, &'static str)] = &[
("dragonfly", "dragonfly"),
];

/// Table to help extracting architecture from triple
static ARCH_TABLE: &'static [&'static str] = &[
"arm",
"mips",
"mipsel",
"x86",
"x86_64",
];

pub fn get_os(triple: &str) -> &'static str {
for &(triple_os, os) in OS_TABLE.iter() {
if triple.contains(triple_os) {
Expand All @@ -34,6 +43,15 @@ pub fn get_os(triple: &str) -> &'static str {
panic!("Cannot determine OS from triple");
}

pub fn get_arch(triple: &str) -> &'static str {
for &triple_arch in ARCH_TABLE.iter() {
if triple.contains(triple_arch) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because x86_64 contains x86, doesn't this mean that // ignore-x86 will ignore 32 and 64 bit platforms?

return triple_arch
}
}
panic!("Cannot determine architecture from triple");
}

#[cfg(target_os = "windows")]
pub fn make_new_path(path: &str) -> String {

Expand Down