Skip to content

Correctly determine OS to xfail in cross build #8950

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
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
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: 4 additions & 4 deletions src/compiletest/header.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@

use common::config;
use common;
use util;

use std::io;
use std::os;

pub struct TestProps {
// Lines that should be expected, in order, on standard out
Expand Down Expand Up @@ -89,13 +89,13 @@ pub fn load_props(testfile: &Path) -> TestProps {
}

pub fn is_test_ignored(config: &config, testfile: &Path) -> bool {
fn xfail_target() -> ~str {
~"xfail-" + os::SYSNAME
fn xfail_target(config: &config) -> ~str {
~"xfail-" + util::get_os(config.target)
}

let val = do iter_header(testfile) |ln| {
if parse_name_directive(ln, "xfail-test") { false }
else if parse_name_directive(ln, xfail_target()) { false }
else if parse_name_directive(ln, xfail_target(config)) { false }
else if config.mode == common::mode_pretty &&
parse_name_directive(ln, "xfail-pretty") { false }
else { true }
Expand Down
19 changes: 19 additions & 0 deletions src/compiletest/util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,25 @@ use common::config;
use std::io;
use std::os::getenv;

/// Conversion table from triple OS name to Rust SYSNAME
static OS_TABLE: &'static [(&'static str, &'static str)] = &[
("mingw32", "win32"),
("win32", "win32"),
("darwin", "macos"),
("android", "android"),
("linux", "linux"),
("freebsd", "freebsd"),
];

pub fn get_os(triple: &str) -> &'static str {
for &(triple_os, os) in OS_TABLE.iter() {
if triple.contains(triple_os) {
return os
}
}
fail!("Cannot determine OS from triple");
}

pub fn make_new_path(path: &str) -> ~str {

// Windows just uses PATH as the library search path, so we have to
Expand Down