Correct exit code when test/run fails

Review 1675 by @larkost
Merge branch 'next' into daniel_geo