diff options
| author | Steven Fackler <sfackler@gmail.com> | 2013-11-03 15:23:34 -0800 |
|---|---|---|
| committer | Steven Fackler <sfackler@gmail.com> | 2013-11-03 22:23:47 -0800 |
| commit | ff859edb8579be4694fe490249e9800cefe50c8c (patch) | |
| tree | c96f99e7fc64b123b8043d13e89412ebbeca411f | |
| parent | 702767db65c9b9d4e601ec5de836246fb9a9e462 (diff) | |
| download | rust-ff859edb8579be4694fe490249e9800cefe50c8c.tar.gz rust-ff859edb8579be4694fe490249e9800cefe50c8c.zip | |
Ensure rustpkg test fails if tests failed
It previously set the exit status, but the main wrapper paved over that with an exit code of 0. Closes #9761
| -rw-r--r-- | src/librustpkg/lib.rs | 4 | ||||
| -rw-r--r-- | src/librustpkg/tests.rs | 15 |
2 files changed, 18 insertions, 1 deletions
diff --git a/src/librustpkg/lib.rs b/src/librustpkg/lib.rs index 517d43432ec..80f1dc2fe93 100644 --- a/src/librustpkg/lib.rs +++ b/src/librustpkg/lib.rs @@ -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 {} \ diff --git a/src/librustpkg/tests.rs b/src/librustpkg/tests.rs index 8f1b269f1ca..072c165cd96 100644 --- a/src/librustpkg/tests.rs +++ b/src/librustpkg/tests.rs @@ -2098,6 +2098,20 @@ fn test_rustpkg_test_output() { } #[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"); let foo_workspace = create_local_package(&foo_id); @@ -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); |
