Make rust {test, run} exit with appropriate code.

Scripts need to know if the tests pass or the program ran correctly.
auto merge of #6730 : hjr3/rust/exit_code, r=z0w0

Scripts need to know if the tests pass or the program ran correctly.