Skip to content

Commit 64ff315

Browse files
committed
auto merge of rust-lang#8950 : sanxiyn/rust/cross-xfail, r=brson
2 parents 1611e7b + 877e7f3 commit 64ff315

File tree

2 files changed

+23
-4
lines changed

2 files changed

+23
-4
lines changed

src/compiletest/header.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@
1010

1111
use common::config;
1212
use common;
13+
use util;
1314

1415
use std::io;
15-
use std::os;
1616

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

9191
pub fn is_test_ignored(config: &config, testfile: &Path) -> bool {
92-
fn xfail_target() -> ~str {
93-
~"xfail-" + os::SYSNAME
92+
fn xfail_target(config: &config) -> ~str {
93+
~"xfail-" + util::get_os(config.target)
9494
}
9595
9696
let val = do iter_header(testfile) |ln| {
9797
if parse_name_directive(ln, "xfail-test") { false }
98-
else if parse_name_directive(ln, xfail_target()) { false }
98+
else if parse_name_directive(ln, xfail_target(config)) { false }
9999
else if config.mode == common::mode_pretty &&
100100
parse_name_directive(ln, "xfail-pretty") { false }
101101
else { true }

src/compiletest/util.rs

+19
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,25 @@ use common::config;
1313
use std::io;
1414
use std::os::getenv;
1515

16+
/// Conversion table from triple OS name to Rust SYSNAME
17+
static OS_TABLE: &'static [(&'static str, &'static str)] = &[
18+
("mingw32", "win32"),
19+
("win32", "win32"),
20+
("darwin", "macos"),
21+
("android", "android"),
22+
("linux", "linux"),
23+
("freebsd", "freebsd"),
24+
];
25+
26+
pub fn get_os(triple: &str) -> &'static str {
27+
for &(triple_os, os) in OS_TABLE.iter() {
28+
if triple.contains(triple_os) {
29+
return os
30+
}
31+
}
32+
fail!("Cannot determine OS from triple");
33+
}
34+
1635
pub fn make_new_path(path: &str) -> ~str {
1736

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

0 commit comments

Comments
 (0)