auto merge of #10254 : sfackler/rust/rustpkg-test-failure, r=alexcrichton

It previously set the exit status, but the main wrapper paved over that
with an exit code of 0.

Closes #9761
This commit is contained in:
bors 2013-11-03 22:56:01 -08:00
commit 94677c18af
2 changed files with 18 additions and 1 deletions

View File

@ -699,7 +699,9 @@ impl CtxMethods for BuildContext {
debug!("test: test_exec = {}", test_exec.display());
// FIXME (#9639): This needs to handle non-utf8 paths
let status = run::process_status(test_exec.as_str().unwrap(), [~"--test"]);
os::set_exit_status(status);
if status != 0 {
fail!("Some tests failed");
}
}
None => {
error(format!("Internal error: test executable for package ID {} in workspace {} \

View File

@ -2097,6 +2097,20 @@ fn test_rustpkg_test_output() {
assert!(output_str.contains("1 passed; 0 failed; 0 ignored; 0 measured"));
}
#[test]
fn test_rustpkg_test_failure_exit_status() {
let foo_id = PkgId::new("foo");
let foo_workspace = create_local_package(&foo_id);
let foo_workspace = foo_workspace.path();
writeFile(&foo_workspace.join_many(["src", "foo-0.1", "test.rs"]),
"#[test] fn f() { assert!('a' != 'a'); }");
let res = command_line_test_partial([~"test", ~"foo"], foo_workspace);
match res {
Fail(_) => {},
Success(*) => fail!("Expected test failure but got success")
}
}
#[test]
fn test_rebuild_when_needed() {
let foo_id = PkgId::new("foo");
@ -2118,6 +2132,7 @@ fn test_rebuild_when_needed() {
}
#[test]
#[ignore] // FIXME (#10257): This doesn't work as is since a read only file can't execute
fn test_no_rebuilding() {
let foo_id = PkgId::new("foo");
let foo_workspace = create_local_package(&foo_id);