Skip to content

Filesearch fixes for crosses. #13450

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 18 commits 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
9 changes: 5 additions & 4 deletions mk/crates.mk
Original file line number Diff line number Diff line change
Expand Up @@ -52,17 +52,17 @@
TARGET_CRATES := libc std green rustuv native flate arena glob term semver \
uuid serialize sync getopts collections num test time rand \
workcache url log
HOST_CRATES := syntax rustc rustdoc fourcc hexfloat
HOST_CRATES := syntax rustc rustdoc fourcc hexfloat machine
CRATES := $(TARGET_CRATES) $(HOST_CRATES)
TOOLS := compiletest rustdoc rustc

DEPS_std := libc native:rustrt native:compiler-rt native:backtrace
DEPS_green := std rand native:context_switch
DEPS_rustuv := std native:uv native:uv_support
DEPS_native := std
DEPS_syntax := std term serialize collections log
DEPS_syntax := std term serialize collections log machine
DEPS_rustc := syntax native:rustllvm flate arena serialize sync getopts \
collections time log
collections time log machine
DEPS_rustdoc := rustc native:sundown serialize sync getopts collections \
test time
DEPS_flate := std native:miniz
Expand All @@ -84,8 +84,9 @@ DEPS_rand := std
DEPS_url := std collections
DEPS_workcache := std serialize collections log
DEPS_log := std sync
DEPS_machine := std

TOOL_DEPS_compiletest := test green rustuv getopts
TOOL_DEPS_compiletest := test green rustuv getopts machine
TOOL_DEPS_rustdoc := rustdoc native
TOOL_DEPS_rustc := rustc native
TOOL_SOURCE_compiletest := $(S)src/compiletest/compiletest.rs
Expand Down
2 changes: 1 addition & 1 deletion mk/tests.mk
Original file line number Diff line number Diff line change
Expand Up @@ -568,7 +568,7 @@ CTEST_COMMON_ARGS$(1)-T-$(2)-H-$(3) := \
--host $(3) \
--adb-path=$(CFG_ADB) \
--adb-test-dir=$(CFG_ADB_TEST_DIR) \
--host-rustcflags "$(RUSTC_FLAGS_$(3)) $$(CTEST_RUSTC_FLAGS) -L $$(RT_OUTPUT_DIR_$(2))" \
--host-rustcflags "$(RUSTC_FLAGS_$(3)) $$(CTEST_RUSTC_FLAGS) -L $$(RT_OUTPUT_DIR_$(3))" \
--target-rustcflags "$(RUSTC_FLAGS_$(2)) $$(CTEST_RUSTC_FLAGS) -L $$(RT_OUTPUT_DIR_$(2))" \
$$(CTEST_TESTARGS)

Expand Down
22 changes: 20 additions & 2 deletions src/compiletest/common.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.

use machine::triple::Triple;

#[deriving(Clone, Eq)]
pub enum mode {
mode_compile_fail,
Expand Down Expand Up @@ -87,10 +89,10 @@ pub struct config {
pub jit: bool,

// Target system to be tested
pub target: ~str,
pub target: Triple,

// Host triple for the compiler being invoked
pub host: ~str,
pub host: Triple,

// Extra parameter to run adb on arm-linux-androideabi
pub adb_path: ~str,
Expand All @@ -105,3 +107,19 @@ pub struct config {
pub verbose: bool

}

impl config {
pub fn is_cross_compile(&self) -> bool {
self.target != self.host
}

pub fn is_target_android(&self) -> bool {
self.target.is_android()
}
}

#[deriving(Clone, Eq, Hash, TotalEq)]
pub enum BuildFor {
TargetBuild,
HostBuild,
}
19 changes: 16 additions & 3 deletions src/compiletest/compiletest.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ extern crate getopts;
extern crate log;
extern crate green;
extern crate rustuv;
extern crate machine;

use std::os;
use std::io;
Expand Down Expand Up @@ -58,6 +59,8 @@ pub fn main() {
}

pub fn parse_config(args: Vec<~str> ) -> config {
use std::from_str::FromStr;
use std::default::Default;

let groups : Vec<getopts::OptGroup> =
vec!(reqopt("", "compile-lib-path", "path to host shared libraries", "PATH"),
Expand Down Expand Up @@ -145,8 +148,18 @@ pub fn parse_config(args: Vec<~str> ) -> config {
host_rustcflags: matches.opt_str("host-rustcflags"),
target_rustcflags: matches.opt_str("target-rustcflags"),
jit: matches.opt_present("jit"),
target: opt_str2(matches.opt_str("target")).to_str(),
host: opt_str2(matches.opt_str("host")).to_str(),
target: matches
.opt_str("target")
.and_then(|triple| {
FromStr::from_str(triple)
})
.unwrap_or_else(|| Default::default() ),
host: matches
.opt_str("host")
.and_then(|triple| {
FromStr::from_str(triple)
})
.unwrap_or_else(|| Default::default() ),
adb_path: opt_str2(matches.opt_str("adb-path")).to_str(),
adb_test_dir:
opt_str2(matches.opt_str("adb-test-dir")).to_str(),
Expand Down Expand Up @@ -226,7 +239,7 @@ pub fn mode_str(mode: mode) -> ~str {
}

pub fn run_tests(config: &config) {
if config.target == ~"arm-linux-androideabi" {
if config.is_target_android() {
match config.mode{
mode_debug_info => {
println!("arm-linux-androideabi debug-info \
Expand Down
33 changes: 23 additions & 10 deletions src/compiletest/header.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@

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

pub struct TestProps {
// Lines that should be expected, in order, on standard out
Expand All @@ -28,8 +27,13 @@ pub struct TestProps {
pub debugger_cmds: Vec<~str> ,
// Lines to check if they appear in the expected debugger output
pub check_lines: Vec<~str> ,
// Flag to force a crate to be built with the host architecture
pub force_host: bool,
// Flag to additionally build a crate for the host architecture
// Used for some aux crates that export syntax extensions.
pub needs_host: bool,
// Flag for syntax extensions aux' that use libsyntax (a host crate,
// so therefore can't, for the time being, target the target).
// Ignored on non-aux crates && implies needs-host.
pub only_host: bool,
// Check stdout for error-pattern output as well as stderr
pub check_stdout: bool,
// Don't force a --crate-type=dylib flag on the command line
Expand All @@ -45,7 +49,8 @@ pub fn load_props(testfile: &Path) -> TestProps {
let mut pp_exact = None;
let mut debugger_cmds = Vec::new();
let mut check_lines = Vec::new();
let mut force_host = false;
let mut needs_host = false;
let mut only_host = false;
let mut check_stdout = false;
let mut no_prefer_dynamic = false;
iter_header(testfile, |ln| {
Expand All @@ -62,8 +67,11 @@ pub fn load_props(testfile: &Path) -> TestProps {
pp_exact = parse_pp_exact(ln, testfile);
}

if !force_host {
force_host = parse_force_host(ln);
if !needs_host {
needs_host = parse_needs_host(ln);
}
if !only_host {
only_host = parse_only_host(ln);
}

if !check_stdout {
Expand Down Expand Up @@ -104,15 +112,16 @@ pub fn load_props(testfile: &Path) -> TestProps {
exec_env: exec_env,
debugger_cmds: debugger_cmds,
check_lines: check_lines,
force_host: force_host,
needs_host: needs_host,
only_host: only_host,
check_stdout: check_stdout,
no_prefer_dynamic: no_prefer_dynamic,
};
}

pub fn is_test_ignored(config: &config, testfile: &Path) -> bool {
fn ignore_target(config: &config) -> ~str {
~"ignore-" + util::get_os(config.target)
~"ignore-" + config.target.expect_known_os().to_str()
}
fn ignore_stage(config: &config) -> ~str {
~"ignore-" + config.stage_id.split('-').next().unwrap()
Expand Down Expand Up @@ -168,8 +177,12 @@ fn parse_check_line(line: &str) -> Option<~str> {
parse_name_value_directive(line, ~"check")
}

fn parse_force_host(line: &str) -> bool {
parse_name_directive(line, "force-host")
fn parse_needs_host(line: &str) -> bool {
parse_name_directive(line, "needs-host")
}

fn parse_only_host(line: &str) -> bool {
parse_name_directive(line, "only-host")
}

fn parse_check_stdout(line: &str) -> bool {
Expand Down
Loading