auto merge of #8950 : sanxiyn/rust/cross-xfail, r=brson

This commit is contained in:
bors 2013-09-03 23:15:56 -07:00
commit 64ff315584
2 changed files with 23 additions and 4 deletions

View File

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

View File

@ -13,6 +13,25 @@
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