about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--src/librustpkg/lib.rs4
-rw-r--r--src/librustpkg/tests.rs15
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);