Skip to content

Commit

Permalink
Merge pull request #50 from mcarton/rustup
Browse files Browse the repository at this point in the history
Update to *rustc 1.14.0-nightly (6e8f92f11 2016-10-07)*
  • Loading branch information
Manishearth authored Oct 8, 2016
2 parents c840609 + 27fd2d0 commit 559208a
Show file tree
Hide file tree
Showing 6 changed files with 56 additions and 41 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "compiletest_rs"
version = "0.2.2"
version = "0.2.3"
authors = [ "The Rust Project Developers"
, "Thomas Bracht Laumann Jespersen <laumann.thomas@gmail.com>"
, "Manish Goregaokar <manishsmail@gmail.com>"
Expand Down
1 change: 1 addition & 0 deletions src/common.rs
Original file line number Diff line number Diff line change
Expand Up @@ -183,4 +183,5 @@ pub struct Config {
pub cflags: String,
pub llvm_components: String,
pub llvm_cxxflags: String,
pub nodejs: Option<String>,
}
3 changes: 2 additions & 1 deletion src/compiletest.rs
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ pub fn default_config() -> Config {
cflags: "cflags".to_string(),
llvm_components: "llvm-components".to_string(),
llvm_cxxflags: "llvm-cxxflags".to_string(),
nodejs: None,
}
}

Expand Down Expand Up @@ -288,7 +289,7 @@ pub fn make_test_name(config: &Config, testpaths: &TestPaths) -> test::TestName
pub fn make_test_closure(config: &Config, testpaths: &TestPaths) -> test::TestFn {
let config = config.clone();
let testpaths = testpaths.clone();
test::DynTestFn(Box::new(move || {
test::DynTestFn(Box::new(move |()| {
runtest::run(config, &testpaths)
}))
}
Expand Down
50 changes: 24 additions & 26 deletions src/header.rs
Original file line number Diff line number Diff line change
Expand Up @@ -182,42 +182,32 @@ pub struct TestProps {
// testing harness and used when generating compilation
// arguments. (In particular, it propagates to the aux-builds.)
pub incremental_dir: Option<PathBuf>,
// Specifies that a cfail test must actually compile without errors.
pub must_compile_successfully: bool,
}

impl TestProps {
pub fn new() -> Self {
let error_patterns = Vec::new();
let aux_builds = Vec::new();
let exec_env = Vec::new();
let run_flags = None;
let pp_exact = None;
let check_lines = Vec::new();
let build_aux_docs = false;
let force_host = false;
let check_stdout = false;
let no_prefer_dynamic = false;
let pretty_expanded = false;
let pretty_compare_only = false;
let forbid_output = Vec::new();
TestProps {
error_patterns: error_patterns,
error_patterns: vec![],
compile_flags: vec![],
run_flags: run_flags,
pp_exact: pp_exact,
aux_builds: aux_builds,
run_flags: None,
pp_exact: None,
aux_builds: vec![],
revisions: vec![],
rustc_env: vec![],
exec_env: exec_env,
check_lines: check_lines,
build_aux_docs: build_aux_docs,
force_host: force_host,
check_stdout: check_stdout,
no_prefer_dynamic: no_prefer_dynamic,
pretty_expanded: pretty_expanded,
exec_env: vec![],
check_lines: vec![],
build_aux_docs: false,
force_host: false,
check_stdout: false,
no_prefer_dynamic: false,
pretty_expanded: false,
pretty_mode: format!("normal"),
pretty_compare_only: pretty_compare_only,
forbid_output: forbid_output,
pretty_compare_only: false,
forbid_output: vec![],
incremental_dir: None,
must_compile_successfully: false,
}
}

Expand Down Expand Up @@ -313,6 +303,10 @@ impl TestProps {
if let Some(of) = parse_forbid_output(ln) {
self.forbid_output.push(of);
}

if !self.must_compile_successfully {
self.must_compile_successfully = parse_must_compile_successfully(ln);
}
});

for key in vec!["RUST_TEST_NOCAPTURE", "RUST_TEST_THREADS"] {
Expand Down Expand Up @@ -420,6 +414,10 @@ fn parse_pretty_compare_only(line: &str) -> bool {
parse_name_directive(line, "pretty-compare-only")
}

fn parse_must_compile_successfully(line: &str) -> bool {
parse_name_directive(line, "must-compile-successfully")
}

fn parse_env(line: &str, name: &str) -> Option<(String, String)> {
parse_name_value_directive(line, name).map(|nv| {
// nv is either FOO or FOO=BAR
Expand Down
37 changes: 25 additions & 12 deletions src/runtest.rs
Original file line number Diff line number Diff line change
Expand Up @@ -129,13 +129,21 @@ impl<'test> TestCx<'test> {
fn run_cfail_test(&self) {
let proc_res = self.compile_test();

if proc_res.status.success() {
self.fatal_proc_rec(
&format!("{} test compiled successfully!", self.config.mode)[..],
&proc_res);
}
if self.props.must_compile_successfully {
if !proc_res.status.success() {
self.fatal_proc_rec(
"test compilation failed although it shouldn't!",
&proc_res);
}
} else {
if proc_res.status.success() {
self.fatal_proc_rec(
&format!("{} test compiled successfully!", self.config.mode)[..],
&proc_res);
}

self.check_correct_failure_status(&proc_res);
self.check_correct_failure_status(&proc_res);
}

let output_to_check = self.get_output(&proc_res);
let expected_errors = errors::load_errors(&self.testpaths.file, self.revision);
Expand All @@ -147,6 +155,7 @@ impl<'test> TestCx<'test> {
} else {
self.check_error_patterns(&output_to_check, &proc_res);
}

self.check_no_compiler_crash(&proc_res);
self.check_forbid_output(&output_to_check, &proc_res);
}
Expand Down Expand Up @@ -943,8 +952,12 @@ actual:\n\
output_to_check: &str,
proc_res: &ProcRes) {
if self.props.error_patterns.is_empty() {
self.fatal(&format!("no error pattern specified in {:?}",
self.testpaths.file.display()));
if self.props.must_compile_successfully {
return
} else {
self.fatal(&format!("no error pattern specified in {:?}",
self.testpaths.file.display()));
}
}
let mut next_err_idx = 0;
let mut next_err_pat = self.props.error_patterns[next_err_idx].trim();
Expand Down Expand Up @@ -1155,7 +1168,6 @@ actual:\n\
"arm-linux-androideabi" | "armv7-linux-androideabi" | "aarch64-linux-android" => {
self._arm_exec_compiled_test(env)
}

_=> {
let aux_dir = self.aux_output_dir_name();
self.compose_and_run(self.make_run_args(),
Expand Down Expand Up @@ -1408,7 +1420,7 @@ actual:\n\
fn make_exe_name(&self) -> PathBuf {
let mut f = self.output_base_name();
// FIXME: This is using the host architecture exe suffix, not target!
if self.config.target == "asmjs-unknown-emscripten" {
if self.config.target.contains("emscripten") {
let mut fname = f.file_name().unwrap().to_os_string();
fname.push(".js");
f.set_file_name(&fname);
Expand All @@ -1426,8 +1438,9 @@ actual:\n\
let mut args = self.split_maybe_args(&self.config.runtool);

// If this is emscripten, then run tests under nodejs
if self.config.target == "asmjs-unknown-emscripten" {
args.push("nodejs".to_owned());
if self.config.target.contains("emscripten") {
let nodejs = self.config.nodejs.clone().unwrap_or("nodejs".to_string());
args.push(nodejs);
}

let exe_file = self.make_exe_name();
Expand Down
4 changes: 3 additions & 1 deletion src/util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ const OS_TABLE: &'static [(&'static str, &'static str)] = &[("android", "android
("darwin", "macos"),
("dragonfly", "dragonfly"),
("freebsd", "freebsd"),
("haiku", "haiku"),
("ios", "ios"),
("linux", "linux"),
("mingw32", "windows"),
Expand All @@ -42,7 +43,8 @@ const ARCH_TABLE: &'static [(&'static str, &'static str)] = &[("aarch64", "aarch
("sparc", "sparc"),
("x86_64", "x86_64"),
("xcore", "xcore"),
("asmjs", "asmjs")];
("asmjs", "asmjs"),
("wasm32", "wasm32")];

pub fn get_os(triple: &str) -> &'static str {
for &(triple_os, os) in OS_TABLE {
Expand Down

0 comments on commit 559208a

Please sign in to comment.