Skip to content

Add libmachine to share Triple between librustc & compiletest. #13605

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 5 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
17 changes: 15 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,14 @@ 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()
}
}

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
3 changes: 1 addition & 2 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 Down Expand Up @@ -112,7 +111,7 @@ pub fn load_props(testfile: &Path) -> TestProps {

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
Loading