File tree 2 files changed +18
-1
lines changed
2 files changed +18
-1
lines changed Original file line number Diff line number Diff line change @@ -699,7 +699,9 @@ impl CtxMethods for BuildContext {
699
699
debug ! ( "test: test_exec = {}" , test_exec. display( ) ) ;
700
700
// FIXME (#9639): This needs to handle non-utf8 paths
701
701
let status = run:: process_status ( test_exec. as_str ( ) . unwrap ( ) , [ ~"--test"] ) ;
702
- os:: set_exit_status ( status) ;
702
+ if status != 0 {
703
+ fail ! ( "Some tests failed" ) ;
704
+ }
703
705
}
704
706
None => {
705
707
error ( format ! ( "Internal error: test executable for package ID {} in workspace {} \
Original file line number Diff line number Diff line change @@ -2097,6 +2097,20 @@ fn test_rustpkg_test_output() {
2097
2097
assert!(output_str.contains(" 1 passed; 0 failed; 0 ignored; 0 measured"));
2098
2098
}
2099
2099
2100
+ #[test]
2101
+ fn test_rustpkg_test_failure_exit_status() {
2102
+ let foo_id = PkgId::new(" foo");
2103
+ let foo_workspace = create_local_package(&foo_id);
2104
+ let foo_workspace = foo_workspace.path();
2105
+ writeFile(&foo_workspace.join_many([" src", " foo-0.1 ", " test. rs"]),
2106
+ " #[ test] fn f( ) { assert!( 'a' != 'a' ) ; } ");
2107
+ let res = command_line_test_partial([~" test", ~" foo"], foo_workspace);
2108
+ match res {
2109
+ Fail(_) => {},
2110
+ Success(*) => fail!(" Expected test failure but got success")
2111
+ }
2112
+ }
2113
+
2100
2114
#[test]
2101
2115
fn test_rebuild_when_needed() {
2102
2116
let foo_id = PkgId::new(" foo");
@@ -2118,6 +2132,7 @@ fn test_rebuild_when_needed() {
2118
2132
}
2119
2133
2120
2134
#[test]
2135
+ #[ignore] // FIXME (#10257): This doesn't work as is since a read only file can't execute
2121
2136
fn test_no_rebuilding() {
2122
2137
let foo_id = PkgId::new(" foo");
2123
2138
let foo_workspace = create_local_package(&foo_id);
You can’t perform that action at this time.
0 commit comments