exit with non-zero status when tests fail (fixes #858)